ECU jump into hard fault if receive frame in polling mode

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

ECU jump into hard fault if receive frame in polling mode

1,676 次查看
yin_qiu
Contributor III

dear NXP experts:

I met a problem that ECU will jump into Hard fault if ECU receive CAN frame in polling mode .

I take use of EB driver(SW32K3_S32M27x_RTD_R21-11_4.0.0_P04) and set Can_43_FLEXCAN_MainFunction_Read() in 10ms task.

 ECU would be easily jump into hard fault. if I send frame by CANOE cycle or manually.

if I put  Can_43_FLEXCAN_MainFunction_Read() in while(1), ECU can successfully receive CAN frame for a long time. but I can not sure ECU will not jump into hard fault for ever.

I try to

 

debug this problem and I suspect the function "FlexCAN_StartRxMessageBufferData" that each time ECU jump into trap the "else branch " can not be executed like the snapshot.

yin_qiu_0-1735281310601.png

do you have any suggestion about this problem thank you .

标记 (1)
0 项奖励
回复
6 回复数

1,567 次查看
yin_qiu
Contributor III

屏幕截图 2025-01-03 132755.png

 

hello I take a reference of a Mcal code of previous version there is a "static" there. but there is no  "static" in SW32K3_S32M27x_RTD_R21-11_4.0.0_P04

0 项奖励
回复

1,482 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @yin_qiu,

The static keyword was added in order to prevent multiple thread call overlap over the same variable in multi-threaded situations.

As for the original issue, are you trying to receive the CAN frames with interrupts, when not using polling? Or are you simply running the task each 10 ms?  

Best regards,
Julián

0 项奖励
回复

1,470 次查看
yin_qiu
Contributor III

dear NXP expert:

thank you pretty much.

yes I try to take use of interrupt feature in frame reception ,it works OK.

I also put function Can_43_FLEXCAN_MainFunction_Read() in while(1), it also works ok. by  the way ,here the OK in while(1) should not be defined totally OK.

if the function Can_43_FLEXCAN_MainFunction_Read() is called in 10ms task, ECU will go hardfault if I send frame by CANOE.

标记 (1)
0 项奖励
回复

1,424 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @yin_qiu,

I believe it may be a re-entry issue when invoking the read function when already reading. Could you give more information about your application? Is there a reason you cannot use either polling or interrupts? Since both of these work ok as of now.

Best regards,
Julián

0 项奖励
回复

1,654 次查看
yin_qiu
Contributor III

hardfault初步修改方案.png

 

I add a code here ,but I'm not sure it is correct.

0 项奖励
回复

1,587 次查看
yin_qiu
Contributor III

dear NXP experts:

I did some debug for this problem and I have some information to share and confirm with you.

pls check the picture below and you can see that the data (0x01~0x07)has been accepted by mailbox but the sdu address of upper layer is not share the same address with pMBmessage.

image004(01-02-15-36-29).png

I debug the code and find that the pMBmessage is initialized by the code below:

image002(01-02-15-36-29).jpgimage001(01-02-15-36-29).jpg

if I set polling mode for CAN receive .the upper layer parse is done as the code below:

How can we guarantee the address of "ReceivedDataBuffer" is still keep the same as the initialized address of pMBmessage because the ReceivedDataBuffer is a local variable.

image003(01-02-15-36-29).png

标记 (1)
0 项奖励
回复