
UM10800
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2016. All rights reserved.
User manual
Rev. 1.2 — 5 October 2016
408 of 487
NXP Semiconductors
UM10800
Chapter 28: LPC82x SPI API ROM driver routines
error_en
: Enables the receive overrun and transmit underrun error interrupts.
28.4.8.3 SPI_PARAM_T
This structure defines the SPI configuration.
typedef struct {
// params passed to SPI driver function
uint16_t *tx_buffer; // SPI TX buffer, needed in master and slave TX only
//mode
uint16_t *rx_buffer; // SPI RX buffer, needed in master RX only, TX and RX,
//and
slave
RX
mode,
uint32_t size; // total number of SPI frames
uint32_t fsize_sel; // data lenth of one transfer and SPI SSELx select in TXCTL
uint32_t tx_rx_flag;
uint32_t driver_mode;
SPI_DMA_CFG_T *dma_cfg; // DMA configuration
SPI_CALLBK_T cb; // callback function
SPI_DMA_REQ_T dma_cb; // SPI DMA channel setup callback
} SPI_PARAM_T;
The following variables are used in this structure:
size
: number of SPI frames. A transfer can consist of several transmits of the
TXCTLDAT register and of several frames.
fsize_sel
: write the contents of the SPI TXCTL register to select the data length and the
slave select lines. In slave mode, you need to only select the data length. See
tx_rx_flag
: select receive/transmit mode.
0x0 = SPI transmit only mode
0x1 = SPI receive only mode
0x2 = SPI transmit and receive mode, master mode only, transmit data transfer on
MOSI and receive data transfer on MISO.
driver_mode
: select the driver mode.
0x0 = Polling mode. Function is blocked until transfer has finished.
0x1 = Interrupt mode. Function exits immediately and a call back function is invoked
when the transfer has finished.
0x2 = DMA mode. Data transferred by SPI is processed by DMA. The DMA_req
function is called for SPI DMA channel set up. The callback function indicates when
the transfer is complete.
28.4.8.4 SPI_DMA_CFG_T
This structure configures the channels used for DMA transfer between the SPI and
memory. See
, for the DMA channels connected to the SPI
receive and transmit request lines.
To perform a DMA transfer for receive data, also enable the SPI transmit DMA channel, so
that a SPI clock is generated.