cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault debugging on STM32G491RE

mirkoshtylla
Associate II

Hello everyone,

I've added a complex Simulink-generated function to my code which previously used Freertos to read some sensors with I2C in DMA mode and sending messages over CAN.

Unfortunately I'm getting an Hard fault as soon as this function is called.

I'm using STM32Programmer to check the hardfault messages. Is there any way to debug and get any information from these addresses? NVIC Position 14 refers for this microcontroller to DMA Channel 4 despite I'm not using it.

0693W00000JORuFQAX.png

1 REPLY 1

You'd debug it the same way as any other Cortex-M core

Look at the faulting code, C and Assembler views, perhaps pondering why you're accessing a pointer at address 0x406980A3 ? Not ASCII, but perhaps a float, loaded into the pointer, using register R3

Get a listing file of the compiler output, look at the reported PC, and code immediately preceding, and the functions those are in you code/libraries.

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