Skip to main content
gauravpathak129
Visitor II
November 6, 2016
Question

Error during SystemClockConfig

  • November 6, 2016
  • 1 reply
  • 558 views
Posted on November 06, 2016 at 16:34

Hello Experts,

I am using stm32L152VBTxA, STM32CubeMX, ST-Link/V2 and System Workbench for STM32.

The Issue that I am facing is whenever I am writing a simple LED blinking code and running it using ST-Link/V2 debugger it runs fine but when I am adding more code to it (u8glib) then it either get stuck in Infinite Loop Default_Handler or Hard Fault occurs during clock initialization when I run it but when I step through the code Clock Initialization goes through but later the code goes to infinite loop Default Handler when I try to access GPIO.

Please provide some insight on how should I debug this issue or what I am doing wrong?

#!stm32
    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    November 6, 2016
    Posted on November 06, 2016 at 21:03

    I've gone over Hard Faults here a lot.. Review the advice given before, because it will be applicable here. Ending up in the default handler suggests you're enabling interrupts you aren't handling. Don't do that. If you are using .CPP/C++ remember it mangles function names, and the Vector Table won't link properly.

    Is the stack large enough? Is the compiler building for the right target? ie RAM size

    Use something more effective than a while(1) loop to diagnose where the fault is, or dig into the stacked state. Review the Cortex Technical Reference Manual, or books by Joseph Yiu.

    Make sure Flash wait states are adequate, consider just letting the system run from the default clock, and not changing it up.

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