cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476RG. I write 70bytes to an SD card (8GB) using SDIO 4-bit mode every 5-seconds. After exactly 390 writes the program jumps to the HardFault loop. If I remove the SD card the program runs forever so the problem is definitely the SD loop.

Graham1904
Associate III
 
6 REPLIES 6

Debug HardFault as usually - trace back from stack the offending instructions/data, best observed in disasm.

"SD loop" is *your* program, regardless of whether you used some "library" or not.

JW

Graham1904
Associate III

Thanks for your reply. I appreciate that the "SD Loop" is my loop, regardless of library usage, I was mearly pointing out that this is whare the HardFault_Handler problem was being generated. My question was really how do I find out what the problem is?

https://stackoverflow.com/questions/53253652/debugging-a-hard-fault-in-arm-cortex-m4

Clive wrote about debugging hardfault many times on this forum, too; try searching.

JW

Ozone
Lead II

And as other threads about hardfaults mention, the SCB fault registers should tell you about reason and location.

[shameless self-plug] fault registers cheatsheet [/shameless self-plug]

JW