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.

SysCtlDelay causes program failure

Other Parts Discussed in Thread: EK-TM4C123GXL

Hi everyone.

I've been working on some software for the EK-TM4C123GXL. The code compiles without error, however, including SysCtlDelay() causes the program to fail to return information through UARTprintf().

I have set the clock for USB functionality in a setup function, using:

	    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
	    ROM_SysCtlUSBPLLEnable();

The main function (with usb function calls removed) is this:

int main()
{
    generalSetup();
    ConfigureUART();

    // Open an instance of the keyboard driver and initalise host controler
    tUSBHKeyboard *g_psKeyboardInstance = USBHKeyboardOpen(KeyboardCallback,g_pui8Buffer,KB_MEMORY_SIZE);
    USBHCDInit(0, g_pui8HCDPool, HCD_MEMORY_SIZE);

    char *teststr = "STRING";

    int counter =0;

    uint32_t nullvar;

    UARTprintf("\nSTARTED NEW RUN\n");
    // Main loop of application.
    while(1)
    {
        USBHCDMain();
        UARTprintf("%c",teststr[counter]);
        counter++;
        if (counter>5){
        	counter = 0;
        	UARTprintf("\n");
        	//ROM_SysCtlDelay(5333333);

      	}
    }
}

All code runs as to be expected with the "//ROM_SysCtlDelay()" function as a comment, but fails to print any of the preceeding "teststr" if uncommented. ROM is included at the beginning of the function, and the issue exists for calling this function with and without the ROM_ prefix.

Any suggestions would be highly appreciated. Thankyou.

EDIT: I am using CCS 6.0.1, updated recently. All includes/dependencies are accessible. UART communication, USB host functionality etc. have all been successfully implemented on the hardware.

  • Hello Peter,

    I haven't seen an issue like this so far. To isolate the issue

    1. Is the value of the SysCtlDelay causing the issue, basically to isolate if there is a dependency on the value used?

    2. If the USBHCDMain removed, does the print continue?

    Regards

    Amit

  • I have adjusted SysCtlDelay between very small and large values, as well as directly calculated the value using SysCtlClockGet(). All of these have resulted in a clean build, and program, however the program fails after a short period of time.

    I remove USBHCDMain, the problem remained.

    I have just commented out all UART references from the code, and the program runs, stable. This, however, means that there is no serial feedback available.

    Thank you for your help.

    EDIT: My keyboardCallback function, in this case, triggers a simple LED flash, allowing me to confirm that the entire system is stalled, not just UART communication.