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. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
