RTD 4.0.0p01 FlexCAN with FreeRTOS asserts in OsIfSuspendAllInterrupts()

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

RTD 4.0.0p01 FlexCAN with FreeRTOS asserts in OsIfSuspendAllInterrupts()

跳至解决方案
720 次查看
nehalp
Contributor III

The FlexCAN driver in RTD4.0.0p01 hits an assert in FreeRTOS vPortEnterCritical().

When processing a CAN Tx complete interrupt, the device hangs. After halting, this is the observed call stack:

nehalp_0-1703116897753.png

SchM_Enter_Can_43_FLEXCAN_CAN_EXCLUSIVE_AREA_18() is invoking OsIf_SuspendAllInterrupts(), which in previous versions of RTD was ultimately an asm "cspid i" instruction.

In RTD4.0.0, this is now as follows:

nehalp_1-1703117036982.png

Which hits this configASSERT() because it has been invoked in an interrupt context:
configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );

portNVIC_INT_CTRL_REG is 0x447b87e  (in the middle of handling interrupt 0x7E).

 

0 项奖励
1 解答
614 次查看
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

Could you try to configure Minimal Stack Size equal to 512 and re-test?

Best regards,

Dan

在原帖中查看解决方案

6 回复数
710 次查看
nehalp
Contributor III

Making this change (and only this change) avoids the configASSERT and allows the application (a port of the MR-CANHUBK344 demo app to RTD4.0.0) to create and send and receive CAN and Ethernet messages.

In OsIf_Internal.h at line 245:

nehalp_0-1703118254090.png

 

0 项奖励
615 次查看
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

Could you try to configure Minimal Stack Size equal to 512 and re-test?

Best regards,

Dan

608 次查看
nehalp
Contributor III
Yes, that works! Does RTD4 require larger stacks?
0 项奖励
573 次查看
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

Yes, interrupt handler function of RTD request stack size larger than default configuration of FreeRTOS.

Best regards,

Dan

0 项奖励
638 次查看
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

Could you send me your project?

Best regards,

Dan

0 项奖励
628 次查看
nehalp
Contributor III

Attached here, minus the RTD folder, so you'll have to include your own.

0 项奖励