Documente Academic
Documente Profesional
Documente Cultură
SPI Overview
Master Mode
Slave Mode
SPI
Slave
LPC 2148
LPC2148
SPI
Slave
LPC 2148
SPI
Slave
LPC 2148
Instrumentation & Communication Unit
SCLK
MOSI
MISO
SSEL
SCLK
MOSI
MISO
SSEL
SCLK
MOSI
MISO
SSEL
SCLK
MOSI
MISO
SS1
SS2
SS3
SPI
Master
START
Set SPCCR
Set SPCR
Write data
to SPDR
No
Yes
Read SPSR
Read SPDR
END
Instrumentation & Communication Unit
The important thing to be considered here is CPHA should be 0 when LPC2148 is used
as a SPI Master.
It is mentioned in the User Manual of LPC2148 that SSEL signal is inactive during the
data transfer when CPHA is 0, but when CPHA is 1 the SSEL signal becomes active
and immediately transforms itself into slave.
This results into a Mode Fault and data transfer terminates.
In this case MODF bit of Status Register will set to 1.
Bit 4: CPOL
Bit 5: MSTR
The bit is used to configure SPI block in Master/Slave Mode
MSTR = 0 Slave Mode
MSTR = 1 Master Mode
Bit 6: LSBF
The bit decides the direction of bit transfer
LSBF = 0 MSB is transferred first
LSBF = 1 LSB is transferred first
Bit 7: SPIE
It is an interrupt Enable bit,
SPIE = 0 Interrupt are disabled
SPIE = 1 Interrupts are enabled and will occur when SPI/ WCOL bit is set
Instrumentation & Communication Unit
Example: The target device is 12bit ADC, which is slave and LPC2148 is Master
10
11
When CPHA = 0, the SSEL signal will always go inactive between data
transfers. This is not guaranteed when CPHA = 1 (the signal can remain active). (pg
169)