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.
do you have any suggestion about this problem thank you .
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
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.
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
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.
I debug the code and find that the pMBmessage is initialized by the code below:
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.