# J1939 Error description

## Error level

Error         | Code | Description
--------------|------|------------------------------
WARNING       | 0    | An error warning has occurred
ERROR         | 1    | An error has occurred
FATAL         | 2    | A fatal error has occurred
OK            | 3    | No error has occurred yet

## Error identifier

Error       | Code | Description
------------|------|-------------------------------
ERR_ERR_ID  | 0    | Error unit identifier
DLL_ERR_ID  | 1    | Data link layer identifier
MEM_ERR_ID  | 2    | Memory unit identifier
TPL_ERR_ID  | 3    | Transport protocol identifier
NWM_ERR_ID  | 4    | Network management identifier
APL_ERR_ID  | 5    | Application layer identifier
CYC_ERR_ID  | 6    | Cycle unit identifier
REQ_ERR_ID  | 7    | Request unit identifier
L2C_ERR_ID  | 8    | Layer 2 unit identifier
ADR_ERR_ID  | 9    | Addressing unit identifier
NMEA_ERR_ID | 10   | NMEA 2000 module
CDP_ERR_ID  | 11   | CAN Diagnostic Protocol
DIAG_ERR_ID | 12   | J1939 Diagnostic Module
USR_ERR_ID  | 13   | User specific code (generated)
OK_ID       | 14   | No error

## Error codes

### Data Link layer

Error             | Code | Description
------------------|------|-----------------------------------------
DLL_ERR_TX_OVRN   | 51   | Overrun in the TxQueue
DLL_ERR_START_CAN | 52   | Starting CAN failed
DLL_ERR_RESET_CAN | 53   | Reset CAN failed
DLL_ERR_INIT_CAN  | 54   | Init CAN  failed
DLL_ERR_BOFF      | 61   | Bus error interrupt occurs on CAN
DLL_ERR_EPAS      | 62   | Error warning interrupt occurs on CAN
DLL_ERR_EACT      | 63   | CAN controller is in status error active
DLL_ERR_DOI       | 64   | Data overrun interrupt occurs on CAN
DLL_ERR_RX_OVRN   | 65   | Overrun in the RxQueue

### Memory

Error                | Code | Description
---------------------|------|-----------------------
MEM_ERR_ALLOC_MEMORY | 111  | Allocate memory failed
MEM_ERR_FREE_MEMORY  | 112  | Free memory failed

### Transport layer

Error                 | Code | Description
----------------------|------|----------------------------------------------------------------
TPL_ERR_TX_OVRN       | 151  | No free Entry in the TxQueue of the TPL available
TPL_ERR_CONF_FILTER   | 152  | Too many PGNs tried to register in the config filter
TPL_ERR_UNEXP_BAM_FRM | 161  | Unexpected BAM frame received
TPL_ERR_UNEXP_RTS_FRM | 162  | Unexpected RTS frame received
TPL_ERR_UNEXP_CTS_FRM | 163  | Unexpected CTS frame received
TPL_ERR_UNEXP_EOM_FRM | 164  | Unexpected EOM frame received
TPL_ERR_UNEXP_CA_FRM  | 165  | Unexpected CA frame received
TPL_ERR_UNEXP_DT_FRM  | 166  | Unexpected DT frame received
TPL_ERR_RX_OVRN       | 167  | No free Rx Msg Buffer in the TPL for a global message available
TPL_ERR_TX_TIMEOUT0   | 168  | Timer overrun for Tx Timeout T0
TPL_ERR_TX_TIMEOUT2   | 169  | Timer overrun for Tx Timeout T2
TPL_ERR_RX_TIMEOUT0   | 170  | Timer overrun for Rx Timeout T0
TPL_ERR_RX_TIMEOUT1   | 171  | Timer overrun for Rx Timeout T1
TPL_ERR_RX_TIMEOUT2   | 172  | Timer overrun for Rx Timeout T2
TPL_ERR_RX_LONG       | 173  | The length of the received message is too long for a seg msg
TPL_ERR_SEND_MSG      | 174  | Error by Sending: Can't send a segmented message
TPL_ERR_SEND_CA       | 175  | Sending a CA message failed
TPL_ERR_SEND_NACK     | 176  | Sending a NACK message failed

### Network management

Error                | Code | Description
---------------------|------|-------------------------------------------------------------------------------------------------------------------------
NWM_ERR_DEVICE_REG   | 201  | The device is already registered in the device list
NWM_ERR_INVALID_HDL  | 202  | The device handle is invalid
NWM_ERR_INVALID_ADDR | 203  | The device address is invalid
NWM_ERR_NO_COMM      | 211  | The device is not able to start the CAN communication (starting CAN failed)
NWM_ERR_NO_ADDR      | 212  | The device is not able to claim an address and is therefore not allowed to take part at network communication any longer
NWM_ERR_LIST_FULL    | 213  | The maximum number of nodes in the network is exceeded

### Application layer

Error                 | Code | Description
----------------------|------|---------------------------------------------------------------------------------------
APL_ERR_TIME_EXCEEDED | 251  | APL_Main() was not called in the required sequence
APL_ERR_TX_LONG       | 252  | The data field of the transmit message is too long
APL_ERR_NO_MEMORY     | 253  | No memory for the data field of the transmit message allocated
APL_ERR_REG_REQUEST   | 254  | An error occurred during registration of a request PGN
APL_ERR_TX_NO_ADDR    | 255  | Device has no address claimed
APL_ERR_INVALID_PARAM | 257  | Invalid parameter passed to an API function
APL_ERR_REQ_RESPONSE  | 261  | A request message couldn't be answered from the request handler due to a queue overrun

### Cyclic unit

Error                     | Code | Description
--------------------------|------|----------------------------------------------------------------------
CYC_ERR_NOT_INITIALIZED   | 301  | The unit is not yet initialized
CYC_ERR_RX_REGISTRATION   | 302  | The maximal number of receive messages is exceeded
CYC_ERR_TX_REGISTRATION   | 303  | The maximal number of transmit messages is exceeded
CYC_ERR_TIME_EXCEEDED     | 304  | CYC_Main() was not called in the required sequence
CYC_ERR_RX_TIMEOUT        | 311  | A registered message wasn't received in the given time
CYC_ERR_TX_INVALID_HDL    | 312  | A message couldn't be sent due to an invalid address handle
CYC_ERR_TX_QUEUE_OVRN     | 313  | A message couldn't be sent due to an overrun of the transmit queue
CYC_ERR_RX_INVALID_LENGTH | 314  | The length of the received message is too long for the receive buffer

### Request unit

Error                | Code                   | Description
---------------------|------------------------|-------------------
REQ_ERR_INVALID_PARAM | 351 | Invalid parameter passed to an API function

### CAN diagnostic

Error                  | Code | Description
-----------------------|------|---------------------------------------------------------------------------------------------------------
CDP_ERR_TIME_EXCEEDED  | 551  | CDP_Main() was not called in the required sequence
CDP_ERR_ADDR_FORMAT    | 552  | The addressing format of the CAN diagnostic protocol is invalid
CDP_ERR_CONF_PGN       | 553  | There is no PGN entry free to register a CDP message
CDP_ERR_UNKNOWN_PGN    | 554  | PGN is not registered
CDP_ERR_STATE_READY_TX | 555  | PGN is not ready for transmitting a CAN diagnostic message
CDP_ERR_STATE_READY_RX | 556  | PGN is not ready for receiving a CAN diagnostic message
CDP_ERR_NO_MEMORY      | 557  | No memory for the data field allocated
CDP_ERR_ALLOC_MEMORY   | 561  | Allocate memory failed
CDP_ERR_FREE_MEMORY    | 562  | Free memory failed
CDP_ERR_RX_LENGTH      | 563  | The length of the received CAN diagnostic protocol message is too large for the available receive buffer
CDP_ERR_RX_TIMEOUT_FC  | 564  | The CAN diagnostic protocol flow control message wasn't received in the given time
CDP_ERR_RX_TIMEOUT_CF  | 565  | The CAN diagnostic protocol consecutive frame message wasn't received in the given time
CDP_ERR_TX_TIMEOUT     | 566  | The CAN diagnostic protocol message wasn't sent in the given time
CDP_ERR_PCI_INVALID    | 567  | The CAN diagnostic protocol control information was invalid

### J1939 diagnostic

Error                     | Code | Description
--------------------------|------|----------------------------------------------------------------------------------------------------------------------------
DIAG_ERR_MEM_ABORTED_TX   | 611  | A memory access session was aborted due to a transmit problem (sending a memory access message failed)
DIAG_ERR_MEM_ABORTED_RX   | 612  | A memory access session was aborted due to a receive problem (a memory access message wasn't received in the expected time)
DIAG_ERR_MEM_ABORTED_KEY  | 613  | A memory access session was aborted due to security reasons (an invalid key was received)
DIAG_ERR_MEM_ABORTED_DATA | 614  | A memory access session was aborted due to addressing problems (invalid data length was received)
DIAG_ERR_MEM_BUSY         | 615  | A memory access session was declined because the device is busy (another session is in process)
DIAG_ERR_MEM_BUSY_FAILED  | 616  | Transmit a memory access response 'busy' failed
DIAG_ERR_MEM_INVALID_MSG  | 617  | Invalid message received (the received PGN was not registered for the diagnostic unit)

### User specific error

Error                | Code | Description
---------------------|------|---------------------------------------------------------------------------------------
USR_ERR_REQ_RESPONSE | 661  | A request message couldn't be answered from the request handler due to a queue overrun
