About CAN RX ID filltering with RT1170 EVK

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

About CAN RX ID filltering with RT1170 EVK

426 Views
dskim2
Contributor III

Hi 

I want to set all can rx ids pass so setted as below.

I modified the sample source flexcan_interrupt_transfer.c

// Set Rx Masking mechanism.

FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, FLEXCAN_RX_MB_STD_MASK(0x000, 0, 0));

 

// Setup Rx Message Buffer.

mbConfig.format = kFLEXCAN_FrameFormatStandard;

mbConfig.type = kFLEXCAN_FrameTypeData;

mbConfig.id = FLEXCAN_ID_STD(0x000);

#if (defined(USE_CANFD) && USE_CANFD)

FLEXCAN_SetFDRxMbConfig(EXAMPLE_CAN, RX_MESSAGE_BUFFER_NUM, &mbConfig, true);

#else

FLEXCAN_SetRxMbConfig(EXAMPLE_CAN, RX_MESSAGE_BUFFER_NUM, &mbConfig, true);

#endif

When I ran the sample project, CAN TX ID was received.

********* FLEXCAN Interrupt EXAMPLE *********
Message format: Standard (11 bit id)
Message buffer 9 used for Rx.
Message buffer 8 used for Tx.
Interrupt Mode: Enabled
Operation Mode: TX and RX --> Normal
*********************************************

Please select local node as A or B:
Note: Node B should start first.
Node:a
Press any key to trigger one-shot transmission

Rx MB ID: 0x321, Rx MB data: 0x0, Time stamp: 30306  <= Tx CAN message
Press any key to trigger the next transmission!

 
Are there any incorrect settings?
 
Best Regards

 

0 Kudos
Reply
1 Reply

390 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @dskim2 ,

   Happy New Year!   Thanks for your interest in the NXP MIMXRT product, I would like to provide service for you.

  About the filter, you can refer to this post:

https://community.nxp.com/t5/i-MX-RT/RT1052-FLEXCAN-for-some-for-example-five-IDs-communication/m-p/...

  Yes, if you want to receive all the ID, you can set the API like this:

FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, 0);

void FLEXCAN_SetRxMbGlobalMask(CAN_Type *base, uint32_t mask)
{
    /* Enter Freeze Mode. */
    FLEXCAN_EnterFreezeMode(base);

    /* Setting Rx Message Buffer Global Mask value. */
    base->RXMGMASK = mask;
    base->RX14MASK = mask;
    base->RX15MASK = mask;

    /* Exit Freeze Mode. */
    FLEXCAN_ExitFreezeMode(base);
}

 Then, your filter will "don't care." all the ID bit, you can receive all the IDs.

 

Wish it helps you!

Best Regards,

kerry

0 Kudos
Reply