Microcontroller / Processor
TCAN4x5x
MCAL
ECU Abstraction Layer
Services Layer
Run Time Environment (RTE)
Application Layer
Hardware
AutoSAR
Firmware
18
SLLU216 – July 2019
Copyright © 2019, Texas Instruments Incorporated
SPI to CAN FD SBC + LIN Transceiver BoosterPack User's Guide
Reducing the amount of SPI overhead alos ensures the maximum CAN throughput can be achieved.
Every SPI transaction requires a single word (4 byte) header. Doing a single word data transfer is
inefficient because 50% of the SPI bits are register data. Using Burst Reads and Writes can reduce
unnecessary header data and reduce the total number of SPI bytes transmitted. When possible, structure
the SPI data into packets of up to 256 words with the starting address of where the data bytes should be
written. Not only does this reduce excess headers, but it also reduces the idle time associated with the
chip select cycling between SPI transactions.
It is common to receive multiple CAN messages in the time it takes a microcontroller to read a message
and act upon it before retrieving new incoming messages. If multiple messages have been received,
reading these messages into the microcontroller in a bulk group reduces the amount of SPI overhead and
reduce excess time incurred by retrieving these messages individually. Furthermore, it helps ensure that
the RX FIFOs and Buffers do not fill up and are always available to receive new incoming messages.
3.4
Microcontroller Abstraction
The BoosterPack was designed to support operation with any microcontroller launchpad with a SPI bus.
Creating abstraction layers in the code simplifies the effort of porting the code to a different
microcontrollers and allowing maximum amount of reuse at a system level.
AutoSAR (Automotive Open Systems Architecture) is a partnership of automotive-interested parties that
have worked towards developing a specification for automotive systems. It provides specifications that
describe the software modules which communicate with hardware and builds a common methodology of
application development. The advantage of such specifications is that drivers for different hardware
modules can be written in a way that are easily adaptable for many different processors or
microcontrollers, since they are not built for a specific piece of hardware, but rather rely on lower-layer
function calls which are defined by AutoSAR.
There are three main types of AutoSAR blocks that play into the system. The Microcontroller Abstraction
Layer (MCAL) provides standardized function calls to peripherals of a microcontroller such as the IOs, bus
ports such as SPI, and memory. The Electronic Control Unit (ECU) Abstraction Layer provides a common
set of functions that an ECU would use such as CAN communication or GPIOs for sensing buttons or
controlling lights. The MCAL and ECU modules are designed to be processor/vendor specific since they
deal with the specific code required to perform a function. The last main layer is the Services Layer which
provides background services to the application such as network services and bus communication
services.
Figure 9. AutoSAR Abstraction Layers