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.

EK-TM4C1294XL: TivaWare's SysCtlDelay function

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

In TM4C1294NCPDT, I am using TivaWare's SysCtl Delay to use a 1 second delay, but it is not stable at 1 second or several hundred ms each time the power is turned on.

Please teach me if there are any prerequisites for using SysCtlDelay. The code itself is a simple code that blinks the LED every second as shown below.

The operating frequency is set to 120MHz.

------

g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                             SYSCTL_OSC_MAIN |
                                             SYSCTL_USE_PLL |
                                             SYSCTL_CFG_VCO_480), 120000000);
while(1)
{
        i32usr = SysCtlClockGet()/3;
        ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0); /* LED4-ON */
        SysCtlDelay(SysCtlClockGet() / 3); // delay 1 second
        ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0U);   /* LED4-OFF */
        SysCtlDelay(SysCtlClockGet() / 3); // delay 1 second
}

-----

Thanks,

Astro