Errors

Normative

The error and return codes a conformant SPI driver reports. Development errors are only raised when development error reporting is enabled (see enable_development_error_reporting in Configuration Reference). Governed by CHI-SPI-MUST-20 and CHI-SPI-MUST-22 (and CHI-SPI-MUST-18 for runtime errors) in Spi — 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

Spi_Init

Driver not in SPI_DRV_STATE_UNINIT

SPI_DEVERR_INVALID_CH_STATE

Spi_Init

configPtr is not NULL_PTR

SPI_DEVERR_PARAM_POINTER

Spi_StartTransaction

Driver not initialized

SPI_DEVERR_UNINIT

Spi_StartTransaction

channelId out of range

SPI_DEVERR_PARAM_CHANNELID

Spi_StartTransaction

csId out of range

SPI_DEVERR_PARAM_CS

Spi_StartTransaction

TX/RX total transfer length inconsistent

SPI_DEVERR_PARAM_LENGTH

Spi_StartTransaction

Channel not in SPI_CH_STATE_IDLE

SPI_DEVERR_INVALID_CH_STATE

Spi_GetChannelState

channelId out of range

SPI_DEVERR_PARAM_CHANNELID

Spi_OnCs

Channel in SPI_CH_STATE_UNINIT

SPI_DEVERR_UNINIT

Spi_OnCs

channelId / csId out of range

SPI_DEVERR_PARAM_CHANNELID / SPI_DEVERR_PARAM_CS

Spi_CancelTransaction

Channel in SPI_CH_STATE_UNINIT

SPI_DEVERR_UNINIT

Spi_CancelTransaction

channelId out of range

SPI_DEVERR_PARAM_CHANNELID

Development error code group

Development error type

Defines

SPI_DEVERR_UNINIT (1U)

API service called without initialization.

SPI_DEVERR_INVALID_CH_STATE (2U)

API service called with invalid state.

SPI_DEVERR_PARAM_CHANNELID (3U)

API service is called with invalid HW channel.

SPI_DEVERR_PARAM_CS (4U)

API service is called with invalid chip select ID.

SPI_DEVERR_PARAM_LENGTH (5U)

API service is called with invalid data length.

SPI_DEVERR_PARAM_POINTER (6U)

API service called with invalid pointer parameter.

Available via: Spi_DriverTypes.h. Vendor-specific error definitions MUST be provided via Spi.h instead.

Runtime errors

Runtime errors are reported via LogM_Report with runtime-error level. When the failure is not tied to a specific chip select, the reported csId is SPI_CS_UNSPECIFIED.

Runtime error code group

Specifies error types which are logged via LogM_Report with logLevel runtime error.

Defines

SPI_RTERR (16U)

Specifies an error has been detected. If user doesn’t need detailed error information.

If user wants to know error detail, then check below vendor specific errors

A vendor MAY expand SPI_RTERR into more detailed SPI_RTERR_<VENDOR_SPECIFIC> codes in the range [0x10, 0xFF]; those MUST be provided via Spi.h, not Spi_DriverTypes.h. Available via: Spi_DriverTypes.h.

Chip-select definition
SPI_CS_UNSPECIFIED

SpiDrv CS definition

Defines

SPI_CS_UNSPECIFIED (255U)

Specifies the detected error does not relate to a CS but SPI controller HW or bus common failure. Also, this symbol is used as the default parameter of csId for Spi_StartTransaction in case of Target Mode.

Used as the csId a target passes to Spi_StartTransaction and as the csId for a controller-level error not tied to a chip select. Available via: Spi_DriverTypes.h.