Serial Peripheral Interface (SPI)
7-318
MC68360 USER’S MANUAL
M/S—Master/Slave
The M/S bit configures the SPI to work as a master or a slave.
0 = SPI is a slave.
1 = SPI is a master.
EN—Enable SPI
The EN bit enables the SPI operation. Note that SPIMOSI, SPIMISO, SPICLK, and
SPISEL should be configured to connect to the SPI as described in 7.14.7 Port B Regis-
ters. When the EN bit is cleared, the SPI is in a reset state and consumes minimal pow-
er—the SPI baud rate generator is not functioning and the input clock is disabled.
0 = SPI is disabled.
1 = SPI is enabled.
NOTE
Other bits of the SPMODE should not be modified by the user
while EN is set.
LEN—Character Length
The LEN field specifies how many bits are in a character. The value 0000 corresponds to
1 bit, and the value 1111 corresponds to 16 bits. Acceptable values are in the range of 4
to 16 bits inclusive. Programming a value less than 4 bits may cause erratic behavior.
If the LEN value is less than or equal to a byte, there will be LEN number of valid bits in
every byte (8 bits) in memory. If the LEN value is greater than a byte, there will be LEN
number of valid bits in every word (16 bits) in memory (See the following example).
PM3–PM0—Prescale Modulus Select
These four bits specify the divide ratio of the prescale divider in the SPI clock generator.
The BRGCLK is divided by 4 * ([PM3–PM0] + 1) giving a clock divide ratio of 4 to 64. The
clock has a 50% duty cycle.
SPI Examples with Different LEN Values
These examples use LEN to illustrate using the bits described above.To help map the pro-
cess, let g through v be binary symbols, x indicates a deleted bit, __ indicates original byte
boundaries, and _ indicates original nybble (4-bit) boundaries - both are used to aid read-
ability and to help understand the process. Once the data string image is determined, it is
always transmitted byte by byte with the lsb first.
Let the memory contain the following binary image:
msb
ghij_klmn __opqr_stuv
lsb
Example 1:
with LEN=4 (data size=5), the following data is selected:
msb
xxxj_klmn__xxxr_stuv
lsb
with REV=0, the data string image is:
msb
j_klmn__r_stuv
lsb
the order of the string appearing on the line, a byte at a time is:
nmlk_j__vuts_r
with REV=1, the string has each byte reversed
the data string image is:
msb
nmlk_j__vuts_r
lsb
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.