s908qc16vdse Freescale Semiconductor, Inc, s908qc16vdse Datasheet - Page 179

no-image

s908qc16vdse

Manufacturer Part Number
s908qc16vdse
Description
M68hc08 Microcontrollers
Manufacturer
Freescale Semiconductor, Inc
Datasheet
the second transmission example, the OVRF bit can be set in between the time that SPSCR and SPDR
are read.
In this case, an overflow can be missed easily. Because no more SPRF interrupts can be generated until
this OVRF is serviced, it is not obvious that bytes are being lost as more transmissions are completed.
To prevent this, either enable the OVRF interrupt or do another read of the SPSCR following the read of
the SPDR. This ensures that the OVRF was not set before the SPRF was cleared and that future
transmissions can set the SPRF bit.
SPSCR read, enable OVRF by setting the ERRIE bit.
Freescale Semiconductor
1
2
3
4
BYTE 1 SETS SPRF BIT.
READ SPSCR WITH SPRF BIT SET
AND OVRF BIT CLEAR.
READ BYTE 1 IN SPDR,
CLEARING SPRF BIT.
READ SPSCR AGAIN TO CHECK OVRF BIT.
SPSCR
OVRF
READ
READ
SPDR
SPRF
SPI RECEIVE
COMPLETE
Figure 15-10. Clearing SPRF When OVRF Interrupt Is Not Enabled
SPSCR
1
2
3
4
BYTE 1
OVRF
READ
READ
SPDR
SPRF
MC68HC908QC16 • MC68HC908QC8 • MC68HC908QC4 Data Sheet, Rev. 4
BYTE 1 SETS SPRF BIT.
READ SPSCR WITH SPRF BIT SET
AND OVRF BIT CLEAR.
READ BYTE 1 IN SPDR,
CLEARING SPRF BIT.
BYTE 2 SETS SPRF BIT.
1
BYTE 1
2
Figure 15-9. Missed Read of Overflow Condition
1
2
3
5
6
7
8
Figure 15-10
3
BYTE 2 SETS SPRF BIT.
READ SPSCR WITH SPRF BIT SET
AND OVRF BIT CLEAR.
BYTE 3 SETS OVRF BIT. BYTE 3 IS LOST.
READ BYTE 2 IN SPDR, CLEARING SPRF BIT.
BYTE 2
4
BYTE 2
4
5
illustrates this process. Generally, to avoid this second
BYTE 3
BYTE 3
5
5
6
7
8
6
6
READ SPSCR WITH SPRF BIT SET
AND OVRF BIT CLEAR.
BYTE 3 SETS OVRF BIT. BYTE 3 IS LOST.
READ BYTE 2 IN SPDR, CLEARING SPRF BIT,
BUT NOT OVRF BIT.
BYTE 4 FAILS TO SET SPRF BIT BECAUSE
OVRF BIT IS NOT CLEARED. BYTE 4 IS LOST.
7
7
8
9
BYTE 4
BYTE 4
10
11
12
13
14
10
9
11
8
READ SPSCR AGAIN TO CHECK OVRF BIT.
READ BYTE 2 SPDR, CLEARING OVRF BIT.
BYTE 4 SETS SPRF BIT.
READ SPSCR.
READ BYTE 4 IN SPDR, CLEARING SPRF BIT.
READ SPSCR AGAIN TO CHECK OVRF BIT.
12
13
Functional Description
14
179

Related parts for s908qc16vdse