4.22. SPI Module

4.22.1. Acronyms and Definitions

Abbreviation/Term

Explanation

AUTOSAR

Automotive Open System Architecture

BSW

Basic Software

MCAL

Micro Controller Abstraction Layer

API

Application Programming Interface

DET

Default Error Tracer

SPI

Serial Peripheral Interface

MCU

Micro Controller Unit

OS

Operating System

SW

Software

HW

Hardware

4.22.2. Introduction

This document describes MCAL SPI Driver functionality, its application interfaces and configuration details as per AUTOSAR version 4.3.1.

Supported AUTOSAR Release

4.3.1

Supported Configuration Variants

Post-build, Pre-Compile, Link-Time

Vendor ID

SPI_VENDOR_ID (44)

Module ID

SPI_MODULE_ID (83)

Supported Platform

AM263Px

4.22.3. Functional Overview

The SPI driver provides services for basic communication with external components. These components can be used by an application.

The main tasks of the SPI are:

  1. Handle data transmission to the components connected via SPI

  2. Take care of the settings required by external components (baud rate etc.)

4.22.3.1. SPI Driver Architecture

The following figure shows where the SPI is located in the AUTOSAR architecture

SPI in AUTOSAR architecture

Fig. 4.91 SPI in AUTOSAR architecture

The next figure shows the interfaces to adjacent modules of the SPI. These interfaces are described in further chapters.

SPI Interfaces

Fig. 4.92 SPI Interfaces

4.22.3.2. Initialization

The SPI driver is initialized by calling Spi_Init(), with parameter ConfigPtr referencing a runtime configuration set. Spi_DeInit() will deinitialize the driver.

4.22.3.3. States

There are 3 states in which the SPI driver can be in.

  1. SPI_UNINIT: The SPI Handler/Driver is not initialized or not usable.

  2. SPI_IDLE : The SPI Handler/Driver is not currently transmitting any Job.

  3. SPI_BUSY : The SPI Handler/Driver is performing a SPI Job (transmit).

So the user knows the ongoing action of the driver during a transmission.

4.22.3.4. Baudrate calculation

SPI Baud Rate Calculation is as follows:

Baud rate = fSPI / CLKD

Where fSPI – SPI Functional clock frequency. fSPI can be set from MCU clocksetting configuration, where user can configure clock source(as per TRM) and clock division value for required fSPI (fSPI=clk/clkdiv+1).

Refer the figure below:

MCU Clock setting in Ebtresos

Fig. 4.93 MCU Clock setting in Ebtresos

CLKD – Prescalar clock divider (SpiExtDeviceClockDivider value as per EBtresos Configuration). SpiExtDeviceClockDivider can be set from EBtresos as in below figure:

SpiExtDeviceClockDivider value as per EBtresos Configuration

Fig. 4.94 SpiExtDeviceClockDivider value as per EBtresos Configuration

CLKD value should be set such a way to get the expected baudrate as per calculation below:

For example, if fSPI of MCSPI is 50 MHz:

1.For Baudrate = 50Mbps , CLKD should be given as 0 , calculation will be as following

Baudrate = 50/(0+1) = 50Mbps

2.For Baudrate =25Mbps ,CLKD should be given as 1 , calculation will be as following

Baudrate = 50/(1+1) = 25Mbps

4.22.3.5. Assumptions

  1. For using DMA feature, driver assumes that cache initialization is done in application only and not done by the driver.

4.22.3.6. Limitations

  1. A job queued in a sequence cannot be queued via another sequence. This is a design limitation to reduce driver complexity.

  2. A channel in a job in a sequence cannot be part of another active job or sequence. This is a design limitation to reduce driver complexity.

  3. If a sequence is started, another high priority job belonging to another sequence cannot
    interrupt the job belonging to the same hardware unit. But the job can be scheduled ahead of another pending job of the started sequence if it belongs to another HW queue.

4.22.3.7. Design overview

Will be updated in future release:

4.22.4. Hardware Features

4.22.4.1. SPI IP Supported Features

  • Serial clock with programmable frequency, polarity and phase for each channel

  • Wide selection of SPI word lengths, ranging from 4 to 32 bits

  • Each SPI controller operates at up to 50 MHz

  • SPI0 and SPI4 support 2 chip selects while SPI1, SPI2, and SPI3 support 1 chip select

  • Interruptible Sequences

  • Controller multichannel mode

    • Transmit only/transmit and receive modes

    • Flexible input/output(I/O) port controls per channel

    • Programmable clock granularity

    • Per channel configuration for clock definition, polarity enabling and word width

  • Enable the addition of a programmable start-bit for MCSPI transfer per channel (start-bit mode)

4.22.4.2. AUTOSAR Supported Features

  • Spi initilaizes all features required for transmission and reception.

  • Spi Supports using of internal buffers for transfer and receiving of data

  • Spi supports asynchronous transmission and reception

  • Spi supports synchronous transmission and reception.

  • Spi supports setting of external buffers.

  • Spi Supports getting the status of

    • Hwunit

    • Job Result

    • Sequence result

  • Spi Supports setting mode of the communication

  • Spi Supports cancel of sequence

4.22.4.3. Not supported Features

  • Slave Mode not supported

4.22.5. Source files

Description of static files is provided below:

📦AM263Px
┣ 📂build
┣ 📂mcal
┃ ┣ 📂Spi
┃ ┃ ┣ 📂include
┃ ┃ ┃ ┗ 📜Spi.h : Contains the API’s of the SPI driver to be used by upper layers
┃ ┃ ┣ 📂src
┃ ┃ ┃ ┗ 📜Spi.c : Contains the implementation of the API’s for SPI driver
┃ ┃ ┣ 📂V0
┃ ┃ ┃ ┣ 📜hw_mcspi.h : Contains Internal functions declaration of SPI driver
┃ ┃ ┃ ┣ 📜lldr_mcspi.h : Contains Register definition
┃ ┃ ┃ ┣ 📜Spi_Dbg.h : Contains Internal functions definition of SPI driver
┃ ┃ ┃ ┣ 📜Spi_Dma.c : Contains SPI MCAL driver functions for using EDMA
┃ ┃ ┃ ┣ 📜Spi_Irq.h : Contains ISR function declaration
┃ ┃ ┃ ┣ 📜Spi_Irq.c : Contains ISR function definitions
┃ ┃ ┃ ┣ 📜Spi_Mcspi.c : Contains Internal functions definition of SPI driver
┃ ┃ ┃ ┣ 📜Spi_Priv.c : Contains Internal functions definition of SPI driver
┃ ┃ ┃ ┣ 📜Spi_Priv.h : Contains Internal functions declaration of SPI driver
┃ ┃ ┃ ┣ 📜Spi_Utils.c : Contains Internal functions definition of SPI driver
┃ ┃ ┃ ┗ 📜Spi_Utils.h : Contains Internal functions declaration of SPI driver
┃ ┃ ┗ 📜Makefile
┣ 📂mcal_config
┣ 📂mcal_docs
┗ 📜README.txt

Description of generated files is provided below:

Plugin Files

Description

Spi_Cfg.h

Contains the Precompile switches, Symbolic names of Group, channels and hardware units, Configured maximum number Groups and hardware units

Spi_PBcfg.c

Contains all channels Post-Build Configured parameters

Spi_Lcfg.c

Contains all channels Link time Configured parameters

Spi_Cfg.c

Contains all channels Pre-Compile Configured parameters

The below diagram shows the files structure for the SPI driver.

SPI header file include structure

Fig. 4.95 SPI header file include structure

4.22.6. Module requirements

Will be updated in future release:

4.22.6.1. Memory Mapping

Memory Mapping Sections

SPI_CODE

SPI_VAR

SPI_VAR_NOINIT

SPI_CONST

SPI_APPL_DATA

SPI_APPL_CODE

SPI_START_SEC_VAR_INIT_UNSPECIFIED (.data)

x

SPI_STOP_SEC_VAR_INIT_UNSPECIFIED

x

SPI_START_SEC_CODE (.text)

x

SPI_STOP_SEC_CODE

x

SPI_START_SEC_VAR_NO_INIT_UNSPECIFIED (.bss)

x

SPI_STOP_SEC_VAR_NO_INIT_UNSPECIFIED

x

SPI_START_SEC_CONST_UNSPECIFIED(.rodata)

x

SPI_STOP_SEC_CONST_UNSPECIFIED

x

SPI_START_SEC_ISR_CODE (.text)

x

SPI_STOP_SEC_ISR_CODE

x

For application code used by SPI (like callback functions)

x

4.22.6.2. Scheduling

Schedule Function API

Description

Spi_MainFunction_Handling

This function process SPI transmission

4.22.6.3. Error handling

4.22.6.3.1. Development Error Reporting

The module SPI depends on the DET (by default) in order to report development errors.

The DET can be replaced optionally by an equivalent component which is responsible to recognize development errors, if no DET component is available.

The DET error is reported with Module ID.

4.22.6.4. Error codes

4.22.6.4.1. Development Errors

The errors reported to DET module are described in the following table:

Type of Error

Related Error code

Value (Hex)

Channel out of bounds, exceeds the maximum number of configured channels

SPI_E_PARAM_CHANNEL

0x0A

Job out of bounds, exceeds the maximum number of configured jobs

SPI_E_PARAM_JOB

0x0B

Sequence out of bounds, exceeds the maximum number of configured sequences

SPI_E_PARAM_SEQ

0x0C

Length out of bounds, exceeds the maximum number of configured EB- or IB- buffer length

SPI_E_PARAM_LENGTH

0x0D

The requested hardware unit does not exist

SPI_E_PARAM_UNIT

0x0E

An invalid configuration has been passed (i.e., a NULL_PTR).This is an extension to AUTOSAR.

SPI_E_PARAM_POINTER

0x10

A service was requested, but the driver has not been initialized

SPI_E_UNINIT

0x1A

The requested sequence is still pending

SPI_E_SEQ_PENDING

0x2A

Transmission of synchronous sequence in progress (not supported)

SPI_E_SEQ_IN_PROCESS

0x3A

The driver is already initialized

SPI_E_ALREADY_INITIALIZED

0x4A

AUTOSAR requires to check the validity of function parameters. These checks are for development error reporting and can be en/dis-abled separately. En/dis-abling of single checks is an addition to the AUTOSAR standard which requires to en/dis-able the complete parameter checking via the parameter SPI_DEV_ERROR_DETECT. The following table shows which parameter checks are performed on which services:

Check Services

SPI_E_PARAM_CHANNEL

SPI_E_PARAM_JOB

SPI_E_PARAM_SEQ

SPI_E_PARAM_LENGTH

SPI_E_PARAM_UNIT

SPI_E_PARAM__POINTER

SPI_E_PARAM_UNINIT

SPI_E_SEQ_PENDING

SPI_E_SEQ_PROCESS

SPI_E_ALREADY_INITILAIZE

Spi_Init

x

x

x

x

x

Spi_DeInit

x

Spi_AsyncTransmit

x

x

x

Spi_SetupEB

x

x

x

x

Spi_GetStatus

Spi_GetJobResult

x

x

Spi_GetSequenceResult

x

x

Spi_GetVersionInfo

x

Spi_GetHwUnitStatus

x

x

Spi_Cancel

x

x

4.22.6.4.2. DEM Errors

The errors reported to DEM are described in the following table:

Error Code

Error Macro

Description

Assigned by DEM

SPI_E_HARDWARE_ERROR

This error is raised when McSPI RX FIFO overflows

Assigned by DEM

SPI_E_BIT_ERROR

A bit error was detected

Assigned by DEM

SPI_E_DESYNC_ERROR

Slave desynchronized

Assigned by DEM

SPI_E_DLEN_ERROR

Data length mismatch detected during transmission

Assigned by DEM

SPI_E_TXSTALL_ERROR

This error occurs if the driver tries to write data which has not been transmitted yet

Assigned by DEM

SPI_E_RXSTALL_ERROR

The driver tries to read data, but no data has been provided by the hardware

Assigned by DEM

SPI_E_DOVR_ERROR

The hardware reported an internal receive buffer overrun

Assigned by DEM

SPI_E_TO_ERROR

The hardware reported a Timeout error because of non-activation of ENA pin

4.22.7. Used resources

4.22.7.1. Interrupt Handling

For interrupt notification, ISR’s are provided in SPI driver. There are two ISR for each SPI hardware unit. Depending on hardware unit configured, it will call group notify function. The interrupt service routines shall be mapped to the interrupt sources of the respective cross bar interrupt. The supported ISR’s are part of the Spi_Irq.h file.

Following are SPI module ISRs for each hardware unit:

1.SPI HW UNIT 0

  • Spi_IrqUnitMcspi0TxRx()

  • ISR(Spi_IrqUnitMcspi0TxRx)

2.SPI HW UNIT 1

  • Spi_IrqUnitMcspi1TxRx()

  • ISR(Spi_IrqUnitMcspi1TxRx)

3.SPI HW UNIT 2

  • Spi_IrqUnitMcspi2TxRx()

  • ISR(Spi_IrqUnitMcspi2TxRx)

4.SPI HW UNIT 3

  • Spi_IrqUnitMcspi3TxRx()

  • ISR(Spi_IrqUnitMcspi3TxRx)

5.SPI HW UNIT 4

  • Spi_IrqUnitMcspi4TxRx()

  • ISR(Spi_IrqUnitMcspi4TxRx)

6.SPI HW UNIT 5

  • Spi_IrqUnitMcspi5TxRx()

  • ISR(Spi_IrqUnitMcspi5TxRx)

7.SPI HW UNIT 6

  • Spi_IrqUnitMcspi6TxRx()

  • ISR(Spi_IrqUnitMcspi6TxRx)

8.SPI HW UNIT 7

  • Spi_IrqUnitMcspi7TxRx()

  • ISR(Spi_IrqUnitMcspi7TxRx)

For using SPI wth DMA mode, register CDD_EDMA_lld_transferCompletionMasterIsrFxn with appropriate INTAGG line.

4.22.8. Integration description

4.22.8.1. Dependent modules

4.22.8.1.1. MCU

The module MCU powers up the microcontroller’s peripherals at startup time and initializes the PLL and the internal clock domains which go to the SPI unit. The SPI module also supports an internal divider which can be changed at configuration time using the ‘clkDivider’ member of Spi_McSPIExternalDeviceConfigType structure to configure the actual SPI functional clock.

4.22.8.1.2. PORT

The module PORT enables the SPI lines at startup time. To operate the SPI properly, the PORT driver must be configured. The PORT driver sets the PINs to the required mux values for the SPI to operate.

4.22.8.1.3. OSEK / AUTOSAR OS (Optional)

An operating system can be used for task scheduling, interrupt handling, global suspend and restore of interrupts and creating of the Interrupt Vector Table. The SPI module may use OSEK/AUTOSAR OS to suspend and restore global interrupts.

4.22.8.1.4. DET

This implementation depends on the DET in order to report development errors. The detection of development errors is configurable (ON / OFF).

4.22.8.1.5. DEM

By default, production code related errors are reported to the DEM using the service DEM_ReportErrorStatus ().

Note

Dem Event is enable only if $(Module_Name)DemEventParameterRefs is enabled.

4.22.8.1.6. SchM

If multiple AUTOSAR runnables have access to the same Data Store Memory block, the exported AUTOSAR specification enforces data consistency by using an AUTOSAR exclusive area. With this specification, the runnables have mutually exclusive access to the per-instance memory global data, which prevents data corruption. Beside the OS, the BSW Scheduler provides functions that SPI module calls at begin and end of critical sections. This implementation requires 1 level of exclusive access to guard critical sections.

The data consistency mechanism that has to be applied to an ExclusiveArea might be domain, ECU or even project specific. The decision which mechanism has to be applied by RTE / Basic Software Scheduler is taken during ECU integration by setting the Exclusive Area configuration parameter RteExclusiveAreaImplMechanism. This parameter is an input for RTE generator.

For SPI Module, data consistency and exclusive access to critical sections are required for the following sections as shown in the table below:

Exclusive Area Functions used

SPI Function calling Exclusive Area

Need for Exclusive Area

Recommended Exclusive Area Mapping

SPI_EXCLUSIVE_AREA_0

Spi_GetHWUnitStatus
Spi_WriteIB
Spi_ReadIB
Spi_SetupEB
Spi_SyncTransmit
Spi_asyncTransmit_Start
Spi_Cancel

To protect against multiple access for shared resources

ALL_INTERRUPT_BLOCKING : All interrupts should be blocked as this API’s can be called in the interrupts

4.22.8.1.7. Callback Functions

The SPI driver does not provide any call back functions.

4.22.8.1.8. Callback Notification

At its configurable interfaces, the SPI defines notifications that can be mapped to callback functions provided by other modules. The mapping is not statically defined by the SPI but can be performed at configuration time. The function prototypes that can be used for the configuration have to match the appropriate function prototype signatures, which are described in the following.

Example:Spi_JobEndNotification

4.22.8.2. Multi-core support

Not Supported

4.22.9. Configuration

4.22.9.1. SpiDemEventParameterRefs

Item

Name

SpiDemEventParameterRefs

Description

Reference to configured DEM event to report “Hardware failure”. If the reference is not configured the error shall not be reported.

Post-build-variant-multiplicity

false

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.2. SpiDriver

This container contains the configuration parameters and sub containers of the AUTOSAR Spi module.

4.22.9.2.1. SpiMaxChannel

Item

Name

SpiMaxChannel

Description

This parameter contains the number of Channels configured. It will be gathered by tools during the configuration stage.Max range is derived from SpiMaxChannels.Please refer SpiGeneral/SpiMaxChannels.

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1

Max-value

255

Min-value

0

4.22.9.2.2. SpiMaxJob

Item

Name

SpiMaxJob

Description

Total number of Jobs configured.Max range is derived from SpiMaxJobs.Please refer SpiGeneral/SpiMaxJobs.

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1

Max-value

65535

Min-value

0

4.22.9.2.3. SpiMaxSequence

Item

Name

SpiMaxSequence

Description

Total number of Sequences configured.Max range is derived from SpiMaxSequences.Please refer SpiGeneral/SpiMaxSequences.

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1

Max-value

255

Min-value

0

4.22.9.2.4. SpiMaxHwUnit

Item

Name

SpiMaxHwUnit

Description

Maximum number of HW unit.Max range is derived from SpiMaxHwUnit.Please refer SpiPublishedInformation/SpiMaxHwUnit.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

8

Max-value

8

Min-value

0

4.22.9.2.5. SpiMaxExternalDeviceConfig

Item

Name

SpiMaxExternalDeviceConfig

Description

Maximum Number of different SPI hardware microcontroller peripherals available and handled by this SPI Handler/Driver module.Max range is derived from SpiMaxExternalDevices.Please refer SpiGeneral/SpiMaxExternalDevices.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1

Max-value

8

Min-value

0

4.22.9.2.6. SpiChannel

All data needed to configure one SPI-channel

4.22.9.2.6.1. SpiChannelId

Item

Name

SpiChannelId

Description

SPI Channel ID, used as parameter in SPI API functions.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

255

Min-value

0

4.22.9.2.6.2. SpiChannelType

Item

Name

SpiChannelType

Description

Buffer usage with EB/IB channel.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

EB

Range

EB
IB

4.22.9.2.6.3. SpiDataWidth

Item

Name

SpiDataWidth

Description

This parameter is the width of a transmitted data unit.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

8

Max-value

32

Min-value

1

4.22.9.2.6.4. SpiDefaultData

Item

Name

SpiDefaultData

Description

The default data to be transmitted when (for internal buffer or external buffer) the pointer passed to Spi_WriteIB (for internal buffer) or to Spi_SetupEB (for external buffer) is NULL.

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

4294967295

Min-value

0

4.22.9.2.6.5. SpiEbMaxLength

Item

Name

SpiEbMaxLength

Description

This parameter contains the maximum size (number of data elements) of data buffers in case of EB Channels and only.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

255

Max-value

65535

Min-value

0

4.22.9.2.6.6. SpiIbNBuffers

Item

Name

SpiIbNBuffers

Description

This parameter contains the maximum number of data buffers in case of IB Channels and only.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

10

Max-value

65535

Min-value

0

4.22.9.2.6.7. SpiTransferStart

Item

Name

SpiTransferStart

Description

This parameter defines the first starting bit for transmission.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

MSB

Range

LSB
MSB

4.22.9.2.7. SpiExternalDevice

The communication settings of an external device. Closely linked to SpiJob.

4.22.9.2.7.1. SpiExternalDeviceId

Item

Name

SpiExternalDeviceId

Description

The index of the corresponding external device config associated with job.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

65535

Min-value

0

4.22.9.2.7.2. SpiCsIdentifier

Item

Name

SpiCsIdentifier

Description

This parameter is the symbolic name to identify the Chip Select (CS) allocated to this Job.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Link-Time

VARIANT-LINK-TIME

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SCS0

4.22.9.2.7.3. SpiCsPolarity

Item

Name

SpiCsPolarity

Description

This parameter defines the active polarity of Chip Select.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

HIGH

Range

HIGH
LOW

4.22.9.2.7.4. SpiCsSelection

Item

Name

SpiCsSelection

Description

When the Chip select handling is enabled (see SpiEnableCs), then this parameter specifies if the chip select is handled automatically by Peripheral HW engine or via general purpose IO by Spi driver.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

CS_VIA_PERIPHERAL_ENGINE

Range

CS_VIA_GPIO
CS_VIA_PERIPHERAL_ENGINE

4.22.9.2.7.5. SpiDataShiftEdge

Item

Name

SpiDataShiftEdge

Description

This parameter defines the SPI data shift edge.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

LEADING

Range

LEADING
TRAILING

4.22.9.2.7.6. SpiEnableCs

Item

Name

SpiEnableCs

Description

This parameter enables or not the Chip Select handling functions. If this parameter is enabled then parameter SpiCsSelection further details the type of chip selection.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.2.7.7. SpiHwUnit

Item

Name

SpiHwUnit

Description

This parameter is the symbolic name to identify the HW SPI Hardware microcontroller peripheral allocated to this Job.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

CSIB0

Range

CSIB0
CSIB1
CSIB2
CSIB3
CSIB4

4.22.9.2.7.8. SpiShiftClockIdleLevel

Item

Name

SpiShiftClockIdleLevel

Description

This parameter defines the SPI shift clock idle level.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

LOW

Range

HIGH
LOW

4.22.9.2.7.9. SpiTimeClk2Cs

Item

Name

SpiTimeClk2Cs

Description

Timing between clock and chip select (in seconds) - This parameter allows to use a range of values from 0 up to 0.0001 seconds.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1.0E-4

Max-value

1.0E-4

Min-value

0.0

4.22.9.2.7.10. SpiCsMode

Item

Name

SpiCsMode

Description

This selcts which CS mode the device should enter. SPI_SINGLE: the CS will return to default level after one transmission unit has been sent. SPI_CONTINUOUS: the CS will remain active during the whole transmission.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_CONTINUOUS

Range

SPI_SINGLE
SPI_CONTINUOUS

4.22.9.2.7.11. SpiCsIdleTime

Item

Name

SpiCsIdleTime

Description

CS idle time (Timing between clock and chip select) if single mode is chosen.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_DATADELAY_0

Range

SPI_DATADELAY_0
SPI_DATADELAY_1
SPI_DATADELAY_2
SPI_DATADELAY_3

4.22.9.2.7.12. SpiExtDeviceClockDivider

Item

Name

SpiExtDeviceClockDivider

Description

Clock divider. This is used to derive the required baudrate from the functional clock. This value should be 1 less than the actual divider value. So a value of 0 means the divider is 1

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

65535

Min-value

0

4.22.9.2.8. SpiExternalDeviceConfigMCSPI

MCSPI HW specific external device config. Should be populated only if hwUnitId is of type MCSPI

4.22.9.2.8.1. SpiExtDeviceMCSPITxRxMode

Item

Name

SpiExtDeviceMCSPITxRxMode

Description

TX and RX mode. Data is transmitted (shifted out serially on SPIDAT[0]) and received (shifted in serially on SPIDAT[1]) simultaneously on separate data lines. Tx only mode - Data is only transmiited (shifted out serially on SPIDAT). Minimizies data movement when only transmission is meaningful. RX only mode doesn’t make sense in master mode because to receive data the master has to generate clock, which means it should transmit first. Hence this mode is not supported. The user can alternatively set the TX buffer pointer to NULL and set the default TX value (defaultTxData) to make TX data line at the desired level. in case of Both EB/IB Buffer Mode.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_TX_RX_MODE_BOTH

Range

SPI_TX_RX_MODE_BOTH
SPI_TX_RX_MODE_TX_ONLY

4.22.9.2.8.2. SpiExtDeviceMCSPIStartBitEnable

Item

Name

SpiExtDeviceMCSPIStartBitEnable

Description

Start bit D/CX added before SPI transfer. Polarity is defined by StartBitLevel

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.2.8.3. SpiExtDeviceMCSPIStartBitLevel

Item

Name

SpiExtDeviceMCSPIStartBitLevel

Description

Start-bit polarity used when startBitEnable is TRUE.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_LOW

Range

SPI_LOW
SPI_HIGH

4.22.9.2.8.4. SpiExtDeviceMCSPIDataLineSelectReception

Item

Name

SpiExtDeviceMCSPIDataLineSelectReception

Description

Data Line 0 or 1 selected for reception.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

DATA_LINE_0_RECEPTION

Range

DATA_LINE_0_RECEPTION
DATA_LINE_1_RECEPTION

4.22.9.2.8.5. SpiExtDeviceMCSPIDataLineSelectTransmission

Item

Name

SpiExtDeviceMCSPIDataLineSelectTransmission

Description

Data Line 0 or 1 or both selected for transmission.No transmission on data lines if DATA_LINE_NO_TRANSMISSION is selected

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

DATA_LINE_1_TRANSMISSION

Range

DATA_LINE_NO_TRANSMISSION
DATA_LINE_0_TRANSMISSION
DATA_LINE_1_TRANSMISSION
DATA_LINE_BOTH_TRANSMISSION

4.22.9.2.9. SpiJob

All data needed to configure one SPI-Job, amongst others the connection between the internal SPI unit and the special settings for an external device is done.

4.22.9.2.9.1. SpiHwUnitSynchronous

Item

Name

SpiHwUnitSynchronous

Description

Tags: atp.Status=obsolete

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

ASYNCHRONOUS

Range

ASYNCHRONOUS
SYNCHRONOUS

4.22.9.2.9.2. SpiJobEndNotification

Item

Name

SpiJobEndNotification

Description

This parameter is a reference to a notification function.

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

NULL_PTR

4.22.9.2.9.3. SpiJobId

Item

Name

SpiJobId

Description

SPI Job ID, used as parameter in SPI API functions.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

65535

Min-value

0

4.22.9.2.9.4. SpiJobPriority

Item

Name

SpiJobPriority

Description

Priority set accordingly to SPI093: 0, lowest, 3, highest priority

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

3

Max-value

3

Min-value

0

4.22.9.2.9.5. SpiDeviceAssignment

Item

Name

SpiDeviceAssignment

Description

Reference to the external device used by this job

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.2.9.6. SpiHwUnitAssignment

Item

Name

SpiHwUnitAssignment

Description

Reference to the HW unit used by this job

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.2.10. SpiChannelList

References to SPI channels and their order within the Job.

4.22.9.2.10.1. SpiChannelIndex

Item

Name

SpiChannelIndex

Description

This parameter specifies the order of Channels within the Job.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

255

Min-value

0

4.22.9.2.10.2. SpiChannelAssignment

Item

Name

SpiChannelAssignment

Description

A job reference to a SPI channel.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.2.11. SpiSequence

All data needed to configure one SPI-sequence

4.22.9.2.11.1. SpiInterruptibleSequence

Item

Name

SpiInterruptibleSequence

Description

This parameter allows or not this Sequence to be suspended by another one.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.2.11.2. SpiSeqEndNotification

Item

Name

SpiSeqEndNotification

Description

This parameter is a reference to a notification function.

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

NULL_PTR

4.22.9.2.11.3. SpiSequenceId

Item

Name

SpiSequenceId

Description

SPI Sequence ID, used as parameter in SPI API functions.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

255

Min-value

0

4.22.9.2.11.4. SpiJobAssignment

Item

Name

SpiJobAssignment

Description

A sequence references several jobs, which are executed during a communication sequence

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.2.12. SpiHwUnitConfig

HW Unit configurations

4.22.9.2.12.1. SpiHwUnitType

Item

Name

SpiHwUnitType

Description

SPI HW unit to use.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_UNIT_MCSPI0

Range

SPI_UNIT_MCSPI0
SPI_UNIT_MCSPI1
SPI_UNIT_MCSPI2
SPI_UNIT_MCSPI3
SPI_UNIT_MCSPI4
SPI_UNIT_MCSPI5
SPI_UNIT_MCSPI6
SPI_UNIT_MCSPI7

4.22.9.2.12.2. SpiHwUnitDmaEnable

Item

Name

SpiHwUnitDmaEnable

Description

Enables DMA support for MCSPI instance

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Pre-Compile-Time

VARIANT-PRE-COMPILE

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Default-value

false

4.22.9.2.12.3. SpiHwUnitCddDmaTxHandler

Item

Name

SpiHwUnitCddDmaTxHandler

Description

References the CDD DMA handler used for MCSPI transmission

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.2.12.4. SpiHwUnitCddDmaRxHandler

Item

Name

SpiHwUnitCddDmaRxHandler

Description

References the CDD DMA handler used for MCSPI reception

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.3. SpiGeneral

General configuration settings for SPI-Handler

4.22.9.3.1. SpiCancelApi

Item

Name

SpiCancelApi

Description

Switches the Spi_Cancel function ON or OFF.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.3.2. SpiEnableJobLog

Item

Name

SpiEnableJobLog

Description

Enable/disable SPI job log

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.22.9.3.3. SpiMaxExternalDevices

Item

Name

SpiMaxExternalDevices

Description

Number of different SPI hardware microcontroller peripherals (units/busses) available and handled by this SPI Handler/Driver module.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

8

Max-value

8

Min-value

1

4.22.9.3.4. SpiMaxJobLogLength

Item

Name

SpiMaxJobLogLength

Description

Maximum job log entries when logging is ON

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

100

Max-value

65535

Min-value

1

4.22.9.3.5. SpiMaxTimeoutDuration

Item

Name

SpiMaxTimeoutDuration

Description

Maximum time duration for SPI transmission. Unit is in clock ticks. Configure the timeout according to r5f clock frequency(400MHz/200MHz)

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

10000

Max-value

4294967295

Min-value

1

4.22.9.3.6. SpiMaxChannelsPerJob

Item

Name

SpiMaxChannelsPerJob

Description

Maximum channels allowed per job Max range is derived from realtime usecases.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

4

Max-value

255

Min-value

1

4.22.9.3.7. SpiMaxJobsPerSequence

Item

Name

SpiMaxJobsPerSequence

Description

Maximum jobs allowed per sequence Max range is derived from realtime usecases.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

4

Max-value

255

Min-value

1

4.22.9.3.8. SpiMaxChannels

Item

Name

SpiMaxChannels

Description

Maximum channels across all jobs/sequence/hwunit

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

24

Max-value

255

Min-value

1

4.22.9.3.9. SpiMaxJobs

Item

Name

SpiMaxJobs

Description

Maximum jobs across all sequence/hwunit

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

10

Max-value

65535

Min-value

1

4.22.9.3.10. SpiMaxSequences

Item

Name

SpiMaxSequences

Description

Maximum sequences across all hwunit

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

10

Max-value

255

Min-value

1

4.22.9.3.11. SpiChannelBuffersAllowed

Item

Name

SpiChannelBuffersAllowed

Description

Selects the SPI Handler/Driver Channel Buffers usage allowed and delivered. IB = 0; EB = 1; IB/EB = 2;

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

2

Max-value

2

Min-value

0

4.22.9.3.12. SpiDevErrorDetect

Item

Name

SpiDevErrorDetect

Description

Switches the development error detection and notification on or off.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.3.13. SpiHwStatusApi

Item

Name

SpiHwStatusApi

Description

Switches the Spi_GetHWUnitStatus function ON or OFF.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.3.14. SpiInterruptibleSeqAllowed

Item

Name

SpiInterruptibleSeqAllowed

Description

Switches the Interruptible Sequences handling functionality ON or OFF.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.3.15. SpiLevelDelivered

Item

Name

SpiLevelDelivered

Description

Selects the SPI Handler/Driver level of scalable functionality: SYNC ONLY(0), ASYNC ONLY (1), SYNC/ASYNC(2)

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

2

Max-value

2

Min-value

0

4.22.9.3.16. SpiMainFunctionPeriod

Item

Name

SpiMainFunctionPeriod

Description

This parameter defines the cycle time of the function Spi_MainFunction_Handling in seconds. The parameter is not used by the driver it self, but it is used by upper layer.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0.01

Max-value

INF

Min-value

0.0

4.22.9.3.17. SpiSupportConcurrentSyncTransmit

Item

Name

SpiSupportConcurrentSyncTransmit

Description

Specifies whether concurrent Spi_SyncTransmit() calls for different sequences shall be configurable.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.22.9.3.18. SpiUserCallbackHeaderFile

Item

Name

SpiUserCallbackHeaderFile

Description

Header file name which will be included by the Spi. The value of this parameter shall be used as h-char-sequence or q-char-sequence according to ISO C90 section 6.10.2 “source file inclusion”. The parameter value MUST NOT represent a path, since ISO C90 does not specify how such a path is treated (i.e., this is implementation defined (and additionally depends on the operating system and the underlying file system)).

Multiplicity-Configuration-Class

Link Time

VARIANT-LINK-TIME

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.3.19. SpiVersionInfoApi

Item

Name

SpiVersionInfoApi

Description

Switches the Spi_GetVersionInfo function ON or OFF.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.22.9.3.20. SpiIrqType

Item

Name

SpiIrqType

Description

Type of Isr function: void functionname(void) CAT1 : interrupt void func(void) CAT2 : ISR(func)

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_ISR_CAT2

Range

SPI_ISR_VOID
SPI_ISR_CAT1
SPI_ISR_CAT2

4.22.9.3.21. SpiDefaultOSCounterId

Item

Name

SpiDefaultOSCounterId

Description

Default Os Counter Id if node reference to OsCounter ref SpiOsCounterRef is not set

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

16

Min-value

0

4.22.9.3.22. SpiTimeoutDuration

Item

Name

SpiTimeoutDuration

Description

SPI timeout - used in SPI busy wait. Unit is in clock ticks. Configure the timeout according to r5f clock frequency(400MHz/200MHz)

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

32000

Max-value

4294967295

Min-value

1

4.22.9.3.23. SpiRegisterReadbackApi

Item

Name

SpiRegisterReadbackApi

Description

Enable API to readback SPI critical registers

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Pre-Compile-Time

VARIANT-PRE-COMPILE

Post-Build-Time

VARIANT-POST-BUILD

Default-value

true

4.22.9.3.24. SpiSafetyApi

Item

Name

SpiSafetyApi

Description

Enable API to do safety diagnostic

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Pre-Compile-Time

VARIANT-PRE-COMPILE

Post-Build-Time

VARIANT-POST-BUILD

Default-value

true

4.22.9.3.25. SpiChannelInternalBufferMaxLength

Item

Name

SpiChannelInternalBufferMaxLength

Description

Internal Buffer length in bytes - applicable for SpiChannelBuffer type - SPI_IB. This is the maximum length that can be allocated by each channel and it is fixed.Can vary buffer length per channel by configuring SpiIbNBuffers and SpiDataWidth. Refer MCAL-1255 and MCAL-1203

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Pre-Compile-Time

VARIANT-PRE-COMPILE

Post-Build-Time

VARIANT-POST-BUILD

Default-value

64

Max-value

4294967295

Min-value

1

4.22.9.3.26. SpiDeviceVariant

Item

Name

SpiDeviceVariant

Description

Select SOC variant

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Pre-Compile-Time

VARIANT-PRE-COMPILE

Post-Build-Time

VARIANT-POST-BUILD

Default-value

AM263Px

Range

AM263Px

4.22.9.3.27. SpiOsCounterRef

Item

Name

SpiOsCounterRef

Description

This parameter contains a reference to the OsCounter, which is used by the SPI driver.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.22.9.3.28. SpiHwUnitEnabled

Structure for storing enabled SPI HW units

4.22.9.3.28.1. SpiHwUnitEnabledFlag

Item

Name

SpiHwUnitEnabledFlag

Description

Group configurations

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Link-Time

VARIANT-LINK-TIME

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

SPI_HWUNIT_MCSPI0

Range

SPI_HWUNIT_MCSPI0
SPI_HWUNIT_MCSPI1
SPI_HWUNIT_MCSPI2
SPI_HWUNIT_MCSPI3
SPI_HWUNIT_MCSPI4
SPI_HWUNIT_MCSPI5
SPI_HWUNIT_MCSPI6
SPI_HWUNIT_MCSPI7

Note

SpiTimeoutDuration and SpiMaxTimeoutDuration parameter value should be passed as number of ticks according to clock frequency. The clock source have changed from RTI timers which used 200MHz clock frequency to R5f timers which uses 400MHz clock frequency, so the timeout values need to be configured accordingly.

4.22.9.4. Configuration rules and constraints to enable plausibility checks

SPI DMA Tx and Rx Handler should be configured to match Channel IDs with the EDMA TRIG XBAR MODULE number selected with appropriate CDD DMA channel trigger source selected from the dropdown as per the instance. Channel crossbar and channel crossbar map can be left to default as SPI driver doesn’t make use of those parameters.

CDD DMA Crossbar configuration matching Channel ID for SPI Handle

Fig. 4.96 CDD DMA Crossbar configuration matching Channel ID for SPI Handle

4.22.10. Examples

4.22.10.1. Overview

  • Spi Example:

    • Initialize clock using Mcu_Init()

    • Initialize port using Port_Init()

    • Initialize spi using Spi_Init()

    • Get Spi Version using Spi_GetVersionInfo()

    • Configure Spi interrupt

    • Set up the buffers using Spi_SetupEB()

    • Start the Spi transmission using Spi_AsyncTransmit()

    • Read the last transmission result of the specified Job using Spi_GetJobResult()

    • Read the last transmission result of the specified Sequence using Spi_GetSequenceResult()

4.22.10.2. Setup required to run example

None

4.22.10.3. How to run examples

4.22.10.3.1. Steps to build and run example

Spi example application demonstrating the MCAL SPI driver features is in folder <MCAL_ROOT>/examples/Spi.

This application can be built from the root folder by giving gmake –s mcspi_app PLATFORM=am263px.

Then launch TI Code Composer Studio (CCS) and connect the Board with it using an appropriate target configuration, load the application binary in to R5_0 core and execute the binary.

4.22.10.3.2. Flow of the example application

  1. In example application,the status of spi is checked,whether it is idle or busy.

  2. After checking the status,it sets the external buffer as per requirement.

  3. Then the mode of transmission is set and post that async transmission takes place with loopback enable.

  4. After the transmission is completed,the recieve and transmit data is compared and the datas should be same.

4.22.10.3.3. Configuration used to test this example

The example application is configured with the following Parametrs:

Max Channels :10U

Max channels per Sequence :4U

Max Jobs per seq:4U

Max HwUnit :8U

Max External Devices:8U

Channel BufferType :SPI_EB

Maximum Buffer Length :1120U

Transfer Type :SPI_MSB

Mode of Transmission:Asynchronous

Method of Testing :Loopback

4.22.10.3.3.1. Program changes with DMA mode

For DMA mode support, DMA TPCC0 Interrupt aggregation (INTR) line number 72 gets used to register ISR with EDMA and Cache write back for source buffer before data transmission as well as Cache invalidation before validating destination buffers should happen using respective Mcal_CacheP_wb and Mcal_CacheP_inv APIs.

4.22.10.4. Sample Log

 SPI_APP: Variant - Post Build being used !!!
 SPI_APP
 : Sample Application - STARTS !!!
 
 SPI MCAL Version Info
 ---------------------
 Vendor ID           : 44
 Module ID           : 83
 SW Major Version    : 9
 SW Minor Version    : 1
 SW Patch Version    : 0
 
  SPI_APP: CH 10: JOBS 4: SEQ 3: HWUNIT 8: NUM OF WORDS 1120:!!!
 SPI_APP: SPI Async transmit in progress!!

 SPI_APP: SPI Loopback Test Passed!!!

 SPI Stack Usage: 1000 bytes

4.22.10.5. File Structure

📦AM263Px
┣ 📂build
┣ 📂mcal
┃ ┣ 📂examples
┃ ┃ ┣ 📂Spi
┃ ┃ ┃ ┣ 📂mcspi_app
┃ ┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┃ ┣ 📜McspiApp.c : Contains the SPI test example for McSPI
┃ ┃ ┃ ┃ ┣ 📜McspiApp.h : Contains McSPI example header file
┃ ┃ ┃ ┃ ┗ 📜Makefile
┃ ┣ 📂examples_config
┃ ┃ ┣ 📂Spi_Demo_Cfg
┃ ┃ ┃ ┗ 📂soc
┃ ┃ ┃ ┃ ┣ 📂am263px
┃ ┃ ┃ ┃ ┃ ┗ 📂r5f0_0
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂include
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗📜Spi_Cfg.h : Contains the configuration parameters
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📂src
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣📜Spi_Cfg.c : Contains all Pre-Compile Configured parameters
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣📜Spi_Lcfg.c : Contains all Link time configured parameters
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜Spi_PBcfg.c : Contains all Post build configured parameters
┃ 📂mcal_config
┃ 📂mcal_docs
┗ 📜README.txt

4.22.11. References

AUTOSAR_SWS_SPIHandlerDriver
Technical Reference Manual