Skip to main content
Associate
November 7, 2024
Solved

Getting Hardfault with my application

Hello all I am facing a issue my program works however when is executes this part it runs only once after that it ran into hard fault. I have attached the snap of structure part of code which cause it and also exception observation please let me know if you do have any suggestion.

 

devendra_0-1730998040941.pngdevendra_1-1730998061085.jpegdevendra_2-1730998106266.pngdevendra_3-1730998124147.jpeg

 

This topic has been closed for replies.
Andrew Neil
Andrew NeilBest answer
Super User
November 7, 2024

On debugging Hard Faults - both Cortex-M in general, and STM32 in particular:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/708193/highlight/true#M51

 

and please scroll to the top of that thread for how to properly post source code - not as images ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.

3 replies

Andrew Neil
Andrew NeilBest answer
Super User
November 7, 2024

On debugging Hard Faults - both Cortex-M in general, and STM32 in particular:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/708193/highlight/true#M51

 

and please scroll to the top of that thread for how to properly post source code - not as images ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
mƎALLEm
ST Technical Moderator
November 7, 2024

Hello,

Need to read this article on how to debug the hard fault.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Tesla DeLorean
Guru
November 7, 2024

Identify the processor

Show the registers

Show the code (disassembly) at the failure

Reading something from a bad pointer? Misaligned?

https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c

I perhaps need to migrate this to GNU/GCC variant, and g_pfnVectors

 

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..