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.

TM4C1294NCPDT: Hello world program failed

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Dear TI community,

Yesterday I received my EK-TM4C1294XL. I downloaded the Code Composer Studio v8.

I wrote a simple program that is supposed to lit a LED connected to PORTA RA4, but failed.

I used the debugger and I concluded that after every call

to a memory location defined by the preprocessor the program jumps to static void FaultISR(void).

#define GPIO_PORTA_LOCK_R       (*((volatile unsigned long *) 0x40058520))
#define GPIO_PORTA_COM_R        (*((volatile unsigned long *) 0x40058524))

#define GPIO_PORTA_DIR_R        (*((volatile unsigned long *) 0x40058400))
#define GPIO_PORTA_DATA_R       (*((volatile unsigned long *) 0x40058000))

int main(void)
{
    GPIO_PORTA_LOCK_R |= 0x4C4F434B;        /* Set write access for commit register */
    GPIO_PORTA_COM_R |= 255;                /* GPIOAFSEL, GPIOPUR, GPIOPDR and GPIODEN
                                                bits can be written */

    while(1) {}

    return 0;
}

As seen in the above image, when running the debugger the first line that will be executed is line 9 in Code Composer Studio v8.

When I hit the Step Into (F5) button, the program jumps to the FaultISR as seen in the image under here.

I have my memory addresses from the datasheet so I asume they are correct.

Is there anything I am missing why I get the FaultISR if I write to a memory location that is in relationship to GPIO?

With kind regards,

Youri.

  • Dear TI community,

    I have read in this document that one should check the value of the NVIC_FAULT_STAT register.

    The image below shows the various NVIC_ registers with their values at the moment that we are in the FaultISR().

    The NVIC_FAULT_ADDR contains the address I just tried to write to. What would this mean and how can we solve this issue?

    With kind regards,

    Youri.

  • There appear '3 programming elements' which may explain:

    • You have NOT turned on the clock to Port_A
    • You have employed the cryptic, inefficient - and error-prone 'DRM' * style of programming.     (Vendor much prefers use of their, 'Long PROVEN/TESTED API.')   'DRM' is unproven - untested - predictably results in your 'Fault ISR' arrival
    • Port_A - to my best knowledge - has NO NEED for (any) Lock nor Unlock sequence.     (Only clearly defined pins - usually 'NMI' and 'JTAG' - require such 'unlocking.')

    Your search, find, and use of TivaWare - which contains the vendor's massive API (and many, many programming examples) is most 'Highly Recommended!'     Continuing 'DRM' usage ... Not so much.

    *  DRM   'Direct Register Manipulation'    (No longer favored nor supported by the vendor.   Their API (instead)  proves to, 'Speed, Ease & Enhance' users' programming efforts...

    In satisfaction of my 'work-release' order - the following code extract from vendor's 'Project.c' - illustrates the API's superiority:

    // Enable the GPIO module.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);  //  This fnt. call - turns on (enables) Port_A's clock.     (Missed by poster's DRM code!)
    ROM_SysCtlDelay(10);

    // Configure PA1 as an output.
    //
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_1);

    // Loop forever.   (or until the weekend...)
    //
    while(1)
    {
    // Set the GPIO high.
    //
    ROM_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_1, GPIO_PIN_1);

    // Delay for awhile.   
    //
    ROM_SysCtlDelay(1000000);

    // Set the GPIO low.
    //
    ROM_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_1, 0);

    // Delay for awhile.   (till weekend?)
    //
    ROM_SysCtlDelay(1000000);

    }

    Poster should note the clearly 'Self Documenting feature' of the API.     And the 'escape' from the (endless) 'defines' ...  (most always - correctly managed/automated - by the API!)