I’ve come across a problem when using STM32 HAL library in combination with FreeRTOS. I think my problem is quite basic, but I didn’t find any explanation or solution on the web.
I’ve read the Cortex M Interrupt explanation page (http://www.freertos.org/RTOS-Cortex-M3-M4.html), but this also doesn’t help in my case.
I’m using the ARM_CM4F Port for my STM32F303 Cortex M4F device, FreeRTOS8.2.3 and ST HAL Lib V1.4 for the F3 series. I’ve used the FreeRTOSConfig.h from the STM32F407 example and the one that comes with the HAL package as a starting point (they are the same except for some details). I’ve set up the NVIC to have 4 bit priorities and no subpriorities, as recommendet in the docs.
The problem I’m having is that errorhandling within HAL lib interrupt functions doesn’t work in combination with FreeRTOS.
The HAL lib uses the tick interrupt for FreeRTOS as well as it’s own tick, which is then used to detect internal timeouts. This of course only works if the tick interrupt has a higher priority than the active interrupt.
The default configuration of FreeRTOS is to set the tick interrupt priority to the lowest available priority (configKERNEL_INTERRUPT_PRIORITY). It even states that multiple times in the source code port.c ( xPortStartScheduler - /* Make PendSV and SysTick the lowest priority interrupts. / ; xPortSysTickHandler - / The SysTick runs at the lowest interrupt priority, so when this interrupt executes all interrupts must be unmasked. There is therefore no need to save and then restore the interrupt mask value as its value is already known. */
When I increase the tick priority, errorhandling works as expected. But is this a save way to go?
Thanks for your help!