RTD 4.0.0p01 FlexCAN with FreeRTOS asserts in OsIfSuspendAllInterrupts()

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

RTD 4.0.0p01 FlexCAN with FreeRTOS asserts in OsIfSuspendAllInterrupts()

Jump to solution
601 Views
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 Kudos
1 Solution
495 Views
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

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

Best regards,

Dan

View solution in original post

6 Replies
591 Views
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 Kudos
496 Views
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

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

Best regards,

Dan

489 Views
nehalp
Contributor III
Yes, that works! Does RTD4 require larger stacks?
0 Kudos
454 Views
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 Kudos
519 Views
nxf78987
NXP Employee
NXP Employee

Hello @nehalp,

Could you send me your project?

Best regards,

Dan

0 Kudos
509 Views
nehalp
Contributor III

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

0 Kudos