Chapter 9: SPI (Serial Pheripheral Interface) Module
* Introduction
* 9.1 8-bit and 16-bit data transfer
* 9.2 Master and slave modes
* 9.2.1 Master mode
* 9.2.2 Slave mode
* 9.3 Framed SPI modes
* 9.3.1 SPI module in master mode and frame master mode
* 9.3.2 SPI module in master mode and frame slave mode
* 9.3.3 SPI module in slave mode and frame master mode
* 9.3.4 SPI module in slave mode and frame slave mode
* 9.4 SPI master mode clock frequency
* 9.5 SPI module operation in SLEEP and IDLE modes
* 9.5.1 SPI module operation in SLEEP mode
* 9.5.2 SPI module operation in IDLE mode
Introduction
The Serial Peripheral Interface (SPI) module is a synchronous serial interface useful for communicating with other peripheral or microcontoller devices. The examples of the peripheral devices are: serial EEPROMs, shift registers, display drivers, serial A/D converters, etc. The SPI module is compatible with Motorola’s SPI and SIOP interfaces.
Depending on the variant, the dsPIC30F family offers one or two SPI modules on a single device. E.g. dsPIC30F3014 has one SPI interface module, whereas dsPIC30F6014 has two.
A standard SPI serial port consists of the following special function registers (SPR):
* SPIxBUF – SFR used to buffer data to be tramsittesd and data that have been received. It consists of two memory locations SPIxTXB (data trasmit) and SPIxRXB (data receive).
* SPIxCON – a control register that configures the module for various modes of operation.
* SPIxSTAT – a status register that indicates various status conditions.
In addition, there is a 16-bit register, SPIxSR, that is not memory mapped. It is used for shifting in and out of the SPI port.
The memory mapped special function register SPIxBUF, the SPI data receive/transmit register, actually consists of two separate registers – SPIxTXB and SPIxRXB. If a user writes data to the SPIxBUF address, internally the data are written to the SPIxTXB (transmit buffer) register. Similarly, when the user reads the received data from the SPIxBUF, internally the data are read from the SPIxRXB (receive buffer) register. This double buffering of transmit and receive operations allows continuous data transfers in the background.
Attention!!!
The user can not write to the SPIxTXB register or read from the SPIxRXB register directly. All reads and writes are performed on the SPIxBUF register.
Read the rest of this entry »
Tags:
CKP,
connection,
cycle,
DISSDO,
FRMEN,
master,
MSTEN,
Pin,
SCKx,
SDOx,
serial,
SPI,
SPIFSD,
SPIROV,
SPIx,
SPIxBUF,
SPIxCON,
SPIxRXB,
SPIxSR,
SPIxSTAT,
SPIxTXB,
SSx,
synchronization,
transmission
Related posts