EasyManua.ls Logo

Freescale Semiconductor MPC5604B - Developing a General Purpose SPI Driver

Default Icon
150 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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.
3.
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.
Methods
Direction
TX/RX
Master/Slave
Description
Execution
exchange
Full-duplex
TX+RX
Master
a data exchange
Foreground
write
Half-duplex
TX
Master
a data sent
Foreground
read
Half-duplex
RX
Master
a data received
Foreground
show
Half-duplex
RX
Slave
a data written on TX buffer
Foreground
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:
Methods
Direction
TX/RX
Master/Slave
Description
Execution
exchange_array
Full-duplex
TX+RX
Master
a data array exchange,
known size
Foreground
Background
write_array
Half-duplex
TX
Master
a data array sent,
known size
Foreground
Background
read_array
Half-duplex
RX
Master
a data array received,
known size
Foreground
Background
listen
Half-duplex
RX
Slave
a data array received,
known size
Foreground
Background
listen_till
Half-duplex
RX
Slave
a data array received,
known terminating
data
Foreground
Background
show_array
Half-duplex
TX
Slave
a data array written on
TX buffer, known size
Foreground
Background

Table of Contents

Other manuals for Freescale Semiconductor MPC5604B

Related product manuals