From: Roland Tollenaar <rwatollenaar@domain.hid>
To: Sebastian Smolorz <ssm@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] catching CAN errors
Date: Mon, 05 Mar 2007 15:08:23 +0100 [thread overview]
Message-ID: <45EC2457.70100@domain.hid> (raw)
In-Reply-To: <E1HODPx-0003WJ-5L@mailer.emlix.com>
Hi,
>> the overflowing of the buffer.
>
> CAN socket buffer overflow --> kernel prints warnings --> syslogd logs these
> warnings
thanks this helps.
> As I stated in another mail you can silence the overflow message by
> configuring it out. But ask yourself if this is really what you want. Losing
> messages due to an overflowing buffer is nothing that should appear regularly
> but rather as exception. The kernel message is meant to inform you of this
> exceptional situation. If you lose messages under RT conditions you very
> likely have more severe problems than a kernel printing out too much
> information.
True. Very true. Well lets pursue this line of thought then. My node is
set to sending 1 message every 1ms if the position changes. I am reading
out the message buffer and it seems to work. But in theory I should only
be findin 1 or zero messages in the buffer every time I read. Why don't
I? Is the messagebuffer perhaps not cleaned out when I do a read? I only
get an overflow when the sensor moves and emits readings. the readings
are fine and I don;t have any masks set for errors anyway so I assume
that my reads are not cleaning out the entire buffer. I have pasted in
the code in which I do the reading. Am I doing something wrong?
while(ret>=0){
ret = rt_dev_recv (can_fd, (void *)&Rxframe,
sizeof(can_frame_t), MSG_DONTWAIT);
if (ret < 0) {
switch (ret) {
case -ETIMEDOUT:
printf("rt_dev_recv: timed out");
break;
case -EBADF:
printf("rt_dev_recv: aborted because
socket was closed");
break;
}
}
}//while message buffer not empty
//when exiting this loop the message buffer will be empty??????
I have cleared out some of the code in the loop for selecting the
message I want and so on but it will in essence not influence the
beahvior above.
>
> Right. In fact, for the RAW protocol layer this is the very same situation as
> with the error frames. In my opinion, a clean design approach is not to
> silence the warnings because the discarding of CAN frames takes place
> regardless of this. I think you have to options:
> 1. If messages are lost sporadically try to enlarge the socker buffer size.
Have considered this but it will slow down the reading routine (while
loop in above snippet runs longer)
> 2. If messages are lost permanently your real-time task is overloaded. Try to
> lower the baud rate, set an appropriate filter or, more likely, rethink your
> whole system design.
The design should be right. At the moment I am only looking for one
message and only one message seems to be filling the message buffer.
Filtering that will give me no reading.
If CAN frames are piling up in the socket buffer and
> your application isn't quick enough to read them out although it does nothing
> else than receiving them, then there is something going wrong.
Probably. Hope you see something wrong in the reading loop.
According to the documentation a normal recv will remove the message
from the buffer unless PEAK_something flag is used. So I assume that I
am clearing out the buffer in the above code.
Regard,s
Roland
>
> --
> Sebastian
>
next prev parent reply other threads:[~2007-03-05 14:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-03 13:54 [Xenomai-help] catching CAN errors roland Tollenaar
2007-03-05 11:06 ` Sebastian Smolorz
2007-03-05 11:22 ` Roland Tollenaar
2007-03-05 11:49 ` Sebastian Smolorz
[not found] ` <45EC0970.1060606@domain.hid>
2007-03-05 13:40 ` Sebastian Smolorz
2007-03-05 14:08 ` Roland Tollenaar [this message]
2007-03-05 14:39 ` Sebastian Smolorz
[not found] ` <45EC2F61.2060307@domain.hid>
2007-03-05 15:18 ` Sebastian Smolorz
2007-03-05 22:15 ` roland Tollenaar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45EC2457.70100@domain.hid \
--to=rwatollenaar@domain.hid \
--cc=rolandtollenaar@domain.hid \
--cc=ssm@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.