CAN-FD Reception Issues on i.MX RT FlexCAN: Unhandled/Overflow at 500 kbps / 2 Mbps

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CAN-FD Reception Issues on i.MX RT FlexCAN: Unhandled/Overflow at 500 kbps / 2 Mbps

213 次查看
Harisha
Contributor I

Hi,

I am working with the i.MX RT1170 board FlexCAN FD module. My setup is:

Board: i.MX RT1170

Clock: 24 MHz

Arbitration phase: 500 kbps, sample point ~82.5 %

Data phase: 2 Mbps, sample point ~80 %

RX message buffers: 8

Payload: 64 bytes

Frame interval: 20 ms

Sending frames from: PEAK CAN interface (using same rates in PCAN-View)

Implementation details:

Using non-blocking RX (FLEXCAN_TransferFDReceiveNonBlocking) and immediately rearming RX MB in the callback

Observed results:

Sometimes fewer frames received than expected (e.g., 900–1243 frames for 64B, ~2000 frames for 8B)

Callback status mostly kStatus_FLEXCAN_UnHandled

Occasionally overflow occurs; once overflow happens, I cannot receive even a single frame afterward

What I tried:

Increasing RX MBs from 5 → 8

Removing all printf or heavy operations from callback

Verifying ISR priority (highest for CAN, no other tasks running)

Testing smaller payloads

Reducing data baud rate (2 Mbps → 1 Mbps)

also i checked for more 100ms and 50 ms and 30ms also its working fine.

Despite all this, I still lose frames and see unhandled or overflow statuses.

my target is to receive frames at 15ms cycle time .

Could someone suggest the exact recommended configuration or best practices to reliably receive all frames without losing data?

0 项奖励
回复
1 回复

182 次查看
mayliu1
NXP Employee
NXP Employee

Hi @Harisha ,

Thank you so much for your interest in our products and for using our community.

Please check the following points.

1. Increase the number of RX mailboxes.
To optimize CANFD message reception, consider increasing the number of RX mailboxes. The relationship between payload size and mailbox count can be found in the i.MX RT1170 Reference Manual.

mayliu1_0-1760668935493.png

2. Clarify where CANFD data is received and processed.
Are you handling CANFD data in a callback function or within a task? It is recommended to keep the callback logic minimal to ensure fast execution and to quickly re-enable reception.

3. Monitor FlexCAN module error and status flags.
Are you checking for FlexCAN errors or abnormal conditions? Use FLEXCAN_GetStatusFlags() to retrieve the current status, and FLEXCAN_ClearStatusFlags() to clear any error flags. 

4. Prioritize CAN interrupts.
Set the CAN interrupt to the highest priority and reduce the priority of other module interrupts.

Wish it helps you.
If you still have question about it, please kindly let me know.

Best Regards
MayLiu

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2187258%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ei.MX%20RT%20FlexCAN%20%E4%B8%8A%E7%9A%84%20CAN-FD%20%E6%8E%A5%E6%94%B6%E9%97%AE%E9%A2%98%EF%BC%9A500%20kbps%20%2F%202%20Mbps%20%E6%97%B6%E6%9C%AA%E5%A4%84%E7%90%86%2F%E6%BA%A2%E5%87%BA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187258%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%82%A8%E5%A5%BD%EF%BC%8C%3C%2FP%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%20i.MX%20RT1170%20%E6%9D%BF%20FlexCAN%20FD%20%E6%A8%A1%E5%9D%97%E3%80%82%E6%88%91%E7%9A%84%E8%AE%BE%E7%BD%AE%E6%98%AF%3C%2FP%3E%3CP%3E%E6%9D%BF%EF%BC%9Ai.MX%20RT1170%3C%2FP%3E%3CP%3E%E6%97%B6%E9%92%9F%EF%BC%9A24%20%E5%85%86%E8%B5%AB%3C%2FP%3E%3CP%3E%E4%BB%B2%E8%A3%81%E9%98%B6%E6%AE%B5%EF%BC%9A500%20kbps%EF%BC%8C%E9%87%87%E6%A0%B7%E7%82%B9%20~82.5%25%3C%2FP%3E%3CP%3E%E6%95%B0%E6%8D%AE%E9%98%B6%E6%AE%B5%EF%BC%9A2%20Mbps%EF%BC%8C%E9%87%87%E6%A0%B7%E7%82%B9%20~80%25%3C%2FP%3E%3CP%3ERX%20%E4%BF%A1%E6%81%AF%E7%BC%93%E5%86%B2%E5%8C%BA%EF%BC%9A8%3C%2FP%3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%94%E4%BC%9A%E5%8F%91%E7%94%9F%E6%BA%A2%E5%87%BA%EF%BC%9B%E4%B8%80%E6%97%A6%E5%8F%91%E7%94%9F%E6%BA%A2%E5%87%BA%EF%BC%8C%E4%B9%8B%E5%90%8E%E6%88%91%E7%94%9A%E8%87%B3%E6%97%A0%E6%B3%95%E6%8E%A5%E6%94%B6%E5%88%B0%E4%B8%80%E4%B8%AA%E5%B8%A7%3C%2FP%3E%3CP%3E%E6%88%91%E7%9A%84%E5%B0%9D%E8%AF%95%3C%2FP%3E%3CP%3E%E5%B0%86%20RX%20MB%20%E4%BB%8E%205%20%E5%A2%9E%E5%8A%A0%E5%88%B0%208%3C%2FP%3E%3CP%3E%E4%BB%8E%E5%9B%9E%E8%B0%83%E4%B8%AD%E7%A7%BB%E9%99%A4%E6%89%80%E6%9C%89%20printf%20%E6%88%96%E9%87%8D%E5%9E%8B%E6%93%8D%E4%BD%9C%3C%2FP%3E%3CP%3E%E9%AA%8C%E8%AF%81%20ISR%20%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%88CAN%20%E6%9C%80%E9%AB%98%EF%BC%8C%E6%97%A0%E5%85%B6%E4%BB%96%E4%BB%BB%E5%8A%A1%E8%BF%90%E8%A1%8C%EF%BC%89%3C%2FP%3E%3CP%3E%E6%B5%8B%E8%AF%95%E8%BE%83%E5%B0%8F%E7%9A%84%E6%9C%89%E6%95%88%E8%BD%BD%E8%8D%B7%3C%2FP%3E%3CP%3E%E9%99%8D%E4%BD%8E%E6%95%B0%E6%8D%AE%E6%B3%A2%E7%89%B9%E7%8E%87%EF%BC%882%20Mbps%20%E2%86%92%201%20Mbps%EF%BC%89%3C%2FP%3E%3CP%3E%E6%88%91%E8%BF%98%E6%A3%80%E6%9F%A5%E4%BA%86%E6%9B%B4%E5%A4%9A%E7%9A%84%20100%20%E6%AF%AB%E7%A7%92%E3%80%8150%20%E6%AF%AB%E7%A7%92%E5%92%8C%2030%20%E6%AF%AB%E7%A7%92%EF%BC%8C%E6%95%88%E6%9E%9C%E4%B9%9F%E5%BE%88%E5%A5%BD%E3%80%82%3C%2FP%3E%3CP%3E%E5%B0%BD%E7%AE%A1%E5%A6%82%E6%AD%A4%EF%BC%8C%E6%88%91%E8%BF%98%E6%98%AF%E4%BC%9A%E4%B8%A2%E5%A4%B1%E5%B8%A7%EF%BC%8C%E5%B9%B6%E7%9C%8B%E5%88%B0%E6%9C%AA%E5%A4%84%E7%90%86%E6%88%96%E6%BA%A2%E5%87%BA%E7%8A%B6%E6%80%81%E3%80%82%3C%2FP%3E%3CP%3E%E6%88%91%E7%9A%84%E7%9B%AE%E6%A0%87%E6%98%AF%E4%BB%A5%2015%20%E6%AF%AB%E7%A7%92%E7%9A%84%E5%91%A8%E6%9C%9F%E6%97%B6%E9%97%B4%E6%8E%A5%E6%94%B6%E5%B8%A7%E3%80%82%3C%2FP%3E%3CP%3E%E6%98%AF%E5%90%A6%E6%9C%89%E4%BA%BA%E8%83%BD%E6%8F%90%E4%BE%9B%E5%87%86%E7%A1%AE%E7%9A%84%E5%BB%BA%E8%AE%AE%E9%85%8D%E7%BD%AE%E6%88%96%E6%9C%80%E4%BD%B3%E5%81%9A%E6%B3%95%EF%BC%8C%E4%BB%A5%E4%BE%BF%E5%9C%A8%E4%B8%8D%E4%B8%A2%E5%A4%B1%E6%95%B0%E6%8D%AE%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E5%8F%AF%E9%9D%A0%E5%9C%B0%E6%8E%A5%E6%94%B6%E6%89%80%E6%9C%89%E5%B8%A7%EF%BC%9F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2187258%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3E%E9%80%9A%E4%BF%A1%26amp%3B%20%E6%8E%A7%E5%88%B6%EF%BC%88I3C%20%7C%20I2C%20%7C%20SPI%20%7C%20FlexCAN%20%7C%20%E4%BB%A5%E5%A4%AA%E7%BD%91%20%7C%20FlexIO%EF%BC%89%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2187913%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CAN-FD%20Reception%20Issues%20on%20i.MX%20RT%20FlexCAN%3A%20Unhandled%2FOverflow%20at%20500%20kbps%20%2F%202%20Mbps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187913%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E5%97%A8%EF%BC%8C%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253824%22%20target%3D%22_blank%22%3E%40Harisha%3C%2FA%3E%E3%80%81%3C%2FP%3E%0A%3CP%3E%E9%9D%9E%E5%B8%B8%E6%84%9F%E8%B0%A2%E6%82%A8%E5%85%B3%E6%B3%A8%E6%88%91%E4%BB%AC%E7%9A%84%E4%BA%A7%E5%93%81%E5%B9%B6%E4%BD%BF%E7%94%A8%E6%88%91%E4%BB%AC%E7%9A%84%E7%A4%BE%E5%8C%BA%E3%80%82%3C%2FP%3E%0A%3CP%3E%E8%AF%B7%E6%A3%80%E6%9F%A5%E4%BB%A5%E4%B8%8B%E5%87%A0%E7%82%B9%E3%80%82%3C%2FP%3E%0A%3CP%3E1.%E5%A2%9E%E5%8A%A0%20RX%20%E9%82%AE%E7%AE%B1%E6%95%B0%E9%87%8F%E3%80%82%3CBR%20%2F%3E%E8%A6%81%E4%BC%98%E5%8C%96%20CANFD%20%E6%8A%A5%E6%96%87%E6%8E%A5%E6%94%B6%EF%BC%8C%E5%8F%AF%E8%80%83%E8%99%91%E5%A2%9E%E5%8A%A0%20RX%20%E9%82%AE%E7%AE%B1%E7%9A%84%E6%95%B0%E9%87%8F%E3%80%82%E6%9C%89%E6%95%88%E8%B4%9F%E8%BD%BD%E5%A4%A7%E5%B0%8F%E5%92%8C%E9%82%AE%E7%AE%B1%E6%95%B0%E9%87%8F%E4%B9%8B%E9%97%B4%E7%9A%84%E5%85%B3%E7%B3%BB%E5%8F%AF%E4%BB%A5%E5%9C%A8%20i.MX%20RT1170%20%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C%E4%B8%AD%E6%89%BE%E5%88%B0%E3%80%82%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mayliu1_0-1760668935493.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mayliu1_0-1760668935493.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F361293iD4EF2B8DEFA376B9%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mayliu1_0-1760668935493.png%22%20alt%3D%22mayliu1_0-1760668935493.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E2.%E6%98%8E%E7%A1%AE%E6%8E%A5%E6%94%B6%E5%92%8C%E5%A4%84%E7%90%86%20CANFD%20%E6%95%B0%E6%8D%AE%E7%9A%84%E5%9C%B0%E7%82%B9%E3%80%82%3CBR%20%2F%3E%E6%82%A8%E6%98%AF%E5%9C%A8%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0%E4%B8%AD%E8%BF%98%E6%98%AF%E5%9C%A8%E4%BB%BB%E5%8A%A1%E4%B8%AD%E5%A4%84%E7%90%86%20CANFD%20%E6%95%B0%E6%8D%AE%EF%BC%9F%E5%BB%BA%E8%AE%AE%E5%B0%BD%E9%87%8F%E5%87%8F%E5%B0%91%E5%9B%9E%E8%B0%83%E9%80%BB%E8%BE%91%EF%BC%8C%E4%BB%A5%E7%A1%AE%E4%BF%9D%E5%BF%AB%E9%80%9F%E6%89%A7%E8%A1%8C%E5%92%8C%E5%BF%AB%E9%80%9F%E9%87%8D%E6%96%B0%E5%90%AF%E7%94%A8%E6%8E%A5%E6%94%B6%E3%80%82%3C%2FP%3E%0A%3CP%3E3.%E7%9B%91%E6%B5%8B%20FlexCAN%20%E6%A8%A1%E5%9D%97%E9%94%99%E8%AF%AF%E5%92%8C%E7%8A%B6%E6%80%81%E6%A0%87%E5%BF%97%E3%80%82%3CBR%20%2F%3E%E6%82%A8%E6%98%AF%E5%90%A6%E5%9C%A8%E6%A3%80%E6%9F%A5%20FlexCAN%20%E9%94%99%E8%AF%AF%E6%88%96%E5%BC%82%E5%B8%B8%E6%83%85%E5%86%B5%EF%BC%9F%E4%BD%BF%E7%94%A8%20FLEXCAN_GetStatusFlags()%20%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E7%8A%B6%E6%80%81%EF%BC%8C%E5%B9%B6%E4%BD%BF%E7%94%A8%20FLEXCAN_ClearStatusFlags()%20%E6%B8%85%E9%99%A4%E4%BB%BB%E4%BD%95%E9%94%99%E8%AF%AF%E6%A0%87%E8%AE%B0%E3%80%82%20%3C%2FP%3E%0A%3CP%3E4.%E7%A1%AE%E5%AE%9A%20CAN%20%E4%B8%AD%E6%96%AD%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E3%80%82%3CBR%20%2F%3E%E5%B0%86%20CAN%20%E4%B8%AD%E6%96%AD%E8%AE%BE%E7%BD%AE%E4%B8%BA%E6%9C%80%E9%AB%98%E4%BC%98%E5%85%88%E7%BA%A7%EF%BC%8C%E9%99%8D%E4%BD%8E%E5%85%B6%E4%BB%96%E6%A8%A1%E5%9D%97%E4%B8%AD%E6%96%AD%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E3%80%82%3C%2FP%3E%0A%3CP%3E%E5%B8%8C%E6%9C%9B%E5%AE%83%E8%83%BD%E5%B8%AE%E5%88%B0%E4%BD%A0%E3%80%82%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%E6%82%A8%E8%BF%98%E6%9C%89%E7%96%91%E9%97%AE%EF%BC%8C%E8%AF%B7%E5%91%8A%E8%AF%89%E6%88%91%E3%80%82%3C%2FP%3E%0A%3CP%3E%E6%95%AC%E4%B8%8A%3CBR%20%2F%3EMayLiu%3C%2FP%3E%3C%2FLINGO-BODY%3E