Electronic – Additional requirement for checksum over CAN bus

can

Im working on a safety system project and sending messages over CAN bus among systems. Since the CAN protocol already includes a hardware CRC for messages sent over the bus,I was wondering if additional checksum for the data bytes is required or is the hardware CRC sufficient.
For ex: For 8 data bytes sent in CAN, should 1 byte out of 8 bytes be allocated for checksum of the 7 bytes being sent ,or, can I send 8 data bytes and rely on the hardware CRC to ensure the integrity of message?

Best Answer

It's a probability game and a tradeoff of costs. What's the cost of getting bad data? What's the cost of decreasing the chance of getting bad data?

You can't ever absolutely guarantee that data is received correctly. All you can do is decrease the chance of that happening by throwing ever more resources as it. At some point it becomes not worth it to spend more resources to decrease the chance of bad data a little more. Only you can answer what that point is.

That said, the 15 bit CRC checksum CAN uses on every message is good enough for the vast majority of applications. CRCs can be arranged to always detect a single bit error, but it is possible to change multiple bits so that the result looks correct.

The 15 bit CRC in a CAN message has 32768 possible values. If you throw random message content at it, there is one chance in 32768 of it resulting in any particular CRC. At first glance, you can therefore say the probability of a bad message looking correct is the probability of getting two or more bit errors within a message, divided by 32768. It's actually less than that because some random errors will make the whole CAN message structurally incorrect, but the above is a good start.

You compute the probability of getting bad bits in the first place from the bit error rate. The typical CAN bus is implemented as a symmetric differential signal, and is quite robust even with lots of external noise. Consider that CAN was originally designed for automobiles, which are electrically very noisy environments. The point of this is that the bit error rate will be quite small. For example, 1 in 106 would be a huge and unlikely bit error rate.

Unless you are doing something very unusual and critical, just using the CAN checksum without any additional integrity checking at the application level will be good enough. If you're in such a critical application where it's not good enough, then you should be looking at multiple independent and redundant busses and other higher level schemes anyway.