Microco ntr oller Abstr action
(Figure 18
RI VRIWZDUH XVHU¶V JXLGH
)
Microcontroller / Processor
TCAN4x5x
SPI Abstraction Layer
ECU Abstraction Layer
Application Layer
Hardware
Software
TCAN4x5x API
Firmware
19
SLLU216 – July 2019
Copyright © 2019, Texas Instruments Incorporated
SPI to CAN FD SBC + LIN Transceiver BoosterPack User's Guide
Texas Instruments provides the necessary ECU abstraction layer driver source code necessary to
integrate the TCAN4550-Q1 into an AutoSAR environment. Contact TI to get the source code.
The demo firmware provided is a lower-level API for controlling various TCAN4550-Q1 functions and
sending and receiving CAN messages. It does not have as significant of an overhead as AutoSAR, but it
also has less abstraction. For non-AutoSAR applications this code library provides all of the building
blocks to use as a starting point for any system development. This API abstracts TCAN4550-Q1 function
calls to call upon a SPI Abstraction Layer function, allowing the user to quickly change code to a different
microcontroller by only changing the code which controls the SPI peripheral. There are three main layers
in this abstraction:
1. The SPI Abstraction Layer is responsible for handling the processor-specific SPI function calls to
perform register reads and writes to the TCAN4550-Q1
2. The TCAN4550-Q1 API Layer provides a set of functions for performing TCAN4550-Q1 actions such
as sending or receiving a CAN message.
3. The Application Layer is the end-user's code which calls upon the API to communicate with the
TCAN4550-Q1 easily without much overhead
Figure 10. Microcontroller Abstraction
This Microcontroller Abstraction source code is developed for a MSP430FR6989 and is functional with the
MSP-EXP430FR6989 LaunchPad. The code can be used with other microcontrollers and processors by
updating the appropriate SPI drivers.
All of the code in the API software relies on the SPI Abstraction Layer. There are 8 functions that reside in
this layer. The first 2 listed below are the fixed-length single-word read and write functions. The next 6 are
multi-word read and write functions
1. uint32_t AHB_READ_32 ( uin16_t address ) : Single-register 32-bit word read.
2. void AHB_WRITE_32 ( uint16_t address, uint8_t words ) : Single-register 32-bit word write.
3. void AHB_READ_BURST_START ( uint16_t address, uint8_t words ) : Send the SPI header for a
multi-word read, providing the starting register address and how many words are read.
4. uint32_t AHB_READ_BURST_READ ( ) : Returns a 32-bit word of data that is read, without toggling
the CS pin.
5. void AHB_READ_BURST_END ( ) : At the end of a multi-register read, this function ends a SPI
transaction by pulling the CS pin high.
6. void AHB_WRITE_BURST_START ( uint16_t address, uint8_t words ) : Send the SPI header for a
multi-word write, providing the starting register address and how many words are written.
7. void AHB_WRITE_BURST_WRITE ( uint32_t data) : Writes a 32-bit word of data, without toggling the
CS pin.
8. void AHB_WRITE_BURST_END ( ) : At the end of a multi-register write, this function ends a SPI
transaction by pulling the CS pin high.