Other Parts Discussed in Thread: CONTROLSUITE
I've been playing with the can_loopback example for the M3 core from controlSuite v202.
I've loaded it on our custom board which has the CAN modules connected to ISO1050DUB transceivers.
I commented out the lines that set up loopback and I have instead connected them together, forming a simple bus at 500 kbps with only the two CAN modules as nodes.
So I have one node sending messages and another receiver them. That works fine.
However, if I unplug the receiving end, I don't see the transmitter's error counter incrementing.
I had an oscilloscope monitoring the CAN_H - CAN_L voltage on the bus.
I've attached the annotated screenshot below (recessive bits as high level, dominant as low level). Note that it's at 500 kbps, resulting in 2 µs bits, which corresponds to the smallest time ticks on the oscilloscope screenshot.
One can see the Start of Frame (SoF) followed by four of the initial ID bits (all 0, as the ID was 0x10), which then demanded a stuffing bit 1. It takes too long for the change of levels, causing the monitored bit to be different from the transmitted one and causing the transmitter to send an Error Frame (active error flag, 6 dominant bits).
This scenario in itself is no problem, as the bus had no terminating resistors, so this kind of problem would be expected, as far as I can tell.
I could also then understand the reason why the transmitter error counter wasn't incremented, from CAN 2.0B specs: a stuff error was detected, which triggered an error flag to be sent. However, that happened during arbitration and for a bit which should've been recessive, but was monitored as dominant.
However, the example had an interrupt set up to read the status register through a CANStatusGet() call. The value returned was 4, meaning a "Bit1 Error":
During the transmission of a message (with the excep-tion of the arbitration field), the device wanted to send a recessive level (bit of logical value '1'), but the monitored bus value was dominant. (SPRUH22I)
The highlighted exception above is in agreement with CAN 2.0B specs (monitoring a dominant bit during transmission of a recessive bit is not a bit error if it happens in arbitration) and means LEC should've read as 1 ("Stuff Error") instead, if I understand correctly. Do I?