On 03/28/2011 05:34 PM, Marc Kleine-Budde wrote:
> On 03/28/2011 05:23 PM, Wolfgang Grandegger wrote:
>> On 03/28/2011 04:05 PM, Georgy Lukonin wrote:
>>> Hello!
>>>
>>> Currently there is a problem if two programs trying to access the socket.
>>> In my case the one program sends only few packets over the CAN. The
>>> another one sends a huge amount of packets. This causes a frequently
>>> reset of the device and the lost of messages in the buffer. 
>>
>> What makes you think that the device has been resetted?
>>
>>> I get this messages:
>>>
>>> can: chip_stopped
>>> can: at91_close
>>> at91_can at91_can: bitrate error 0.3%
>>> at91_can at91_can: writing AT91_BR: 0x000a0122
>>> can: chip_started!
>>> can: at91_open
>>>
>>>
>>> What is the best way to avoid this behaviour? How can I check if there
>>> are any free buffers available?
>>
>> You should check the return code of the send/write function and retry it
>> it returns -ENOBUFS (after some delay). Or are you doing that already?
> 
> BTW: I figured out why poll() wakes you up but the next write will fail
> with -ENOBUFS again.

Ah, I'm curious? I also did realize that poll does burn CPU cycles
(instead of waiting).

Wolfgang.
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to