EasyManuals Logo

Microchip Technology dsPIC33 series User Manual

Microchip Technology dsPIC33 series
116 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #89 background imageLoading...
Page #89 background image
2018 Microchip Technology Inc. DS70005340A-page 89
CAN FD Protocol Module
9.3 Resetting RX FIFO
A receive FIFO can be reset by:
Setting FRESET (C1FIFOCONxL<10>) or
Placing the module in Configuration mode (OPMOD<2:0> = 100)
Resetting the FIFO will reset the Head and Tail Pointers, and the C1FIFOSTAx register. The
settings in the C1FIFOCONxH/L registers will not change.
Before resetting an RX FIFO using FRESET, ensure that no enabled filter is pointing to the FIFO.
9.4 Mismatch of DLC and Payload Size During Reception
The PLSIZEx bits reserve a certain number of bytes in the receive message object. The module
handles mismatches between DLC and payload size as follows:
If the number of bytes specified by the DLC is smaller than the number of bytes specified
by the PLSIZEx bits, the received message bytes will be stored in the message object,
without any padding.
If the number of bytes specified by the DLC is bigger than the number of bytes specified by
the PLSIZEx bits, the data bytes that fit in the receive message object are stored and the
other data bytes that do not fit are discarded. The module ensures that the next message
object in RAM does not get overwritten. The module will store the message in the receive
object and the RX FIFO status flags will be updated. In addition, the IVMIF (C1INTL<15>)
and DLCMM flags (C1BDIAG1H<15>) will be set.
9.5 Message Reception Code Example
A code example to receive the CAN FD extended frame using Filter 0, and saving the messages
in FIFO 1, is shown in Example 9-1.
Example 9-1: Message Reception Code
#include <xc.h>
/* This code example demonstrates a method to configure the CAN FD module to receive the extended ID
CAN FD messages. This uses CAN1, FIFO1 and filter 0. FIFO1 is configured to receive 2 messages. */
/* Include fuse configuration code here. */
#define MAX_WORDS 100
unsigned int __attribute__((aligned(4)))CanRxBuffer[MAX_WORDS];
/*data structure to implement a CANFD message buffer. */
/* CANFD Message Time Stamp */
typedef unsigned long CANFD_MSG_TIMESTAMP;
/* CANFD RX Message Object Control*/
typedef struct _CANFD_RX_MSGOBJ_CTRL {
unsigned DLC:4;
unsigned IDE:1;
unsigned RTR:1;
unsigned BRS:1;
unsigned FDF:1;
unsigned ESI:1;
unsigned unimplemented1:2;
unsigned FilterHit:5;
unsigned unimplemented2:16;
} CANFD_RX_MSGOBJ_CTRL;

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Microchip Technology dsPIC33 series and is the answer not in the manual?

Microchip Technology dsPIC33 series Specifications

General IconGeneral
BrandMicrochip Technology
ModeldsPIC33 series
CategoryMotherboard
LanguageEnglish

Related product manuals