Dear RTOS Hello,
I am getting started with FreeRTOS on stm32F429 board,
I download the FreeRTOS and, I integrated it into an example from ST respo. I am not using the CubeMx.
The first time I run the FreeRTOS with one static task, it works well.
I am trying to add the timer 5 interrupt and yiel from interrupt. The execution code stop in vPortRaiseBASEPRI function.
I am activating the configASSERT in the FreeRTOSConfig but my program still not working!
The priority is too high if using FreeRTOS calls in this ISR. That’s the reason for the assert.
The choosen prio has to match configMAX_SYSCALL_INTERRUPT_PRIORITY in your FreeRTOSConfig.h
See https://www.freertos.org/RTOS-Cortex-M3-M4.html and mabe also this pretty good picture for details.
OK, so my configMAX_SYSCALL_INTERRUPT_PRIORITY is 5,
My interrupt prio also is 5. It makes sense that my timer interrupt is masked.
In this situation what do you recommend me to do?
I am using the STM32f429 board with cube ide. and cubeMx.
I afraid that’s not yet correct. You should e.g. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
and use the configMAX_SYSCALL_INTERRUPT_PRIORITY macro as done in this demo example:
/* Cortex-M specific definitions. */
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#define configPRIO_BITS 4 /* 15 priority levels */
/* The lowest interrupt priority that can be used in a call to a "set priority"
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
And as far as I remember there is hint in the mentioned FreeRTOS docs regarding using STM32 drivers and NVIC priority grouping.
Sorry - I’m not familiar with cube. But I thought it generates all required files/configs…
So did you finally resolve the problem or are you still stuck ?
If you still having the problem it seems that the xSemaphore is not yet created (NULL) when the ISR is entered 1st time.
You have to ensure that all resources used in ISRs are created and initialized before activating the corresponding interrupt.
In your specific case xSemaphore has to be created before enabling TIMx interrupt
My problem is solved, thank you so much.
The semaphore was declared before the init timer, so the semaphore was null.
The HAL_NVIC_SetPriorityGrouping (NVIC_PRIORITYGROUP_4); call before the scheduler solved the priority issue, I will dig into the details and reading the documentation for more understanding.
Have a nice day.
Thank you massimopanzica,
The STM examples projects are very helpful and very easy to use.
I would like to use CubeMx with cubeIDE and have the ability to add and remove peripherals, change the clock frequency…