possible "read modify write" issue in flexcan_drv

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

possible "read modify write" issue in flexcan_drv

623 Views
liguangyu02
Contributor II

Dear community,

My platofrm information is S32K144 with S32DS + RTM3.03. 

A fault is reported twice that an TX CANID is missing but other TX CANID is fine. After check my code, I'm sure it caused by function "FLEXCAN_DRV_Send" retuen busy. 

Further more, function "FLEXCAN_SetMsgBuffIntCmd" was noticed: it was called in both ISR and normal routine. However, it's not thread safe as there contain RMW operation like" (base->IMASK1) = ((base ->IMASK1) | (temp));".

So is this RMW operation the root cause of my ID-missing issue?

If so, is there officical patch to fix this issue?

I have checked RTM4.02 and no change on this.

Best Regards,

Guangyu

0 Kudos
3 Replies

565 Views
liguangyu02
Contributor II

Thank you Petr,

I'll do some investigation on RTD.

BR, Guangyu

0 Kudos

607 Views
liguangyu02
Contributor II

This issue was fixed by disable interrupt when doing RMW operation.

liguangyu02_0-1650340184562.png

However, official suggestion is needed.

Thanks!

0 Kudos

585 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

let me reuse words I got from SDK team some time ago....

the SDK driver never was tested as safe thread product. The user if is calling functions that impact shared resources or ReadModifyWrite operations should some how make that safe from perspective of thread call, in RTD this is done by Exclusive Areas in SDK is not the case.

BR, Petr

0 Kudos