FlexCAN receive all CAN messages on the bus?

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

FlexCAN receive all CAN messages on the bus?

960 Views
nikola1
Contributor I

Hi,

I am trying to receive all messages on CANbus while using example twrke18f_flexcan_interrupt_transfer.

Board is: twr-ke18f.

While all works excellent with one CAN ID, I don't understand what should be configured to get all messages on CAN.

Tried searching for some documentation that would explain it or source or anything... but it all came with nothing.

What kind of function calls or filters or masks should be disabled so that it can receive all message on the CAN.

Here is my code:

txIdentifier = 0x321;
rxIdentifier = 0x123;

FLEXCAN_Init(EXAMPLE_CAN, &flexcanConfig, EXAMPLE_CAN_CLK_FREQ);


/* Create FlexCAN handle structure and set call back function. */
FLEXCAN_TransferCreateHandle(EXAMPLE_CAN, &flexcanHandle, flexcan_callback, NULL);

/* 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);

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


/* Setup Tx Message Buffer. */

FLEXCAN_SetTxMbConfig(EXAMPLE_CAN, TX_MESSAGE_BUFFER_NUM, true);

Thank you for helping out in advance.

Labels (1)
0 Kudos
2 Replies

891 Views
nikola1
Contributor I

Hi,

thank you for helping out, it works!!

BR,

Nikola.

0 Kudos

891 Views
nxf56274
NXP Employee
NXP Employee

Hi,

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

Try to modify "rxIdentifier" to 0.

Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos