FlexCAN Rx Mask KSDK1.3

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

FlexCAN Rx Mask KSDK1.3

1,508 Views
Anonymous
Deactivated User

Hi All,

 

i need help on  understand function  FLEXCAN_DRV_SetRxFifoGlobalMask and FLEXCAN_DRV_SetRxMbGlobalMask from KSDK 1.3

 

I wants to remove all kind of Filter on receiving message.

 

I used code from SDK example it is working fine on FRDM64 kit. please see the attachment.

 

Please help me for required modification for remove all Filters.

 

Thanks in advance

 

regards

rishi

Original Attachment has been moved to: main.c.zip

Labels (1)
3 Replies

733 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi RISHI KUMAR,

     Thank you for your interest in Freescale kinetis product, I would like to provide service for you!

     1)Function  FLEXCAN_DRV_SetRxFifoGlobalMask: Configure register CANx_RXFGMASK, this register is the Rx FIFO global mask register, If Rx FIFO is enabled RXFGMASK is used to mask the Rx FIFO ID Filter Table elements that do not have a corresponding RXIMR according to CTRL2[RFFN] field setting.  0,  The corresponding bit in the filter is "don't care."; 1,The corresponding bit in the filter is checked.

     2)Function FLEXCAN_DRV_SetRxMbGlobalMask: Configure register CANx_RXMGMASK, this register is the Rx Mailboxes Global Mask Register, RXMGMASK is used to mask the filter fields of all Rx MBs, excluding MBs 14-15,which have individual mask registers. 0,  The corresponding bit in the filter is "don't care."; 1,The corresponding bit in the filter is checked.

More details, please refer to the K64 reference manual, Chapter 49 CAN (FlexCAN), the according register description.

    So if you want to remove all kind of filter on receiving message, you just need to configure register CANx_RXFGMASK and  CANx_RXMGMASK to 0.

   Take an example:

  Modify

     result = FLEXCAN_DRV_SetRxFifoGlobalMask(flexcanInstance, kFlexCanMsgIdStd, 0x7FF);

   to

      result = FLEXCAN_DRV_SetRxFifoGlobalMask(flexcanInstance, kFlexCanMsgIdStd, 0);

Modify

     result = FLEXCAN_DRV_SetRxMbGlobalMask(flexcanInstance, kFlexCanMsgIdStd, 0x123);

  to

      result = FLEXCAN_DRV_SetRxMbGlobalMask(flexcanInstance, kFlexCanMsgIdStd, 0);

Wish it helps you!

If you still have question, please contact me!

Have a great day,

Jingjing

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

733 Views
Anonymous
Deactivated User

Dear Sir,

Thanks you very much for support. I have check this too , anyway i will check it again.

Fifo is disable in below configuation line.

  flexcan1_data.max_num_mb = 16;

    flexcan1_data.num_id_filters = kFlexCanRxFifoIDFilters_8;

   flexcan1_data.is_rx_fifo_needed = false; //disable fifo here

    flexcan1_data.flexcanMode = kFlexCanNormalMode;

Is there changes in below lines?

    if((node_type=='A') || (node_type=='a'))

    {

        RX_identifier = 0x123;

        TX_identifier = 0x321;

        rx_fifo_id[0] = 0x123; // set rx fifo id

    }

    else

    {

        RX_identifier = 0x321;

        TX_identifier = 0x123;

        rx_fifo_id[0] = 0x321; // set rx fifo id

    }

regards

Rishi

0 Kudos

733 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi RISH KUMAR,

     If you disable the FIFO, you don't need to configure the FLEXCAN_DRV_SetRxFifoGlobalMask, because this function won't be execute.

     You don't need to change the other code, because if you enable all the ID, the CAN will not mask it and can receive all the ID.

Wish it helps you!

If you still have question, please contact me!

Have a great day,

Jingjing

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

0 Kudos