- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
We try to implement CAN-FD in interrupt mode based on the example “FlexCAN_Ip_Example_S32K344” which is not that useful since it use loopback and no interrupts.
What we tried to do is :
Create interrupt in IntCtrl_IP : FlexCAN0_1_IRQn , handler : CAN0_ORED_0_31_MB_IRQHandler
In FlexCan modul add callback function : flexcan0_Callback
Install the interrupts (please refere to attached file function FlexCan_Init_Config)
Implement the Callback function : flexcan0_Callback
Modul can send the frames, but the reception is not triggering, can you please verify attached code and let me know what is you thought.
We want to receive Ids from 0x100 to 0x7FF. only STD ids not extended ones
const Flexcan_Ip_EnhancedIdTableType CAN0_EnhanceFIFO_IdFilterTable[1] =
{
{
.filterType = FLEXCAN_IP_ENHANCED_RX_FIFO_RANGE_ID_FILTER,
.isExtendedFrame = false,
.id1 = 0x7FF , // STD ID From
.id2 = 0x100, // STD ID To
.rtr2 = FALSE, // RTR filter
.rtr1 = FALSE, // RTR mask
},
};
Best regards.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi@Kazarian
Please Copy Flexcan.c to your project and try agian, this should be an error caused by accessing temporary variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The hardfault comes if i set the payload in my Can frame to 64 byte , if i set it to whatever other smaller value (32-24-16..) the program run and i can receive frames correctly.
Flexcan_Ip_DataInfoType rx_info = {
.msg_id_type = FLEXCAN_MSG_ID_STD,
.data_length = 64u,
.is_polling = FALSE,
.is_remote = FALSE,
.fd_enable = TRUE,
};
Where should i change so can be able to receive a payload of 64bytes without hardfault ?
Regards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Senlent Thanks a lot this works.
I'm looking to set a range of Standard CAN IDs, for example, from 0x100 to 0x300, without using the enhanced RX FIFO, which only supports 20 CAN FD messages.
Is there a method to achieve this? Alternatively, if that’s not possible, a global mask that would allow the device to accept all IDs would also work for my application.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi@Kazarian
Please refer to this article which is also same with S32K3 mask settings.
https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Register view

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi@Kazarian
This may be related to the number of MB settings you have.
Please provide a complete demo if you encounter problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Senlent
i emailed you the code in private message.
Number of MB is 2, below is the configuration.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Senlent
Thanks a lot for your answer,
The MCU goes to hardfault when i send a can frame from my CAN-Case into the MCU.
i can however send frames from MCU to my Canoe.
i want to set a range of ids not only 1, and im using CAN-FD with 64 bytes, here is init function, can you please update the RX filter and also why the MCU hard fault ?
between im using Freertos i dont know how usefull this info can be !
Flexcan_Ip_StatusType FlexCan_Init_Config(void)
{
Flexcan_Ip_StatusType retVal = E_NOT_OK;
Flexcan_Ip_MsgBuffType rxData;
Flexcan_Ip_DataInfoType rx_info = {
.msg_id_type = FLEXCAN_MSG_ID_STD,
.data_length = 64u,
.is_polling = FALSE,
.is_remote = FALSE,
.fd_enable = TRUE,
};
/* Enable interrupt on CAN 0 */
IntCtrl_Ip_EnableIrq(FlexCAN0_0_IRQn);
IntCtrl_Ip_EnableIrq(FlexCAN0_1_IRQn);
IntCtrl_Ip_EnableIrq(FlexCAN0_2_IRQn);
retVal = FlexCAN_Ip_Init(INST_BOARD_INITPERIPHERALS_FLEXCAN_0, &FlexCAN_BOARD_InitPeripherals_State0, &FlexCAN_Config0_BOARD_InitPeripherals);
retVal |= FlexCAN_Ip_SetRxIndividualMask(INST_BOARD_INITPERIPHERALS_FLEXCAN_0,RX_MB_IDX,0xFFFFFFFF);
retVal |= FlexCAN_Ip_ConfigRxMb(INST_BOARD_INITPERIPHERALS_FLEXCAN_0, RX_MB_IDX, &rx_info, Rx_MSG_ID);
/* Set the FlexCAN instance in START mode */
retVal |= retVal |= FlexCAN_Ip_SetStartMode(INST_BOARD_INITPERIPHERALS_FLEXCAN_0);
retVal |= FlexCAN_Ip_Receive(INST_BOARD_INITPERIPHERALS_FLEXCAN_0,RX_MB_IDX,&rxData,FALSE);
return retVal;
}
Thank you.
