2139224_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2139224_en-US

2139224_en-US

How to Retrieve Error Frame CAN ID and Payload in FlexCAN (S32G)

Hi,

I'm using FlexCAN on the S32G platform. Currently, when FlexCAN receives an error frame interrupt, it creates a CAN frame and fills the CAN ID and payload with values from the error register. However, I'm unable to determine which specific CAN frame caused the bus error.

In CANoe, we can see the error frame with the correct CAN ID and payload in the trace window. Is there a way to retrieve the error frame's CAN ID and payload programmatically, similar to CANoe?

I’d appreciate any guidance on this. Thanks in advance!

S32G2 

Re: How to Retrieve Error Frame CAN ID and Payload in FlexCAN (S32G)

hi,ventury

Thank you for your reply.

Why do you want to get the error frame? The error frame will be abandoned in the normal usage scenarios.

If the protocol level frame occurs error, the S32G can get the frame and operate it.  For flexcan, the relevant states register will be changed when S32G receive the error frame.

I think you should consider the kind of error frame. such as, it is the error of CRC on one frame, you can try to check the memory for the frame ID and payload. 

Hope it can help you.

BR

Joey

Re: How to Retrieve Error Frame CAN ID and Payload in FlexCAN (S32G)Hi Joey,
Yes, that is correct. Could you provide some advice on this? Thank you.
BR,
Ventury
Re: How to Retrieve Error Frame CAN ID and Payload in FlexCAN (S32G)

hi,ventury

Thank you for your reply.

Do you mean that when you are using the Flexcan of S32G, you can detect CAN error frames, but you cannot know the ID and payload of this error frame?

BR

Joey

Re: How to Retrieve Error Frame CAN ID and Payload in FlexCAN (S32G)Hi Joey,

Thanks for your response. Here are the details you requested:

Core Type: Using A-core with Linux, kernel version 5.15.119-rt65+
RTD Version: I'm not sure how to check the RTD version in this setup
ID Filter: No ID filter configuration is currently applied

Additional information:
I'm using the Linux SocketCAN framework (can-raw)
Error frame capture is enabled using:
uint32_t errMask = 0xffffffff;
setsockopt(can_fd, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &errMask, sizeof(errMask));
From examining the FlexCAN driver code (flexcan_irq_bus_err function), I can see that error frames are generated using values from the error registers, but I'm not getting the actual CAN ID and payload of the frame that caused the error.

I'd appreciate any guidance on how to retrieve the original offending frame information.

BR
ventury
Re: How to Retrieve Error Frame CAN ID and Payload in FlexCAN (S32G)

hi,ventury

Thank you for contacting us.

are you using M or A core for FlexCAN? Which version of RTD are you using?

Do you have an ID filter for CAN frame?

BR

Joey

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎11-20-2025 04:31 PM
更新者: