These sub-fields are:
CONT: Continuous chip selection enable, if set, continuous selection mode is activated.
Available both to the master and to a slave.
CTAS: Clock and transfer attributes select, selects one of CTARx registers. (‘000’ selects
CTAR0, ‘001’ selects CTAR1 etc. until ‘101’). Available only to master.
EOQ: End of queue, signals to the host that current SPI transfer is the last one of a queue.
At the end of the transfer the EOQF flag is raised. Available only to master.
CTNT: Clear SPI_TCNT, the transfer counter register. Available only to master.
PCSx: Peripheral chip select x, selects CSx signals that are going to be asserted.
The DSPI POP RX FIFO Register (POPR) has only a 16-bit RXDATA field containing the data on
the next entry of the RX FIFO.
Developing a general purpose SPI Driver
DSPI is a rich module with a lot options but, for establishing an SPI bus but in common
embedded usage, we don’t need all of those. In order to simplify its initialisation and usage, we
can develop a high-level driver.
A driver with an Object Oriented user interface, for transferring simple data or data arrays in full
or half duplex modes has been developed in C language. A structure was used to represent a
DSPI module’s driver, with function pointers in it for better user interface.
Transfer methods implemented in this driver are show in the table below.
a data written on TX buffer
These four single cycle transfer methods run only on foreground, blocking the program flow
until the transfer is completed. There are also data array transferring methods:
a data array exchange,
known size
a data array sent,
known size
a data array received,
known size
a data array received,
known size
a data array received,
known terminating
data
a data array written on
TX buffer, known size