IMXRT1062 Flexcan-FD FIFO Example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMXRT1062 Flexcan-FD FIFO Example

Jump to solution
3,597 Views
michaelsmorto
Contributor IV

Been looking in the SDKs for an example using FIFO for RX and TX but do not see any in the CAN or CANFD driver examples.  Can you all provide a sample program using FIFO?

EDIT:  One of the things that this would be helpful with is setting up the id filter table and the appropriate structure.  I really would like to be able to receive on any mailbox a series of message ides as well as setting up a CANFD fifo

EDIT2:  BTW the docs for the FD example in the 1060evk sdk state

Board settings
==============
The example requires 2 sets of boards, each of them are mounted with the base board. Using a male to male CAN
cable to connect the CAN2 instance (J11) between the 2 base boards.

In looking at the schematic and the pins it looks like the CAN3 tx/rx pins go to the Arduino header.  So how can you test CANFD if you don't have a receiver?  CAN2 is not CANFD.

Labels (2)
Tags (3)
0 Kudos
Reply
1 Solution
2,954 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Michael Smorto

Unfortunately, there isn't any example code of flexcan using the RXFIFO buffer provided along with the SDK. You can check the following post:

K10 FlexCan RX FIFO Filter 

FlexCAN Fifo SDK 2.0 example 

Even if they are for different chips, you could use them as reference for your implementation. I have implement a simple example using the FIFO:

flexcan_rx_fifo_config_t fifoConfig;
     uint32_t tableID[10] = { FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[0], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[1], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[2], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[3], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[4], 0, 0),
              FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[5], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[6], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[7], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[8], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[9], 0, 0), };


     fifoConfig.idFilterType = kFLEXCAN_RxFifoFilterTypeA;
  fifoConfig.idFilterNum = sizeof(tableID) / sizeof(tableID[0]);//2;
  fifoConfig.idFilterTable = tableID;
  fifoConfig.priority = kFLEXCAN_RxFifoPrioHigh;

     FLEXCAN_SetRxFifoConfig(EXAMPLE_CAN, &fifoConfig, true);

......

......

/* When you want to receive some data */

rxXferfifo.frame = &frame;

   FLEXCAN_TransferReceiveFifoNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXferfifo);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

EDIT2:  BTW the docs for the FD example in the 1060evk sdk state

Thanks for pointing out the mistake, this is a error in the read me file, it should actually say CAN3, those pins have also the functionality of the CAN3_Tx/Rx.

Hope this could helps you
Have a great day,
TIC

-------------------------------------------------------------------------------
Note: - If this post answers your question, please click the "Mark Correct" button. Thank you

-------------------------------------------------------------------------------

View solution in original post

2 Replies
2,954 Views
michaelsmorto
Contributor IV

Hi Jorge Antonio Alcala Vazquez

I really appreciate your reply. Thank you for the links - they really help in understanding how to set up the FIFO which was what I was looking.  

Now for the fun - start implementation of the FIFO in the application.

0 Kudos
Reply
2,955 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Michael Smorto

Unfortunately, there isn't any example code of flexcan using the RXFIFO buffer provided along with the SDK. You can check the following post:

K10 FlexCan RX FIFO Filter 

FlexCAN Fifo SDK 2.0 example 

Even if they are for different chips, you could use them as reference for your implementation. I have implement a simple example using the FIFO:

flexcan_rx_fifo_config_t fifoConfig;
     uint32_t tableID[10] = { FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[0], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[1], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[2], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[3], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[4], 0, 0),
              FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[5], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[6], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[7], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[8], 0, 0),
            FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(rxIdentifier[9], 0, 0), };


     fifoConfig.idFilterType = kFLEXCAN_RxFifoFilterTypeA;
  fifoConfig.idFilterNum = sizeof(tableID) / sizeof(tableID[0]);//2;
  fifoConfig.idFilterTable = tableID;
  fifoConfig.priority = kFLEXCAN_RxFifoPrioHigh;

     FLEXCAN_SetRxFifoConfig(EXAMPLE_CAN, &fifoConfig, true);

......

......

/* When you want to receive some data */

rxXferfifo.frame = &frame;

   FLEXCAN_TransferReceiveFifoNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXferfifo);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

EDIT2:  BTW the docs for the FD example in the 1060evk sdk state

Thanks for pointing out the mistake, this is a error in the read me file, it should actually say CAN3, those pins have also the functionality of the CAN3_Tx/Rx.

Hope this could helps you
Have a great day,
TIC

-------------------------------------------------------------------------------
Note: - If this post answers your question, please click the "Mark Correct" button. Thank you

-------------------------------------------------------------------------------