Spi Master Programming Example; Spi Slave Programming Example - Freescale Semiconductor MPC8313E Family Reference Manual

Powerquicc ii pro integrated processor
Hide thumbs Also See for MPC8313E:
Table of Contents

Advertisement

Serial Peripheral Interface
Offset 0x036
0
R
W
Reset
Figure 19-14. Example SPMODE[REV] = 1 SPMODE[LEN] = 15 MSB Sent First
Offset 0x036
0
R
W
Reset
Figure 19-15. Example SPMODE[REV] = 0 SPMODE[LEN] = 15 LSB Sent First
19.5
Initialization/Application Information
The following sections describe programming examples of the SPI master and slave.
19.5.1

SPI Master Programming Example

The following sequence initialize the SPI to run at a high speed in master mode:
1. Configure a parallel I/O signal to operate as the SPI select output signal if needed.
2. Write 0xFFFFFFFF to SPIE to clear any previous events. Configure SPIM to enable all desired SPI
interrupts.
3. Configure SPMODE to enable normal operation (not loopback), master mode, SPI enabled,
character length, and the fastest speed possible.
4. Write the first character to be sent to SPITD.
19.5.2

SPI Slave Programming Example

The following is an example initialization sequence to follow when the SPI is in slave mode. It is very
similar to the SPI master example, except that SPISEL is used instead of a general-purpose I/O signal.
1. Write 0xFFFFFFFF to SPIE to clear any previous events.
2. Configure SPIM to enable all desired SPI interrupts.
3. Configure SPMODE to enable normal operation (not loopback), slave mode, SPI enabled, and
characters length.
MPC8313E PowerQUICC II Pro Integrated Processor Family Reference Manual, Rev. 3
19-16
15
16
17
MSB
All zeros
15
16
17
MSB
All zeros
Access: Read-only
30
DATA
Access: Read-only
30
DATA
Freescale Semiconductor
31
LSB
31
LSB

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mpc8313

Table of Contents