Kvaser Linux CANLIB
|
Many of our CAN interface boards use the SJA1000 CAN controller. When an error occurs on the bus, the device firmware and driver will pass the error code from the CAN controller to the application by using the CAN identifier field. The identifier will be set to 0x800 (2048) plus the error code from the controller. The flag field will contain the canMSG_ERROR_FRAME flag. The data length will be 0.
You can use the following tables to interpret the error code from the controller. Note that they are applicable only to those CAN interfaces that use SJA1000.
Bit 7 | Bit 6 | Meaning |
---|---|---|
0 | 0 | bit error |
0 | 1 | form error |
1 | 0 | stuff error |
1 | 1 | other type of error |
Bit 5 | Meaning |
---|---|
0 | TX; error occurred during transmission |
1 | RX; error occurred during reception |
Bit 4..0 | Meaning |
---|---|
0x03 | start of frame |
0x02 | ID.28 to ID.21 |
0x06 | ID.20 to ID.18 |
0x04 | bit SRTR |
0x05 | bit IDE |
0x07 | ID.17 to ID.13 |
0x0F | ID.12 to ID.5 |
0x0E | ID.4 to ID.0 |
0x0C | bit RTR |
0x0D | reserved bit 1 |
0x09 | reserved bit 0 |
0x0B | data length code |
0x0A | data field |
0x08 | CRC sequence |
0x18 | CRC delimiter |
0x19 | acknowledge slot |
0x1B | acknowledge delimiter |
0x1A | end of frame |
0x12 | intermission |
0x11 | active error flag |
0x16 | passive error flag |
0x13 | tolerate dominant bits |
0x17 | error delimiter |
0x1C | overload flag |
Example
A message is transmitted on the CAN bus. A stream of error frames are returned. canRead() reads messages with id 0x000008D9, dlc = 0 and flags = 0x20 (canMSG_ERROR_FRAME). What's up?
Using the tables above, we see that 0xD9 means
so it is likely that the module transmitting the message doesn't get any answer.