StCubeMx

STM32CubeIDE osMessagePut in ISR issue

Louiey 2020. 10. 20. 13:48

I used cli function on STM32 platform many years based on STM32CubeMx and CubeIDE.

Recenlty I have a chance to build new project based on F746-DISCO EVM with STM32CubeIDE.

So I ported cli function as I used to and tested via UART as I usaully did...but it get stuck inside of osMesagePut API.

It stucks at port.c/vPortValidateInterruptPriority/configASSERT( ( portAIRCR_REG & portPRIORITY_GROUP_MASK ) <= ulMaxPRIGROUPValue );.

This routine is relates with interrupt priority issue...interrupt priority issue???

I have re-generated based on STM32CubeMx + TrueStudio and tested...it works without issue...??

While some comparison between CubeMX and CubeIDE, I found that "NVIC settings" is not generated in CubeIDE even CubeMx does.

So in UART1 setting menu, if I enabled "NVIC Interrupt", CubeMx generates "Preemption Priority" to "5" but CubeIDE sets "0".

"0" is highest priority interrupt and it looks causes root cause of problem.

To fix this, I should set manually "Preemption Priority" at "/System Core/NVIC/USART1 global interrupt"'s value to "5" and it works as I expected.

CDC function has same issue with UART and could fix with same way above, not sure how many others.

It happened not only osMessagePut but also Signal/Semaphore API.