cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault in STM32L4S5ZI with IAR

SJant.1
Associate III

Hi ST Community,

I have a project running on STM32L4S5ZI and I use IAR for compiling and flashing of the firmware. My application has a file system (a 16MB flash memory) that is interfaced with the STM32 using an SPI interface. The device also has a webserver running on it and whenever the webserver is accessed, the files will be catered from the file-system which are basically the .stm and .html files.

So the problem is when I access the webserver from a browser in the PC that the device is connected to, the code runs into a Hardfault. This happens only in the Debug mode and if I run in Release mode, there will be no issue.

I tried putting a breakpoint in the Hardfault handler and turns out that this is coming from the SPI transaction complete callback (please find attached the screenshot).

Any thoughts and ideas shall be of great help. Thank you very much!

1 REPLY 1
KDJEM.1
ST Employee

Hello @SJant.1​ ,

Check your stack is large enough.

Make sure variables change under interrupt/callback are volatile where need-be.

I hope this hep you to solve the issue!

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.