English
Language : 

CP3BT23 Datasheet, PDF (106/260 Pages) Texas Instruments – CP3BT23 Reprogrammable Connectivity Processor with Bluetooth and Dual CAN Interfaces
that case the procedure described below must be fol-
Read buffer
lowed.
2. Read the status to determine if a new message has
overwritten the one originally received which triggered
the interrupt.
Read CNSTAT
3. Write RX_READY into CNSTAT.
4. Read the ID/data and object control (DLC/RTR) from
the message buffer.
Yes
RX_READY?
5. Read the buffer status again and check it is not
RX_BUSYx. If it is, repeat this step until RX_BUSYx
has gone away.
No
6. If the buffer status is RX_FULL or RX_OVERRUN, one
Yes
RX_BUSYx?
or more messages were copied. In that case, start over
with step 2.
7. If status is still RX_READY (as set by the CPU at step
Figure 52.
No
Interrupt Entry Point
RX_OVERRUN?
(optional, for information)
te Write RX_READY
Read buffer (id/data/control)
2), clear interrupt pending bit and exit.
When the BUFFLOCK function is enabled (see BUFFLOCK
on page 102), it is not necessary to check for new messag-
es received during the read process from the buffer, as this
buffer is locked after the reception of the first valid frame. A
read from a locked receive buffer can be performed as
shown in Figure 53.
Interrupt Entry Point
Read buffer (id/data/control)
le Read CNSTAT
Write RX_READY
Yes
RX_BUSYx?
Clear RX_PND
o No
Exit
RX_FULL or
Yes
RX_OVERRUN?
DS039
s No
Figure 53. Buffer Read Routine (BUFFLOCK Enabled)
Clear RX_PND
For simplicity only the applicable interrupt routine is shown:
b 1. Read the ID/data and object control (DLC/RTR) from
the message buffer.
Exit
DS038
2. Write RX_READY into CNSTAT.
3. Clear interrupt pending bit and exit.
OBuffer Read Routine (BUFFLOCK Disabled) 18.5.3 RX Buffer States
The first step is only applicable if polling is used to get the As shown in Figure 53, a receive procedure starts as soon
status of the receive buffer. It can be deleted for an interrupt as software has set the buffer from the RX_NOT_ACTIVE
driven receive routine.
state into the RX_READY state. The status section of CN-
1. Read the status (CNSTAT) of the receive buffer. If the
status is RX_READY, no was the message received, so
exit. If the status is RX_BUSY, the copy process from
hidden receive buffer is not completed yet, so read CN-
STAT again.
STAT register is set from 0000b to 0010b. When a message
is received, the buffer will be RX_BUSYx during the copy
process from the hidden receive buffer into the message
buffer. Afterwards this buffer is RX_FULL. The CPU can
then read the buffer data and either reset the buffer status
to RX_READY or receive a new frame before the CPU reads
If a buffer is configured to RX_READY and its interrupt
is enabled, it will generate an interrupt as soon as the
buffer has received a message and entered the
RX_FULL state (see also Interrupts on page 108). In
the buffer. In the second case, the buffer state will automat-
ically change to RX_OVERRUN to indicate that at least one
message was lost. During the copy process the buffer will
again be RX_BUSYx for a short time, but in this case the
105
www.national.com