Nxp Semiconductors UM10237 用户手册

下载
页码 792
UM10237_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 19 December 2008 
509 of 792
NXP Semiconductors
UM10237
Chapter 18: LPC24XX CAN controllers CAN1/2
17.1 FullCAN message layout
 
The FF, RTR, and DLC fields are as described in 
Since the FullCAN message object section of the Look-up table RAM can be accessed 
both by the Acceptance Filter and the CPU, there is a method for insuring that no CPU 
reads from FullCAN message object occurs while the Acceptance Filter hardware is 
writing to that object.
For this purpose the Acceptance Filter uses a 3-state semaphore, encoded with the two 
semaphore bits SEM1 and SEM0 (see 
) for each message object. This mechanism provides the CPU with information 
about the current state of the Acceptance Filter activity in the FullCAN message object 
section.
The semaphore operates in the following manner:
 
Prior to writing the first data byte into a message object, the Acceptance Filter will write 
the FrameInfo byte into the according buffer location with SEM[1:0] = 01.
After having written the last data byte into the message object, the Acceptance Filter will 
update the semaphore bits by setting SEM[1:0] = 11.
Before reading a message object, the CPU should read SEM[1:0] to determine the current 
state of the Acceptance Filter activity therein. If SEM[1:0]  = 01, then the Acceptance Filter 
is currently active in this message object. If SEM[1:0] = 11, then the message object is 
available to be read.
Before the CPU begins reading from the message object, it should clear SEM[1:0] = 00.
When the CPU is finished reading, it can check SEM[1:0] again. At the time of this final 
check, if SEM[1:0] = 01 or 11, then the Acceptance Filter has updated the message object 
during the time when the CPU reads were taking place, and the CPU should discard the 
data. If, on the other hand, SEM[1:0] = 00 as expected, then valid data has been 
successfully read by the CPU.
 shows how software should use the SEM field to ensure that all three words 
read from the message are all from the same received message.
Table 454. Format of automatically stored Rx messages
Address
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
8
7
6
5
4
3
2
1
0
0
F
F
R
T
R
0000
SEM
[1:0]
0000
DLC
00000
ID.28 ... ID.18
+4
Rx Data 4
Rx Data 3
Rx Data 2
Rx Data 1
+8
Rx Data 8
Rx Data 7
Rx Data 6
Rx Data 5
Table 455. FullCAN semaphore operation
SEM1
SEM0
activity
0
1
Acceptance Filter is updating the content
1
1
Acceptance Filter has finished updating the content
0
0
CPU is in process of reading from the Acceptance Filter