English
Language : 

70353C Datasheet, PDF (34/76 Pages) Microchip Technology – Section 21. Enhanced Controller Area Network
dsPIC33E/PIC24E Family Reference Manual
21.6
TRANSMITTING ECAN MESSAGES
A node originating a message is a transmitter of that message. The node remains a transmitter
until the bus becomes Idle or the unit loses arbitration. Figure 21-8 illustrates a typical ECAN
transmission process.
Message Buffers 0-7 (located in device RAM) are configured to transmit or receive CAN
messages using the TX/RX Buffer Selection bit (TXENn) in the corresponding ECAN TX/RX
Buffer m Control register (CiTRmnCON<7>). If the TXENn bit is set, the message buffer is
configured for transmission. For the layout of standard and extended frames in the message
buffer, and the states of IDE, SRR, RTR, RB0 and RB1 bits for Standard Data, Extended Data,
Standard Remote, or Extended Remote frames as per the CAN Specification, refer to 21.2 “CAN
Message Formats”.
21.6.1 Message Transmission Flow
To transmit a message over the CAN bus, the user application must perform these tasks:
1. Configure a message buffer for transmission and assign a priority to the buffer.
2. Write the CAN message in the message buffer located in device RAM.
3. Set the transmit request bit for the buffer to initiate message transmission.
The Message transmission is initiated by setting the Message Send Request bit (TXREQm) in
the ECAN Transmit/Receive Control register (CiTRmnCON<3>). The TXREQm bit is cleared
automatically after the message is transmitted. Before the SOF is sent, all the buffers ready for
transmission are examined to determine which buffer has the highest priority. The transmit buffer
with the highest priority is sent first.
Note: Setting the TXREQm bit when TXENn bit is ‘0’ will result in unpredictable module
behavior.
Each of the transmit message buffers can be assigned to any of the four user application-defined
priority levels using the TXnPRI<1:0> bits (CiTRmnCON<1:0>).
TXnPRI<1:0> Message Transmission Priority selections are:
• 11 = The transmit message has the highest priority
• 10 = The transmit message has intermediate high priority
• 01 = The transmit message has intermediate low priority
• 00 = The transmit message has the lowest priority
There is a natural order of priority for message buffers that are assigned to the same user
application-defined priority level. The message buffer seven has the highest natural order of
priority. The user application-defined priority levels override the natural order of priority.
Figure 21-8: ECAN™ Transmission
15 1312
Word 0
Transmit Message
SID<10:0>
Word 1 15
12
EID<17:6>
Word
2
15
EID<5:0>
10
9
RTR
8
RB1
7
54
RB0
210
SRR IDE
0
DLC<3:0>
Word 3
Word 4
Word 5
Data Byte 1
Data Byte 3
Data Byte 5
Data Byte 0
Data Byte 2
Data Byte 4
Word 6
Data Byte 7
15 13
8
Word 7
FILHIT<4:0>
Data Byte 6
Device RAM
Message Buffer 0
Message Buffer 1
Message Buffer 2
Message Buffer 3
(TX)
Message Buffer 4
Message Buffer 5
Message Buffer 6
Message Buffer 7
SID SRR EID RTR DLC Extended
Identifier
SID RTR DLC Standard
Identifier
ECAN™ Data Frames
A code example to transmit a standard frame using message buffer 0 is shown in Example 21-1.
DS70353C-page 21-34
© 2008-2011 Microchip Technology Inc.