Hello,
I am working on the CM7 part of a iMX8 processor and i am trying to create a FDCAN library
In my old project, made on a STM32H7, there were two type of can filters: MASK and RANGE
I am using FLEXCAN drivers from the folder SDK_2_13_0_MIMX8ML8xxxLZ\devices\MIMX8ML8\drivers of the SDK generated by the NXP SDK builder
So my question: How to create a CAN filter of type RANGE, a filter that accepts CAN id arbiters from a value to another, excluding all others from reception?
Thank you
Hi Dhruvit, so the simple answer is:
No, there isn't a way to do a CAN filter of type RANGE using only CAN peripheral, i have to make a filter of type MASK and then correct any unwanted messages filtering them by Firmware
Thanks & Regards,
Lorenzo
Hi @Lornix,
If one wants to create a CAN filter type of RANGE then one should use the global mask to create a CAN filter type of RANGE FLEXCAN_SetRxMbGlobalMask, which is used to receive a range of Tx_ids. FLEXCAN_SetRxIndividualMask will filter the rx_MBs.
for more details please refer to the link I have shared.
https://mcuxpresso.nxp.com/
https://mcuxpresso.nxp.com/
Thanks & Regards,
Dhruvit Vasavada
Hi @Lornix,
I hope you are doing well.
The CAN frames are filtered using an Identifier or a range of identifiers. So one can set an individual mask or else a global mask to filter out the message that one wants to have at the receiver end.for that one has to follow the below sequence for filtering purposes.
Receive node end
* flexcan_handle_t g_sFlexcanHandle;
* flexcan_config_t sFlexcanConfig;
* flexcan_fd_config_t sFDConfig;
* FLEXCAN_GetDefaultConfig(&
* FLEXCAN_GetFDDefaultConfig(&
* FLEXCAN_
* &sFlexcanConfig.psFDConfig->
* sFlexcanConfig.psFDConfig->
* sFlexcanConfig.psFDConfig = &sFDConfig;
* // Module initialization
* FLEXCAN_Init(CAN, &sFlexcanConfig);
* // Set up send transfer configuration
* flexcan_mb_transfer_t g_sTxXfer;
* flexcan_frame_t g_sFrame;
* // Create FlexCAN handle structure and set call back function.
* FLEXCAN_TransferCreateHandle(
* // Set Rx Masking mechanism.
* FLEXCAN_SetRxMbGlobalMask(
* // Setup Rx Message Buffer.
* sRxMbConfig.eFormat = kFLEXCAN_FrameFormatStandard;
* sRxMbConfig.eType = kFLEXCAN_FrameTypeData;
* sRxMbConfig.u32Id = FLEXCAN_ID_STD(g_
* // Clean Rx Message Buffer.
* FLEXCAN_SetFDRxMbConfig(CAN, RX_MESSAGE_BUFFER_NUM, &sRxMbConfig, true);
* g_sTxXfer.u8MsgBufIdx = (uint8_t)RX_MESSAGE_BUFFER_
* g_sTxXfer.psFrameFD = &g_sFrame;
* // Receive node interrupt transfer
* FLEXCAN_
for more details please refer to the link I have shared.
https://mcuxpresso.nxp.com/
https://mcuxpresso.nxp.com/
Thanks & Regards,
Dhruvit Vasavada