Skip to content

When used with FreeRTOS, lower the interrupt priority for OTG_FS_IRQn#789

Merged
hathach merged 1 commit into
hathach:masterfrom
kapacuk:freertos
Apr 18, 2021
Merged

When used with FreeRTOS, lower the interrupt priority for OTG_FS_IRQn#789
hathach merged 1 commit into
hathach:masterfrom
kapacuk:freertos

Conversation

@kapacuk
Copy link
Copy Markdown
Contributor

@kapacuk kapacuk commented Apr 17, 2021

None of the FreeRTOS examples currently work with STM32F4, they all trigger this assert in lib/FreeRTOS-Kernel/portable/GCC/ARM_CM4F/port.c:

764 configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );

because the interrupt priority for OTG_FS is too high (that is, the value of ucCurrentPriority is too low).

The (almost) correct call to NVIC_SetPriority was commented out in hw/bsp/stm32f4/family.c.

I have a suspicion that other Cortex-M chips might be affected too, but I can only test Seeeduino Xiao and STM32F4 blackpill.

Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for the fix, yeah, this is very common issue when using cortex m with freertos. I have this nvic setprio for most of family, but apparently not all of them. This is downside of having too many boards/ports, that sometime I couldn't do all the hand-on testing on actual hardware

Note: The issue is only occurred if default priority (on reset) of USB is too high, somehow my stmf411disco board work just fine without this patch.

@hathach hathach merged commit d35c92e into hathach:master Apr 18, 2021
@kapacuk kapacuk deleted the freertos branch April 18, 2021 10:34
@kapacuk kapacuk restored the freertos branch April 19, 2021 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants