Skip to main content
cs c
Associate
June 30, 2018
Question

Use CUBEMX FREERTOS HAL_TIM,go to hardfault

  • June 30, 2018
  • 2 replies
  • 2044 views
Posted on June 30, 2018 at 16:38

I use the cubemx and freertos andSTM32Cube_FW_L1_V1.8.1,use the timer2 as the systick,but run theosKernelStart() function, a hardfault

occurrence

. use the timer3 as the systick,it`s OK.ThenChange back to timer2,it;s ok

what`s wrong?

0690X0000060By6QAE.png

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    June 30, 2018
    Posted on June 30, 2018 at 22:32

    The way you start figuring out what is going on is to have the HardFault_Handler print out some diagnostic information, and look at the instruction, registers and stack at the location of the fault.

    Use a USART or SWV to output data, watch and understand what is going on.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    cs c
    cs cAuthor
    Associate
    July 1, 2018
    Posted on July 01, 2018 at 06:39

    T

    hanks, stand-alone run it`s ok,but connect the jtag go to the hardfault......................

     
    cs c
    cs cAuthor
    Associate
    July 1, 2018
    Posted on July 01, 2018 at 14:09

    I add a breakpoint in the code,when run the osDelay() function?goto hardfault.

    0690X0000060LLSQA2.png
    Tesla DeLorean
    Guru
    July 1, 2018
    Posted on July 01, 2018 at 17:21

    Ok, but you&39re going to have to step into the code, and identify the instruction (assembler), not the function, that is faulting.

    Likely related to the task swap, so either the stack, or task.

    Get a proper HardFault handler implemented so you can reference the failure in a listing file.

    https://community.st.com/0D50X00009XkdruSAB

     

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