Errors

Normative

The error and return codes a conformant UART driver reports. Development errors are only raised when development error reporting is enabled (see enable_development_error_reporting in Configuration Reference). Governed by CHI-UART-MUST-20 and CHI-UART-MUST-22 (and CHI-UART-MUST-17 / CHI-UART-SHOULD-02 for runtime errors) in Uart — Requirements.

Development errors

When development error reporting is enabled, each API detects the conditions below and raises the listed error via LogM_Report with development-error level.

Development errors by API

API

Condition

Error id

Uart_Init

Driver not in UART_DRV_STATE_UNINIT

UART_DEVERR_INVALID_CH_STATE

Uart_Init

configPtr is not NULL_PTR

UART_DEVERR_PARAM_POINTER

All channel APIs

channelId out of range

UART_DEVERR_PARAM_CHANNELID

Uart_StartTxTransaction / Uart_StartRxTransaction / Uart_CancelRxTransaction / Uart_SetAdditionalRxLenTrg

Channel not initialized

UART_DEVERR_UNINIT

Uart_StartTxTransaction

txDataPtr is NULL / txDataLength is 0

UART_DEVERR_PARAM_POINTER / UART_DEVERR_PARAM_DATA_LENGTH

Uart_StartTxTransaction

Channel not UART_CH_TX_STATE_IDLE nor UART_CH_TX_STATE_READY

UART_DEVERR_INVALID_CH_STATE

Uart_StartRxTransaction

rxDataPtr is NULL

UART_DEVERR_PARAM_POINTER

Uart_StartRxTransaction

rxDataLength is 0, or additionalRxLenTrg > rxDataLength

UART_DEVERR_PARAM_DATA_LENGTH

Uart_StartRxTransaction

Channel not UART_CH_RX_STATE_IDLE

UART_DEVERR_INVALID_CH_STATE

Development error code group

Development error type

Defines

UART_DEVERR_UNINIT (1U)

API service used without module initialization

UART_DEVERR_PARAM_CHANNELID (2U)

API service called with invalid channelId

UART_DEVERR_PARAM_POINTER (3U)

API service called with invalid pointer parameter.

UART_DEVERR_PARAM_DATA_LENGTH (4U)

API service called with invalid data length parameter

UART_DEVERR_INVALID_CH_STATE (5U)

API service called in invalid state

Available via: Uart_DriverTypes.h. Vendor-specific error definitions MUST be provided via Uart.h instead.

Runtime errors

Runtime errors are reported via LogM_Report with runtime-error level. A caller that does not need the detail can test the UART_RTERR_TX / UART_RTERR_RX group bits.

Runtime error code group

Specifies error types which are logged via LogM_Report with log level runtime error.

Defines

UART_RTERR_TX (16U)

Specifies a TX error has been detected. The callback notifies one of the <VENDOR_SPECIFIC> error type. If user does not need error detail, then use this value as ((event & UART_RTERR_TX) != 0)

UART_RTERR_RX (32U)

Specifies a RX error has been detected. The callback notifies one of the <VENDOR_SPECIFIC> error type. If user does not need error detail, then use this value as ((event & UART_RTERR_RX) != 0)

UART_RTERR_RX_OVERFLOW (33U)

The HW buffer becomes overflow.

A vendor MAY expand these into detailed codes: UART_RTERR_TX_<VENDOR_SPECIFIC> in [0x10, 0x1F] and UART_RTERR_RX_<VENDOR_SPECIFIC> in [0x22, 0x2F]; those MUST be provided via Uart.h, not Uart_DriverTypes.h. A HW buffer overflow is reported as UART_RTERR_RX_OVERFLOW. Available via: Uart_DriverTypes.h.

Note

TX-error reporting is a SHOULD (CHI-UART-SHOULD-02) — only where the hardware detects and reports a TX error. RX-error reporting (including overflow) is mandatory (CHI-UART-MUST-17).