Skip to main content
Visitor II
June 30, 2020
Question

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)

  • June 30, 2020
  • 9 replies
  • 1786 views

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

    This topic has been closed for replies.

    9 replies

    ST Employee
    July 2, 2020

    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.1Author
    Visitor II
    July 3, 2020

    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.1Author
    Visitor II
    July 3, 2020

    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.

    Visitor II
    July 4, 2020

    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.1Author
    Visitor II
    July 6, 2020

    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)

    Visitor II
    July 6, 2020

    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.1Author
    Visitor II
    July 6, 2020

    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 :)

    Visitor II
    July 6, 2020

    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.1Author
    Visitor II
    July 6, 2020

    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.