iLLD_TC27xC
1.0
|
![]() |
The SPI interface driver provides a default ASCLIN configuration for synchronous serial communication in 8 and 16 bit mode, and a set of data transfer routines.
Data transfers are buffered by the hardware based FIFOs. Incoming and outgoing data is transfered in background from/to the ASCLIN peripheral by interrupt service handlers, which are part of this driver as well. This allows a nonblocking communication without stalling the thread(s) from where data is sent and received.
The SPI interface driver works only as Master
In the following sections it will be described, how to integrate the driver into the application framework.
Include following header file into your C code:
Declare the Spi handle as global variable in your C code:
In addition, declare global transmit and receive buffers for the data transfers:
See also How to define Interrupts?
Define priorities for the Interrrupt handlers. This is normally done in the Ifx_IntPrioDef.h file:
Add the interrupt service routines to your C code. They have to call the SPI interrupt handlers by passing the spi handle:
Finally install the interrupt handlers in your initialisation function:
The module initialisation can be done in the same function. Here an example:
The SPI is ready for use now!
In following examples we assume, that following buffers are declared globally:
Sending and Receiving a data stream:
Send only, discard received data:
Receive only, send all 1's