Electronics > Microcontrollers

How Error Detection work in CAN protocol


Hello everyone,

I've been looking the CAN protocol specifications and I'm a bit confused about how error detection works in CAN.

In my understanding In the CAN protocol, one node transmits a message and other connected nodes receive it, if receiver node detect error in message it send error frame to other nodes to notifying them about error

I'm wondering: does only the receiver node check for errors, or do both the sender and receiver nodes check for errors? I means does sender node also check error before to transmit message on the bus?

I'd appreciate any clarifications on this topic. Thank you in advance for your help!

Since no one else has responded....

Both ends monitor the network for any of several error types. Collisions cause backoff and retransmission. As for bit errors occurring during transmit, here is a page from a nice plain-language intro from Microchip:

John Coloccia:
The transmitter checks for errors as well because it's constantly monitoring the bus, just like everyone else. In CAN, you are always reading the bus.

The error that the current transmitter can detect is "I meant to send bit X, and instead I read back bit Y". Everyone else on the bus can detect valid/invalid messages and generate error frames or acks. The transmitter has no reason to check for format errors, etc. It assumes that it's transmitting what it intends to transmit. It just checks that the intended bit made it to the bus OK.

FWIW, in CAN, there is no real arbitration/retry, like you normally think of it. Everyone transmits when they feel like it. The message ID's are prioritized. If you start transmitting and read back a higher priority ID than what you're trying to send, you shut up and let the other guy finish. More precisely, lowest ID is highest priority message, 1's are recessive, 0 is active. To transmit a 1, you do nothing. To transmit a 0, you drive the lines.

So as you're transmitting the message ID, if you ever try and transmit a 1, but read back a 0, someone else is higher priority and you should shut up and read the rest of the message (i.e. you did nothing to transmit 1, and someone else did something to transmit 0).


[0] Message Index

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod