0

I'm new to using CAN and revpi. Using a revpi with a CAN module... it is connected to customer CAN node(s).

I'm finding that sometimes the CAN network goes down.

I have to restart it like this:

sudo ip link set can0 down

sudo ip link set can0 type can restart-ms 100

(I attempt to use this command instead, "sudo ip link set can0 type can restart" but it gives an invalid argument error)

sudo ip link set can0 up

Suppose the revpi is the only CAN node that is up, all the other CAN nodes are powered down. Then I assume what will happen is, transmission errors will accumulate on the revpi and eventually the can bus will go into BUS-OFF state? Is that right? I suspect this might be what's going on. What other other issues can cause transmission errors? Thanks.

1
  • 1
    bad wiring ....
    – jsotola
    Jul 3 at 2:45

1 Answer 1

2

This is intended to help you understand what is happening, you are very close. I am not qualified to tell you how to bring it back with your setup. More than likely you are dropping out because external modules do not acknowledge your CAN transmissions. Internal to the CAN protocol is a ACK that is generated from another device on the bus that is not the one sending. Hence no ACK the error counter is increased (default probably 255). The hardware internal to the CAN controller controls the counters.

When any internal Error Counter raises over a certain value, dependent on the controller that number can be changed, the node will first become “error passive”. That indicates that the controller will not actively destroy the bus traffic when it detects an error. If this continues it will then go into the Bus-OFF state is what should do so as to not block or contaminate other messages. It will not participate in any bus traffic. The CAN module monitors each bit it sends and when it sends a recessive bit and the bus is in the active state it will cause an error and it will back off. Again this is to insure the message was sent. There are many CAN modules and they are not all the same. Do not mistake the Controller for the bus driver they are different.

I do not know your software but my experience (mainly automotive) when a module goes BUS-OFF its internal software will try to determine and correct the fault then go back online without external intervention. That code in your case would reside in your Raspberry Pi software.

2
  • Thanks. It seems to be going into the bus-off state immediately with a single error. Last time I checked the log after this happened... there was only a single error and it was in bus-off. Any idea what could cause that? Jul 5 at 23:16
  • 2
    Not really. I do not know what is being logged and how. Remember the retries happen rapidly and once you hit BUS-OFF it does nothing as designed until reset etc via your software.
    – Gil
    Jul 6 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.