FreeRtos function vPortEnterCritical Assert stuck,
FreeRTOSConfig.h configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY Set 1
BASEPRI Register VALUE
this moment VECTACTIVE Register Value 3
Why?
freeRtos critical Function does not work
Tell me what should i do?
Hi @runningostrich ,
I highly recommend to get familiar with the ARM Cortex interrupt system in combination with FreeRTOS, an article series I wrote a while back:
https://mcuoneclipse.com/2016/08/14/arm-cortex-m-interrupts-and-freertos-part-1/
https://mcuoneclipse.com/2016/08/20/arm-cortex-m-interrupts-and-freertos-part-2/
https://mcuoneclipse.com/2016/08/28/arm-cortex-m-interrupts-and-freertos-part-3/
The assertion you hit is because you are calling vPortEnterCritical() from an interrupt context which is not allowed, hence the assertion. You need to check the call chain in the debugger to see from where this is coming from. BASEPRI/configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY is used for something different: separating the interrupts into 'RTOS-ones' from 'non-RTOS' ones. I would question why you would set the BASEPRI to 1 as this does not leave you much moving space for interrupt prioritites, but this is yet another discussion. For the complete picture, see above articles.
I hope this helps,
Erich
Hi @runningostrich :
Please note that the BASEPRI will be configured to configMAX_SYSCALL_INTERRUPT_PRIORITY only if task enter into critical section. and BASEPRI will be reconfigured to 0 if task exit critical section.
You can trace the BASEPRI register after below line is hit.
taskENTER_CRITICAL();
Regards
Daniel