SCH-29856 FLEXCAN CAN

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

SCH-29856 FLEXCAN CAN

329 Views
Dongveloper
Contributor I

Hello, I'm testing now the Flexcan on SCH-29856Board(I.MAXRT1021DAG5A), using basic example(flexcan_interrupt_transfer). In this example, I separated two part, send and receive, and it works very well to communicate with each other using same ID. However, I want to take all ID message in receive part. That means I want know about part, which filter specific ID, when the message are received. Which part should I change ? Thank you in advance

/* Set Rx Masking mechanism. */
FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, FLEXCAN_RX_MB_STD_MASK(rxIdentifier, 0, 0));

/* Setup Rx Message Buffer. */
mbConfig.format = kFLEXCAN_FrameFormatStandard;
mbConfig.type = kFLEXCAN_FrameTypeData;
mbConfig.id = FLEXCAN_ID_STD(rxIdentifier);
#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

while (true)
{
/* Start receive data through Rx Message Buffer. */
rxXfer.mbIdx = (uint8_t)RX_MESSAGE_BUFFER_NUM;
#if (defined(USE_CANFD) && USE_CANFD)
rxXfer.framefd = &frame;
(void)FLEXCAN_TransferFDReceiveNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXfer);
#else
rxXfer.frame = &frame;
(void)FLEXCAN_TransferReceiveNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXfer);
#endif

0 Kudos
1 Reply

315 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Dongveloper ,

   If you want to take all ID message in receive part. Just don't configure the Filter.

   So, in your code, modify this code :

/* Set Rx Masking mechanism. */
FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, FLEXCAN_RX_MB_STD_MASK(rxIdentifier, 0, 0));

to

FLEXCAN_SetRxMbGlobalMask(EXAMPLE_CAN, 0x0);

As, the original code will configure the filter to just receive your rxIdentifier ID.

The reason is related to this register:

kerryzhou_0-1660028986435.png

So you just need to configure the filter to 0, filter is not care.

You can test it on your side.

If you still have questions about it, please kindly let me know.

Best Regards,

kerry

 

 

 

0 Kudos