cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault inside System Init - STM32L151CBUxA

gkowshik
Associate II

I am trying to run a code that's built using STM32L1x_Peripheral Libs for STM32L151CBUxA MCU.

As soon as I run the SystemInit function inside the ResetHandler I am hitting a Hardfault, so I investigated the SystemInit function.

Once the Vector Table relocation function is executed in it a HardFault is caused. I am unsure how to debug or resolve this.

gkowshik_0-1727875652572.png

Please help me debug the code.

6 REPLIES 6
SHs
ST Employee

Hello @gkowshik ,

Could you please provide your source code file or direct me to the example you are currently working on in order to investigate the issue on my side ?

 

With regards,

Please close this topic by clicking on “Accept as solution" button if it fully answered your question.

Hi @SHs ,

I am using a custom code, I am porting nRF8001 BLE library, I can attach the zip of my code here. I believe the hardfault is coming from the SystemInit function especially.

I did some digging into the hard fault and found the obvious instruction that's causing it i.e., the nop instruction right after the SystemInit function is executed (shown in the picture in previous reply). I need expert help to root cause it better.

Thanks

SHs
ST Employee

Hello @gkowshik ,

I have checked with the FSMC_SRAM_DataMemory example and can confirm that a hard fault occurs during the execution of the SystemInit function.

An internal ticket 192898 has been submitted for a detailed investigation. Please note that this tracking number is for internal use only and is not accessible to customers.

Thank you for bringing this to our attention.

 

With regards,

Please close this topic by clicking on “Accept as solution" button if it fully answered your question.

Hi @SHs 

Thanks for confirming this. Will await for an expert to come back on this, can you add a higher priority on this bug as this stops us from reaching the main function and cannot proceed to develop our application code.

Thanks


@gkowshik wrote:

I am porting nRF8001 BLE library,


Wow - there's a blast from the past!!

Anyhow, on debugging Hard Faults:

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

 

gkowshik
Associate II

@Andrew Neil Oh thanks for this man, but sadly I have already gone through your article, tried it out, root caused the instruction but I don't know WHY that instruction is causing the fault and how to resolve it. 

When I said "I did some digging into the hard fault", I did it by following your article itself hahaha. That was very nice and detailed but it didn't resolve my problem.

Thanks,

G Kowshik