cancel
Showing results for 
Search instead for 
Did you mean: 

Developing with Sensors Made Simple MOOC - Lab 3. After running past the first breakpoint, program stops with hard fault on line 84! void HardFault_Handler(void)

JTrez.1
Associate II

Tried redoing the project several times - other labs seem to work

9 REPLIES 9
Eleon BORLINI
ST Employee

Hi @JTrez.1​ , do you refer to this section of the training? --> https://www.youtube.com/watch?v=88exXyZ6zxQ&list=PLnMKNibPkDnGsEvFISX3zEb23vLwl8qoN&index=3 can you please be more specific about the project you are referring to? Regards

JTrez.1
Associate II

Thanks for the reply. Lab 3 is in the 7th video - Part 7: Lab 3 - LSM6DO XL embedded step counter

https://www.youtube.com/watch?v=DHt9lPjgOIk&list=PLnMKNibPkDnGsEvFISX3zEb23vLwl8qoN&index=7

Let me know if you need sections of the generated code.

JTrez.1
Associate II

Update - I redid the Lab from scratch in a new folder with a new name and was able to get it to work. Eventually it did fail again with a hard fault on line 84! It ran again later on after disconnecting usb and restarting the debugger. I am thinking this might be a hardware issue on my board.

JMors.1
Associate III

Can you post any of the debug error data that you are getting when the error is seen? Perhaps from the Console or Debugger Console output?

JTrez.1
Associate II

The problem occurs intermitently now. I captured output from the debugger console when it failed:

Temporary breakpoint 1, main () at ../Core/Src/main.c:75

75    HAL_Init();

Program received signal SIGTRAP, Trace/breakpoint trap.

HardFault_Handler () at ../Core/Src/stm32l4xx_it.c:84

84   {

line 83 is: void HardFault_Handler(void)

JMors.1
Associate III

Have you double checked that your are using interrupts [9:5] and pin PB5 for the sensor? This would be around 5:19 in the video.

JTrez.1
Associate II

Yes - that is how it is configured. I can rerun the debugger, downloading new code and it will sometimes fail or other times run correctly. This leads me to believe there is a hardware issue causing intermittent behavior. Software always runs correctly or not 🙂

JMors.1
Associate III

Yeah, strange. Were you able to complete the other labs?

I would check the connection between the NUCLEO-L476RG and X-NUCLEO-IKS01A3 boards or check for some issue like cold solder on the X-NUCLEO-IKS01A3.

However, in my case I used a NUCLEO-L152RE though.

JTrez.1
Associate II

All of the other labs worked with no issue. I plugged and unplugged the MEMS board a few times and examined the pins. Cold solder joint is a possibility for that component. Now that I have completed the course, I am OK but will consider the one sensor suspect for future labs or experiments. Thanks for your help.