cancel
Showing results for 
Search instead for 
Did you mean: 

configuring isr with cmsis rtos v2, debug trace lands at configASSERT funtion call

dr3vo
Associate

Hello!

What im trying to acomplish, is to trigger a task with external interrupt.

I am trying to "unblock" the ButtonInput thread with a thread flag, to print "button pressed",
however when I press the button, the interrupt is called ... (i get "OK" output in conosle), but the printf statement in ButtonInput thread is then not executed.

Instead the debuger kindof stalls (affter flag release) and when I pause it, the debug trace lands on  configASSERT funtion call, where a comment tells me i need to set the exti priority to configMAX_SYSCALL_INTERRUPT_PRIORITY, so that isr doesnt interfear with the freertos kernel.
I did that and the tracer still lands on cofnigASSERT function call.
Any advice, or suggestions of better ways of getting this to work would be much appreciated :)

My implementation bellow ...

-------------------------------------------------------
this is my thread definition:

osThreadId_t buttonInputHandle;

const osThreadAttr_t buttonInput_attributes = { .name = "buttonInput",
                                                                           .priority = (osPriority_t) osPriorityNormal,
                                                                           .stack_size = 128 * 4
                                                                          };

void ButtonInput(void *argument)
{
    for (;;) {

        osThreadFlagsWait(0x01, osFlagsWaitAny, osWaitForever);
        printf("Button pressed\n");

    }
    osThreadTerminate(NULL);
}

-------------------------------------------------------
and this is the exti callback:

void EXTI15_10_IRQHandler(void)
{
    /* USER CODE BEGIN EXTI15_10_IRQn 0 */

    /* USER CODE END EXTI15_10_IRQn 0 */
    if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_14) != RESET)
    {
        LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_14);
        /* USER CODE BEGIN LL_EXTI_LINE_14 */
        printf("ESC\n");
        /* USER CODE END LL_EXTI_LINE_14 */
     }
    if (LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_15) != RESET)
    {
        LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_15);
        /* USER CODE BEGIN LL_EXTI_LINE_15 */
        printf("OK\n");
        static uint32_t last_press_time = 0;
        uint32_t current_time = HAL_GetTick();
        if (current_time - last_press_time > 100) {
        last_press_time = current_time;
        osThreadFlagsSet(buttonInputHandle, 0x01);

       /* USER CODE END LL_EXTI_LINE_15 */
      }
/* USER CODE BEGIN EXTI15_10_IRQn 1 */
/* USER CODE END EXTI15_10_IRQn 1 */
}

-------------------------------------------------------
i have both pc15 and pc14 button set as exti in gpio configuration.

/**/
EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_14;
EXTI_InitStruct.LineCommand = ENABLE;
EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_FALLING;
LL_EXTI_Init(&EXTI_InitStruct);

/**/
EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_15;
EXTI_InitStruct.LineCommand = ENABLE;
EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_FALLING;
LL_EXTI_Init(&EXTI_InitStruct);


-------------------------------------------------------
and the priorities i have set to the suggested one

NVIC_SetPriority(EXTI9_5_IRQn, configMAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_EnableIRQ(EXTI9_5_IRQn);
NVIC_SetPriority(EXTI15_10_IRQn, configMAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_EnableIRQ(EXTI15_10_IRQn);

 

@Zt Liu I hope it doesn't bother you, I came across a post of similar topic, in which you provided a solution.

2 REPLIES 2
nouirakh
ST Employee

Hello @dr3vo 

Please specify the STM32 product you are utilising, and could you please provide further details on your configuration project.
If feasible, please attach your .ioc file?

Don't call printf() from an interrupt handler.

Your task stack may be too small to handle the printf().