This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

tm4c123g harware fault

I am new user of TM4C123G  launchpad. 

I am running a lab program fro UT Austin. The program is supposed to be a working program. However when I run it in the debug mode, it gets stuck at Hardfault_handler program. Does this mean that the board has a hardware problem, or is ther some way it can be fixed?

  • Hi Rahim,

    Could you check FAULTSTAT and FAULTADDR to see which is the cause?
  • Hello Rahim,

    LAB101: Hard Fault is not a hardware problem. A Fault is called Hard as it is stopping the CPU from interacting with a peripheral or being unable to get its code/data in a proper fashion. Luis has asked the check of the registers to see the faulting condition, and I will ask which "working program" is it?

    Regards
    Amit
  • Thanks to both Luis and Amit for the replies. Luis, I'll try as soon as I can make some time.
  • Hi Amit,
    it gets stuck in the first line of main.c program. Pl note that this is a known good program from UT Austin. I am pretty sure that it is a user error, but not sure what have I done wrong. The pointer (a green bar) shows the section with the header HardFault_Handler. I can't figure out how to attach the clipshot. So I am attaching the section:
    NMI_Handler PROC
    Export NMI_Handler [WEAK]
    B .
    ENDP

    It stops at the line starting with B.
    I am not sure how to answer Luis' request.
    Thanks,
    Rahim
  • Hi Luis,
    I tried to understand fro the datasheet how to do to read FAULTADDR and FAULTSTAT. Couldn't figure it out.
    All I could gather is that FAULTSTAT is register 76, offset, 0xD28, FAULTADDR is register 79, offset 0xD38. But it's not clear what is the exact statement to add. Should I add in the main.c program or startup.s program. My suspicion is that it gets stuck in the first statement of the main program. However when I press the Stop button, it shows the line on startup.s section.
    I have replied to Amit with the exact symptom, the way I interpret. It would be nice if I could attach the screenshot of the error. I do not know how to attach a document. Sorry,
    Rahim
  • Hi Rahim,

    Keil itself should allow you to check pretty much all the registers values while on debug. It's very handy to check for errors! Sorry but with that I can't really help you, never used Keil :/

    To add a screenshot press "Use rich formatting". It's on the bottom left of the text box. There's many options.
  • Hello Rahim,

    Via the debugger you can read the FAULTSTAT and FAULTADDR registers. The code content is also not visible to us, so effectively we are running blind for this session to see where it is faulting. When you download and run the code does it go to the FaultHandler directly, or subsequent RUN of the code lands the CPU in Fault

    Regards
    Amit
  • Luis Afonso said:
    It's very handy to check for errors! Sorry but with that I can't really help you

    Without that (requested register values) may make more sense...

  • Thanks to both Luis and you. I recognize that without sharing the codes, it is difficult for you to help anymore. Nevertheless I made some progress. I noted that there was a mention that FPU should not be activated. I noticed in the option that the FPU was turned on. I turned it off and now it runs but stops at a new location. It shows Error 65: it seems that the I/Os do not have read/write access. I have to add the initialization file. I have asked the instructor what Init file should be added. I hope that would be the last bug in this exercise.