cancel
Showing results for 
Search instead for 
Did you mean: 

After erasing internal flash using st link utility when i will start storing sum data into internal flash it is going to be in hard-fault.

MGami.1
Associate III

Hello Everyone,

We are working on STM32F413RH. We are storing sum data into internal flash at some interval of time. Simple mechanism is used, first we are erasing sector and then we are writing our data into internal flash.

But when we are erasing chip via ST link utility and try to store our data, we are getting hard-fault.

Please help us regarding the same.

Thanks and Regards

Milan

1 ACCEPTED SOLUTION

Accepted Solutions

Try to debug hardfault as usually, i.e. observe stacked values of registers, mainly PC; observe code in disasm/mixed with source, in vicinity (previously to) the address in the stacked PC; observing registers content estimate which instruction caused the problem and trace it back to C source variables content.

JW

View solution in original post

7 REPLIES 7

I don't understand - fault is result of program running, but when you're programming using STLink, program does not run, so how comes the fault?

JW

ErVaibhavS
Associate III

Kindly Share your code in which you are facing Problem !!!

We are doing below steps.

1) Load working program and check all the things that it is working properly or not. At the time of writing into internal Flash no error we are found.

2) After checking first step, we checked by connecting on st-link utility that whatever data we are writing into internal flash is stored or not? We successfully got our data and confirm that.

3) After second step we are erasing chip from ST-Link utility. and disconnect from st link utility.

4) Now again we start from first step (by loading same program) but we are getting hard-fault.

Thanks for your reply.

Sorry I can't share code because it is in system where i can not share anything.

We are doing below steps for your information.

1) Load working program and check all the things that it is working properly or not. At the time of writing into internal Flash no error we are found.

2) After checking first step, we checked by connecting on st-link utility that whatever data we are writing into internal flash is stored or not? We successfully got our data and confirm that.

3) After second step we are erasing chip from ST-Link utility. and disconnect from st link utility.

4) Now again we start from first step (by loading same program) but we are getting hard-fault.

Thanks for your reply.

Try to debug hardfault as usually, i.e. observe stacked values of registers, mainly PC; observe code in disasm/mixed with source, in vicinity (previously to) the address in the stacked PC; observing registers content estimate which instruction caused the problem and trace it back to C source variables content.

JW

You'll have to debug your own code.

Sanity check pointers, that you aren't accessing 0xFFFFFFFF.

Make sure you're not erasing running code.

Have a Hard Fault Handler that outputs actionable data, reports the registers and inspect the disassembly at the fault.​

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

Thanks for your reply.

As per your suggestion we have checked on dis-assembly window. And we found that due to UART peripheral we are accessing NULL address.

That is the reason we are getting hard-fault.

Thanks