cancel
Showing results for 
Search instead for 
Did you mean: 

Usage Fault PSP=0x00000020

andrei
Associate II
Posted on October 22, 2017 at 11:18

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-fault
2 REPLIES 2
Posted on October 22, 2017 at 13:19

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 23, 2017 at 13:40

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.