HardFault debugging on STM32G491RE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-02-03 8:39 AM
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.
- Labels:
-
DEBUG
-
STM32G4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-02-03 8:45 AM
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.
Up vote any posts that you find helpful, it shows what's working..
