STM32F405 Feather with FreeRTOS Hard Fault Issue

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cversek
 
Posts: 9
Joined: Mon Sep 17, 2012 12:46 pm

STM32F405 Feather with FreeRTOS Hard Fault Issue

Post by cversek »

Hi, I am cross-posting this issue because I seem to be testing the patience of ST's support there:
https://github.com/stm32duino/STM32FreeRTOS/issues/63

Basically to summarize: on the STM32F405 Feather, I would like to use the STM32duino/FreeRTOS library AND have working USB Serial support along with some pin interrupts. When I do so under certain circumstances, even really basic setups that are not directly calling into the FreeRTOS API, the system winds up in a hard fault handler. My guess is this probably from heap or stack corruption (possibly from incompatible interrupt priorities in the Serial USB code?), but I'm not qualified to tell for sure.

Any help would be much appreciated.
- Craig

User avatar
cversek
 
Posts: 9
Joined: Mon Sep 17, 2012 12:46 pm

Re: STM32F405 Feather with FreeRTOS Hard Fault Issue

Post by cversek »

Update: I've made some progress, it seems that the STM32duino default USB Serial driver settings do have interrupts with too high a priority (too low in number) to be compatible with the default range of FreeRTOS interrupt priorities (5 through 14/15). (Please check the referenced Github issue for details.) Now this confused me because I didn't understand how the USB driver could interact with FreeRTOS which is not a dependency, but it seems like it might be due to some heap state sharing issues in the C standard library (Newlib) that only become a problem when the RTOS is introduced. I'd certainly like to learn more about the underlying problem though.

I hope this post will help people like me running into similar issues, because configuring FreeRTOS is a steep learning curve coming from the Arduino side where things just work and you usually don't run into memory corruption bugs.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”