Skip to main content
SYLVIA
Associate II
September 26, 2019
Question

Hardfault handler using I2C based Accelerometer

  • September 26, 2019
  • 2 replies
  • 1928 views

When I plug on my device and run my code on the attolic debugger for 1st time my code is working as per my given logic.However if i stop my debugger and then re-run,my program is getting stuck at hardfault.

This topic has been closed for replies.

2 replies

SYLVIA
SYLVIAAuthor
Associate II
September 26, 2019

Please help anyone

Ozone
Principal
September 26, 2019

You provided very little information.

You can:

Use a debugger to find the code line you code hardfaults.

Instrument your code, to do the same without running in the debugger.

Check the values of the SCB registers, to see why it hardfaulted : www.keil.com/appnotes/files/apnt209.pdf

SYLVIA
SYLVIAAuthor
Associate II
September 26, 2019

Basically I am using HAL library.So just after HAL_Init() it is going to hard fault..Since I a very new to embedded coding can you tell What exact information you want?

Ozone
Principal
September 26, 2019

I don't use HAL.

You should be able to step into the HAL_Init() function, down to the line where it faults.

If necessary, you can even switch to disassembly mode in the debugger and single-step to the faulting instruction.