Errors

Normative

The error and return codes a conformant CAN driver reports. Development errors are only raised when development error reporting is enabled (see enable_development_error_reporting in Configuration Reference). Governed by CHI-CAN-MUST-21 and CHI-CAN-MUST-22 in Can — Requirements.

Development errors

When development error reporting is enabled, each API detects the conditions below and raises the listed error.

Development errors by API

API

Condition

Error id

Can_Init

Driver not in CAN_DRV_STATE_UNINIT, or a channel not in CAN_CH_STATE_UNINIT

CAN_DEVERR_STATE_TRANSITION

Can_Init

configPtr is a null pointer

CAN_DEVERR_PARAM_POINTER

Can_DeInit

Driver not in CAN_DRV_STATE_INIT, or a channel is in CAN_CH_STATE_STARTED

CAN_DEVERR_STATE_TRANSITION

Can_Transmit

Driver not initialized

CAN_DEVERR_UNINIT

Can_Transmit

Invalid mailbox id

CAN_DEVERR_PARAM_MAILBOXID

Can_Transmit

pduInfoPtr or pduInfoPtr->sduDataPtr is a null pointer

CAN_DEVERR_PARAM_POINTER

Can_Transmit

Length > 64 bytes; or > 8 bytes on a non-FD channel; or > 8 bytes without the FD flag set

CAN_DEVERR_PARAM_DATA_LENGTH

Can_GetChannelState / Can_SetChannelState / Can_SetBaudrate

Driver not initialized

CAN_DEVERR_UNINIT

Can_GetChannelState / Can_SetChannelState / Can_SetBaudrate

channelId out of range

CAN_DEVERR_PARAM_CHANNELID

Can_SetChannelState

Invalid state transition requested

CAN_DEVERR_STATE_TRANSITION

Can_SetBaudrate

baudRateConfigId out of configured range

CAN_DEVERR_PARAM_BAUDRATEID

Can_SetBaudrate

Channel not in CAN_CH_STATE_STOPPED

CAN_DEVERR_INVALID_STATE

Development error code group

Development error type

Defines

CAN_DEVERR_PARAM_POINTER (1U)

API Service called with wrong pointer.

CAN_DEVERR_PARAM_MAILBOXID (2U)

API Service called with wrong parameter

CAN_DEVERR_PARAM_DATA_LENGTH (3U)

API Service called with wrong length parameter

CAN_DEVERR_PARAM_CHANNELID (4U)

API Service called with wrong channel ID parameter

CAN_DEVERR_UNINIT (5U)

API Service used without initialization

CAN_DEVERR_STATE_TRANSITION (6U)

Invalid transition for the current state

CAN_DEVERR_PARAM_BAUDRATEID (7U)

Parameter baudrate ID has an invalid value

CAN_DEVERR_INVALID_STATE (8U)

API Service called in invalid channel state.

Available via: CanIf_DriverTypes.h. Vendor-specific error definitions MUST be provided via Can.h instead.

Runtime errors

Runtime errors are reported via LogM_Report with runtime-error log level.

Runtime errors

Error id

Reported when

CAN_RTERR_DATALOST

A received frame is lost (overwrite or FIFO overrun), where the hardware can detect it (optional, CHI-CAN-MAY-02).

CAN_RTERR_UNRECOVERABLE

An unrecoverable channel HW error is detected (CHI-CAN-MUST-22).

Runtime error code group

Runtime error type

Defines

CAN_RTERR_DATALOST (1U)

Received CAN message is lost

CAN_RTERR_UNRECOVERABLE (128U)

Error type that can not be recovered by the CanDrv itself. (e.g. CAN channel internal RAM ECC error)

Available via: CanIf_DriverTypes.h. Vendor-specific error definitions follow: recoverable [0x02, 0x7F], unrecoverable [0x81, 0xFF].

Return-type extension
Extension to Std_ReturnType

Overlaid return value of Std_ReturnType for CAN driver API Can_Transmit()

Defines

CAN_BUSY (2U)

Transmit request could not be processed because no transmit object was available

The CAN_BUSY return value of Can_Transmit comes from this extension. Available via: CanIf_DriverTypes.h.