Error frames can be received by configured the parameter PCAN_ALLOW_ERROR_FRAMES on the connected PCAN Channel. This is carried out using the SetValue(UInt16, TPCANParameter, UInt32, UInt32) method.
The error frame data will be placed into a TPCANMsg or TPCANMsgFD structure, according to the kind of initialization used. The field MSGTYPE of these structures will have the flag PCAN_MESSAGE_ERRFRAME set.
The following list shows the elements of an error frame:
Field | Information from... | Contents |
|---|---|---|
ID | ECC register SJA1000 (Error Code Capture), bits 6 and 7 (ERRC0, ERRC1) | 0: The message only transports updated error counter values 1: Bit error 2: Form error 4: Stuff error 8: Other type of error |
DATA[0] | ECC register, bit 5 (DIR) | 0: Error has occurred during transmission 1: Error has occurred during reception |
DATA[1] | ECC register, bits 0 to 4 (SEG0 to SEG4) | Current position of the bit stream processor: 2: ID.28 to ID.21 3: Start of frame 4: Bit SRTR 5: Bit IDE 6: ID.20 to ID.18 7: ID.17 to ID.13 8: CRC Sequence 9: Reserved Bit 0 10: Data Field 11: Data Length Code 12: Bit RTR 13: Reserved Bit 1 14: ID.4 to ID.0 15: ID.12 to ID.5 17: Active Error Flag 18: Intermission 19: Tolerate Dominant Bits 23: Error Delimiter 24: CRC Delimiter 25: Acknowledge Slot 26: End of Frame 27: Acknowledge Limiter 28: Overload Flag |
DATA[2] | RX Error Counter Register (RXERR) | Current value of the receive error counter |
DATA[3] | TX Error Counter Register (TXERR) | Current value of the transmit error counter |
For further information about this, see Philips Data Sheet SJA1000 Stand-alone CAN controller.