2017-10-22 02:18 AM
Hello,
I have a project with an STM32F446, with RTX, 3 threads (main + 2 declared by me) + of course the idle one. The main thread enters wait state after starting the two threads so i have just two threads running. The RTX has round robin disabled. What the application does is talk to a a Bluetooth module over SPI.
My problem is that sometimes, during the SPI transfer (initiated by one thread and done in the other)the MCU crashes into the UsageFault_Handler and one of the threads (not always the same) is shown to overflow. Now I have read about how to debug the hardfaults and what nots but the problem is that all of the methods rely on MSP/PSP addresses and for me the PSP is 0x00000020.
Anyone ever confronted with something similar? Any ideas on what might be wrong?
Thank you,
Sebastian#cmsis-rtx #spi #stack-overflow #psp #usage-fault2017-10-22 04:19 AM
Looks like something is corrupting the thread context.
Check stack sizes, check depth of current use case.
Watch for DMA being done on local/auto variables.
Add checks on pointers and enable asserts.
Add instrumentation so you understand the flow and sequences common to the failure.
2017-10-23 06:40 AM
Thank you for your answer. One thing that i forgot to mention is that the code worked perfectly without an OS. After I included the RTX, the error keeps appearing every now and then, not at the same time.