Main Content

Configure MCAL SPI in DaVinci Configurator

R2026b

This topic explains how to configure the AUTOSAR MCAL SPI module in Vector DaVinci Configurator. The SPI configuration follows a hierarchical structure consisting of Channels, Jobs, Sequences, and External Devices. Configure these containers in the order described in this topic.

SPI Configuration Workflow

Configure the SPI module using the following sequence:

  1. Configure global SPI settings in SpiGeneral.

  2. Create one or more SpiChannel containers.

  3. Configure an SpiExternalDevice for each SPI slave device.

  4. Create SpiJob containers and assign channels to each Job.

  5. Create SpiSequence containers and assign Jobs.

  6. Generate the MCAL configuration code.

The relationship between the configuration containers is shown below:

SPI configuration hierarchy in DaVinci Configurator showing the relationship between SpiGeneral, SpiChannel, SpiExternalDevice, SpiJob, and SpiSequence

Configure Global SPI Settings

Open the SpiGeneral container and specify module-wide settings such as:

  • Driver functionality level

  • Development Error Tracer (DET) configuration

  • Diagnostic Event Manager (DEM) configuration

The SpiGeneral container is configured once for the entire SPI module.

Configure SPI Channels

Create a SpiChannel container for each data stream that must be transferred. For each channel:

  1. Specify the channel type:

    • IB (Internal Buffer) — For driver-managed buffers.

  2. Set the data width.

  3. Specify the default transmit value.

  4. Configure the buffer size:

    • SpiIbNBuffers for IB channels.

Use IB channels when buffer sizes are fixed and managed by the driver.

Configure External Devices

Create a SpiExternalDevice container for each SPI slave device connected to the SPI bus. Configure:

  • Clock polarity (CPOL)

  • Clock phase (CPHA)

  • Baud rate

  • Chip-select behavior

  • Device timing requirements

Configure separate External Devices when connected peripherals require different SPI timing settings.

Configure SPI Jobs

Create a SpiJob container for each SPI transaction. For each Job:

  1. Add one or more SPI channels.

  2. Arrange channels in the required transmission order.

  3. Select the associated SpiExternalDevice.

  4. Configure the Job priority.

A Job keeps chip-select asserted for the complete transaction and guarantees that all included channels execute as a single SPI operation.

Configure Chip Select Handling

Set SpiCsSelection to one of the following values:

OptionDescription
CS_VIA_PERIPHERAL_ENGINEHardware automatically controls the chip-select signal.
CS_VIA_GPIOThe SPI driver controls a GPIO pin as chip-select.

Use CS_VIA_PERIPHERAL_ENGINE when the SPI hardware supports the required chip-select line. Use CS_VIA_GPIO when a dedicated GPIO must be used for chip-select control.

Configure SPI Sequences

Create a SpiSequence container to define the transactions triggered by the application. For each Sequence:

  1. Add one or more Jobs.

  2. Arrange Jobs in the required execution order.

Applications start a Sequence by calling Spi_SyncTransmit(). Jobs within the Sequence execute in the configured order.

Verify the Configuration

Before generating code, verify that:

  • Every Job references at least one Channel.

  • Every Job references a valid External Device.

  • All Sequences contain at least one Job.

  • Buffer sizes and data widths meet application requirements.

  • Chip-select settings match the target hardware.

Generate MCAL Configuration

After completing the SPI configuration:

  1. Validate the project in DaVinci Configurator.

  2. Resolve any reported configuration errors.

  3. Export the CDF file with the SPI module.

See Also