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.

TM4C123GH6PGE: Automatically run a program on power on

Part Number: TM4C123GH6PGE

How can I make my Tiva C run a previously downloaded program automatically when power is switched on?

I think it already did this on it`s own some time ago but now it doesn`t anymore. 

What do I have to change to make it work again? (I am working with CCS7.4)

Br,

  • Hello,

    That should always be the case, is there any way the device could have been re-programmed?

    Is this on a custom board or a LaunchPad?

    The general answer to get it running again would be to reprogram it again as in all likelihood, the program got overwritten. You could also try and download the flash contents before programming to see if there is an evidence that it got reprogrammed.
  • Hello,

    it`s a unmodified Launchpad. I have already tried another Launchpad but there`s the same issue.

    The only thin I did with both was to debug my own programs directly via Code Composer Studio.
    When I start debugging and quit the debug session the device continous running but it won`t start on it`s own..

    Br,
  • Hello,

    Would it be possible for you send me the project? If so, then I can test it on my LaunchPad to confirm and maybe help debug too. You can attach a zip file to CCS on E2E by using the "Insert Code, Attach Files and more..." feature.
  • Hello,

    found out that the problem comes with the startup file.

    When I remove my own interrupt handlers and the included file the program starts running as soon there is power.

    In debug mode both of the startup files work just fine.

    Can you spot any problem with this code? 

    Many thanks for you effort!

    Please see attached the main and the two startup files.

    main.cppstartup_nonWorking.cppstartup_working.cpp

  • Hello,

    It looks like the issue on the non-working one is going to be related to how you are adding in those UART ISR's. You are probably hitting a Fault ISR when the device is restarted. In any case, you will need to get the UART ISR's properly setup and then the issue should be fixed.

    As for how to do that, I can't really tell easily based on what you provided but one thing I do not understand is why you have the motor.h file included. In general as long as you are using extern for the ISR you shouldn't need to add an include in startup_ccs.c.
  • Thank you very much! Just found the problem. The function motor_emergency_brake (it`s an endless function) was called in the reser isr. When the device is in debug mode the reset isr isn`t called and so isn`t the function. Just removed it and now it`s working.

    Thank you very much!
    Br,
  • Ah, I didn't notice that change. To clarify a bit more on the difference between debug and free-run, in the case of debug the device was programmed with the code and the stack pointers are set to the starting address, so you wouldn't see the ResetISR fire unless something in the code itself triggered it after you began to run the code. When you reset the device by power cycling though, that would trigger the ResetISR which is why it occurred after removing the debugger.

    You may actually be able to check if you land there by resetting the device while in the debugger, I haven't tried that but in theory you should be able to. Hopefully this info is useful for you.