Am I on the Right Track – CAN Protocol ?

Ian0

Joined Aug 7, 2020
13,188
My experience matches the first part of that but not the second! I use a CAN bus with the MCP2515 chips, and I'm running someone's library on an Arduino. I got it wired per directions, installed some code from the library examples folder, and away it went.

This came after a long period when I was using an RS485 network. It was perfectly reliable, but I spent a lot of programming hours ensuring that it would work properly, with the main issue being the question of when a particular node was authorized to transmit. It's impossible to have a true peer-to-peer system with RS485, where there doesn't have to be any kind of master unit directing events. Whereas with CAN, each processor can act as if it has the right to transmit any time it wants. That's why I say there's magic which you don't need to understand--in fact priority is being sorted out, but you can just let it happen.

Another drawback with RS485 in a party-line application is that every processor has to read every byte, in order to decide whether it's being addressed. That leads to a lot of interrupts! On a CAN network, processors are only interrupted if there's a complete message, and even beyond that, the external hardware can filter incoming messages and only alert the processor if it's something that an individual node needs. The amount of hassle involved in using CAN is comparatively very small.
I wrote my own code from the processor manual (Renesas RA4m1), and in the process discovered a bug in the CAN hardware. No - it can’t deal with mixed 11 bit and 29 bit headers.
 

Papabravo

Joined Feb 24, 2006
22,095
I wrote my own code from the processor manual (Renesas RA4m1), and in the process discovered a bug in the CAN hardware. No - it can’t deal with mixed 11 bit and 29 bit headers.
I have to admit we never even tried that, but at the same time I'm not sure I would consider it a bug. I don't remember if there was anything in the Bosch specification that suggested such a thing was possible.
 

Ian0

Joined Aug 7, 2020
13,188
I have to admit we never even tried that, but at the same time I'm not sure I would consider it a bug. I don't remember if there was anything in the Bosch specification that suggested such a thing was possible.
I wouldn’t have done it either, as it sounds like a daft thing to do. If you need 29-bit headers, then you need 29-bit headers all round.
BUt Renesas says its processor can deal with mixed, and it can’t.
 

Papabravo

Joined Feb 24, 2006
22,095
I wouldn’t have done it either, as it sounds like a daft thing to do. If you need 29-bit headers, then you need 29-bit headers all round.
BUt Renesas says its processor can deal with mixed, and it can’t.
Did you consult the Bosh CAN specification on the matter? I used to have a paper copy, but it went walkabout pre-retirement.
 

Thread Starter

Embededd

Joined Jun 4, 2025
182
The ERROR frame itself creates a bit stuffing error for every node with an active receiver, because it is six consecutive dominant bits. Every node that receives an ERROR frame will also generate an error frame.
One thing I'm still confused about is the Active Error Flag.

An Active Error Flag consists of six consecutive dominant bits, which would normally violate the bit stuffing rule.

Does the bit stuffing rule apply only to normal CAN frames, It is not applied to the Active Error. Or is there another mechanism that allows every node to recognize those six dominant bits as an Active Error
 

Papabravo

Joined Feb 24, 2006
22,095
One thing I'm still confused about is the Active Error Flag.

An Active Error Flag consists of six consecutive dominant bits, which would normally violate the bit stuffing rule.

Does the bit stuffing rule apply only to normal CAN frames, It is not applied to the Active Error. Or is there another mechanism that allows every node to recognize those six dominant bits as an Active Error
The first Active Error Frame violates the bit stuffing rule and causes a cascade of ERROR Frames, both active and Passive until each node on the network has had a say. The ERROR frame cascade subsides and the transmitter that threw the first ERROR frame will retry the busted transmission.
 
Top