Author Topic: How Error Detection work in CAN protocol  (Read 1361 times)

0 Members and 1 Guest are viewing this topic.

Offline Kittu20Topic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: in
How Error Detection work in CAN protocol
« on: March 27, 2024, 10:51:12 am »
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!
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1927
  • Country: us
Re: How Error Detection work in CAN protocol
« Reply #1 on: April 05, 2024, 12:43:42 pm »
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:

 

Offline John Coloccia

  • Super Contributor
  • ***
  • Posts: 1217
  • Country: us
Re: How Error Detection work in CAN protocol
« Reply #2 on: April 15, 2024, 07:33:11 pm »
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).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf