dsPIC33/PIC24 Family Reference Manual
DS70005340A-page 86 2018 Microchip Technology Inc.
9.0 MESSAGE RECEPTION
The application has to configure the RX FIFO before it can be used for reception (see
Section 5.4.4 “Receive FIFO Configuration”). In addition, the application has to configure and
enable at least one filter (see Section 8.1 “Filter Configuration”).
The CAN FD Protocol Module continuously monitors the CAN bus. Messages that match a filter
are stored in the RX FIFO pointed to by the filter (see Section 8.2 “Filtering a Received
Message”). The message data is stored in the receive message objects.
9.1 Receive Message Object
Table 9-1 specifies the receive message object used by the RX FIFOs. The receive objects
contain the message ID, control bits, payload and timestamp.
• SID: Standard Identifier (ID) or Base ID.
• EID: Extended Identifier.
• DLC: Data Length Code; specifies the number of data bytes in the frame (see
Section 2.1.1 “DLC Encoding”).
• IDE: Identifier Extension; IDE = 0 means a Base Identifier frame is received. IDE = 1
means an Extended Identifier frame is received.
• RTR: Remote Transmit Request; this bit is only specified in CAN 2.0 frames. If this bit is
set, the module is requested to respond with a frame transmission.
• FDF: FD Frame; if this bit is set, a CAN FD frame is received; otherwise, a CAN 2.0 frame
is received.
• BRS: Bit Rate Switch; the data phase of a CAN FD frame is received using DBR if this bit is
set. If the bit is clear, the whole frame is received using NBR.
• ESI: Error Status Indicator; the ESI bit reflects the error status of the transmitting node. A
recessive ESI bit in a CAN FD frame indicates that the transmitting node is error passive;
a dominant bit shows that the transmitting node is error active.
• FILHIT: Indicates the number of the filter that matched the received message.
• RXMSGTS: Timestamp of the Received Message; timestamping can be enabled for each
RX FIFO individually using RXTSEN (C1FIFOCONxL<5>). The receive message object
will not contain RXMSGTS if timestamping is disabled.
• Receive Buffer Data: contains the payload of the message. The maximum payload is
configured by the PLSIZEx bits (C1FIFOCONxH<15:13>.
9.1.1 READING A RECEIVE MESSAGE OBJECT
Before reading a receive message object, the application must ensure that the RX FIFO is not
empty by reading the C1FIFOSTAx register. The RX FIFO is not empty if TFNRFNIF is set.
The RX FIFO user address (C1FIFOUAxH/L) points to the RAM of the next receive message
object to read. R0 of the receive message object is read first, followed by R1, R2 and so on.
After the receive message object is read from RAM, the RX FIFO needs to be incremented by
setting the UINC bit (C1FIFOCONxL<8>). This will make the CAN FD Protocol Module increment
to the tail of the FIFO and update C1FIFOUAxH/L.
Now the application can read the next message from the RX FIFO.