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.

Stellaris LaunchPad LM4F120 Jumps to Default ISR when entering main

Other Parts Discussed in Thread: CODECOMPOSER

Hi,

I've had this Stellaris LaunchPad LM4F12 kit for a while, and finally i got around to play with it. I wanted to develop with Keil 'cause I am familiar with the tool. Everything seems to work fine with the IDE itself but when I tried to run a simple RGB led blinker nothing happened.

So I went into debug mode. And noticed that as soon as the mcu jumps to main an interrupt is triggered, and the execution loops in the default interrupt handler. xPSR shows IN = 3, that is HardFault. To eliminate the possibility of being an error in my code I wrote an empty main function:

int main(){}

Same behaviour.

The only code ran before main is the Startup.s (some assembly commands) that i imported from Keil uVision "Software packages" system.

Has anyone had similar issues?

Am I missing some step and thus accidentally triggering the Hard Fault ?

Should I just switch to a different IDE?

Thanks

  • Hello Jordi,

    Can you please look at the following thread for Debug and Diagnosis of a Fault.

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/374640.aspx

    EDIT: You may want to import an existing program in  Keil and then use the same for development.

    Regards

    Amit

  • Hey,

    I looked at the document you suggested.

    And following Issue 5 (seeming the most pertaining) found the following:

    NVIC_FAULTSTAT (0xE000ED28) : 0x00009200
        Indicates:
               bit15: Bus Fault Address Register Valid
               bit12: Stack Bus Fault
               bit9: Precise Data Bus Error

    NVIC_FAULTADDR (0xE000ED38): 0x10000000

      Yet I do not seem to have any code there (nor anywhere near).

    As for importing an example project. Ideas on where to find one for Keil ? So far all seems tailored to CCS

    Thanks !

  • PS:

    I installed CodeComposer Studio v6, and built the blinky example. That works perfectly so the hardware is OK. It must be some issue with Keil initializiation routines. But they looked so short and not "dangerous" in any way.

    So I'd still like to know how to get it working with Keil

  • Hi,

    In your Keil version, you should not import anything from Keil in startup routines. Instead, there is a startup_rmvdk.s file in the same folder as your main application and that one should be used with Keil.

    Petrei

  • In your Keil version, you should not import anything from Keil in startup routines

    I would not suggest so. Rather, if Keil supports the TM4C, use the file supplied by the IDE.

    Could it be that a missing interrupt handler is the culprit ?

    The 'common' CMSIS way is to call the SystemInit() function from the startup code, where some basic setups are happening, especially the clock setup. This function resides in a file named 'system_<devicename>.c'.

    Are you sure you selected the proper MCU type when creating the project ? If not, a wrong startup file with incorrect vector location would be pulled in, which could also explain this behavior.

    BTW, I'm no Keil uVision user, having only very superficial experience with it. But you can ask the Keil forum.

  • Hello Petrei,

    Thanks for backing my post up.

    EDIT: You may want to import an existing program in  Keil and then use the same for development.

    Regards

    Amit