iLLD_TC27xC
1.0
|
![]() |
The SPI Master interface driver provides a default QSPI configuration for a bidirectional serial communication of data words.
Data transactions are buffered by the hardware based FIFOs. Incoming and outgoing data is transfered in background from/to the QSPI 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. Optionally Dma can be used for data transfers. Only the interrupt configuration and Module initialisation are different when dma is used.
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 QSPI module and channel handles:
In addition, declare global transmit and receive buffers for the data transfers:
See also IfxLld_Cpu_Interrupt_Usage
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 QSPI interrupt handlers by passing the spi handle:
Finally install the interrupt handlers in your initialisation function:
See also IfxLld_Cpu_Interrupt_Usage
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 QSPI 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 for master mode:
The module initialisation can be done in the same function.
Here an example for master mode:
After the module has been initialized, one or more SPI channels can be configured. Each channel has a dedicated select line.
Here an example for a SPI channel in master mode:
The QSPI 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