Hello guys, am experiencing a bus fault while using stm32f407 board, it happens more often when i use the uart peripheral(Usart6) of the MCU.
I can’t seem to wrap my head around the cause, or trace the routine causing the fault. I have increased the stack and heaps of the tasks am working with.
Is there a way to find the root cause of the problem. I’m totally a newbie
and also, i’ll like to note that am using sprintfs to build strings of characters am working with.
Please help.
Check the forum for the following common issues:
- Stack overflow (see
configCHECK_FOR_STACK_OVERFLOW).
- Cortex M interrupt priority configuration (and making sure
configASSERT() is defined in a way to help FreeRTOS catch and report these kinds of config errors)
- Malloc failures (heap not big enough) going unnoticed
In general for the above issues, FreeRTOS has some provisions to help you catch them before they cause a difficult-to-diagnose fault condition.
Assuming you are using newlib, have you set configUSE_NEWLIB_REENTRANT? Have you made malloc (used internally by newlib) threadsafe – typically by providing __malloc_lock() and __malloc_unlock() functions? If you are using printf with floats from more than one FreeRTOS task you will definitely need to do these things (or other solution).
See the article at Debugging and diagnosing hard faults on ARM Cortex-M CPUs to see how to add code to show you where the bus fault is occurring.