Clear transmit buffer?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Clear transmit buffer?

MartinH.
Hi folks,
I am stumbling about how to clear the SocketCAN transmit buffer (clear, not flush ). This is what happens:

- Run a normal communication (in my case its CANopen) where the linux node is actively sending (like for example a heartbeat)
- Unplug the CAN cable at the transceiver of the linux node
- You can observe the Transmit error counter going up till it reaches Error_Passive
- Due to the missing ACK we will never reach Bus_Off
- Plug in the CAN cable again, transmitting is possible again
- Now the old buffered content of the transmit buffer is send all at once

This is problematic as it may contain old and no longer up-to date status information.
Therefore my question is how can I clear this transmit buffer manually?
What works is closing/reopening the socket, as well as recovering from Bus_Off includes a clear, but above case is a special condition.

Your support is appreciated :-)
Thanks and regards,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Clear transmit buffer?

MartinH.
Take a look at http://thread.gmane.org/gmane.linux.can/2181
Essentially it says: Netlink UP->DOWN->UP clears internal buffers.
Works for me
Cheers Martin