Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error frames in linux SocketCan #5

Open
ersinkaraduman opened this issue Nov 6, 2021 · 6 comments
Open

Error frames in linux SocketCan #5

ersinkaraduman opened this issue Nov 6, 2021 · 6 comments

Comments

@ersinkaraduman
Copy link

ersinkaraduman commented Nov 6, 2021

When the connected device is no longer available on the bus after a message transmit USB2CAN is always reporting error frames. You can't clear the send buffer. Tons of error frames are receiving and you cannot stop without depluging and replugging the device which is very bad for industrial device.

Could you guide me a way on python-can library to reset the tx buffer inside the USB2CAN to stop the error frames. If put the device on down state and re enable to up it continues to report error frames.

@sresam89
Copy link

Same issue here, any solution?

@Kheirlb
Copy link

Kheirlb commented Mar 11, 2024

I believe I am also running into the same issue. To reproduce in my setup:

  1. Connect Pi to USB2CAN to CAN bus with working nodes.
  2. Physically disconnect nodes
  3. Send just one message cansend can0 200#DEADBEEF
  4. can state switches from ERROR-ACTIVE to ERROR-PASSIVE
  5. Even if reconnected, the issue is not fully resolved (stuck in ERROR-PASSIVE state)
  6. candump does not show the error frames, but other systems do

@LivingWithHippos
Copy link

5. Even if reconnected, the issue is not fully resolved (stuck in `ERROR-PASSIVE` state)

Are you bringing the interface down and up again? When it goes to passive it does not switch back automatically (normal CAN behaviour)

6. candump does not show the error frames, but other systems do

Are you using the -xe flags to show error frames? You can also use watch -dc ip -details -stat link show canXXX to monitor errors and state changes

I've noticed that when enough error frames are spammed the device silently fails even after a reboot and with nodes connected, everything looks good but it just does not work. Only turning off the power or reconnecting it work. I'm trying to remove power only from its USB port to at least be able to use it again. Not happy at all honestly...

@Kheirlb
Copy link

Kheirlb commented Mar 11, 2024

When it goes to passive it does not switch back automatically (normal CAN behaviour)

Didn't know this. Thanks. down/up does move it back into ACTIVE.

Are you using the -xe flags to show error frames?

Didn't know this either. Understood.

I've noticed that when enough error frames are spammed the device silently fails

That's not ideal. In my setup, I disconnect and reconnect often. I have yet to have the adapter fail. I wonder if there is another inexpensive option out there that works with socketcan.

@LivingWithHippos
Copy link

It happens only if you send a message with no other nodes and don't connect any for some time. If you reconnect after some seconds it will "consume" the messages and avoid the crash or whatever it is

@Kheirlb
Copy link

Kheirlb commented Mar 12, 2024

If you reconnect after some seconds

If I reconnect after a couple of minutes, it still works. I'll try letting it run overnight disconnected and maybe see if I can cause it to "crash".

candump does not show the error frames, but other systems do

More context on "other systems". For me, I specifically see message id 36 / 0x24 spam when I use this nodejs library https://github.com/sebi2k1/node-can. Luckily if I just ignore all messages with this id, I can workaround this problem for now (I think)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants