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:
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:
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).
已解决! 转到解答。
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: