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

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

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

503件の閲覧回数
ventury
Contributor I

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 

0 件の賞賛
返信
5 返答(返信)

463件の閲覧回数
Joey_z
NXP Employee
NXP Employee

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

0 件の賞賛
返信

443件の閲覧回数
ventury
Contributor I
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
0 件の賞賛
返信

344件の閲覧回数
Joey_z
NXP Employee
NXP Employee

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

0 件の賞賛
返信

340件の閲覧回数
ventury
Contributor I
Hi Joey,
Yes, that is correct. Could you provide some advice on this? Thank you.
BR,
Ventury
0 件の賞賛
返信

327件の閲覧回数
Joey_z
NXP Employee
NXP Employee

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

0 件の賞賛
返信