S32K344 LLD FreeRTOS FlexCAN interrupt issue

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

S32K344 LLD FreeRTOS FlexCAN interrupt issue

478 Views
harryoceana
Contributor II

I'm using freertos and flexcan. In the send function of can(FlexCAN_Ip_Send), FlexCAN_SetMsgBuffIntCmd is called to enable the message buffer interrupt. In the FlexCAN_SetMsgBuffIntCmd function, we call SchM_Enter_Can_43_FLEXCAN_CAN_EXCLUSIVE_AREA_18 fun for Start critical section, This function ends up calling taskEXIT_CRITICAL, which is not interrupt-safe, causing the program to get stuck in the vPortEnterCritical function. What should be set up to avoid this situation?

Attached my project

 

void vPortEnterCritical( void )
{
    portDISABLE_INTERRUPTS();
    uxCriticalNesting++;

    /* This is not the interrupt safe version of the enter critical function so
     * assert() if it is being called from an interrupt context.  Only API
     * functions that end in "FromISR" can be used in an interrupt.  Only assert if
     * the critical nesting count is 1 to protect against recursive calls if the
     * assert function also uses a critical section. */
    if( uxCriticalNesting == 1 )
    {
        configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );
    }
}

 

 

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

453 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the issue is due to taskENTER_CRITICAL() and taskEXIT_CRITICAL() must not be called from an interrupt service routine (ISR) - see taskENTER_CRITICAL_FROM_ISR() and  taskEXIT_CRITICAL_FROM_ISR() for interrupt safe equivalents; https://www.freertos.org/taskENTER_CRITICAL_taskEXIT_CRITICAL.html
This will be fixed in the next RTD releases in the future, as far as I know.

BR, Petr

0 Kudos
Reply