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.

CCS/TM4C123GH6PM: ISSUE WITH THE UART CLOCK

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL,

Tool/software: Code Composer Studio

Hi,

    Once again thanks for all the guys.In my last post i had a doubt with a data packet sending in the UART now it was clear but i am facing an another issue.Suppose if i increase the SYSTEM CLOCK the packet is not properly transfering through UART . 

SysCtlClockSet ( SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ );       // NOW CLOCK 16Mhz

UARTConfigSetExpClk(UART0_BASE,SysCtlClockGet(), 115200, ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));    //UART also having 16Mhz

in these UART was working fine and data packet also sending properly , but

SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_25MHZ);         // NOW CLOCK 25Mhz

UARTConfigSetExpClk(UART0_BASE,SysCtlClockGet(), 115200, ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); 

in these condition i am facing a issue and my data is lossing,not getting a proper data packet in the output side.Can any one help me how solve these issue.Only in 16Mhz it was working properly if increase the clock it was not working.

SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_25MHZ);         // NOW CLOCK 25Mhz

UARTConfigSetExpClk(UART0_BASE,16000000, 115200, ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));  //if i make in these manner it was working.

Help me to solve these issue.

  • The calls to SysCtlClockSet() show the SYSCTL_XTAL_16MHZ  or SYSCTL_XTAL_25MHZ being used in an attempt to change the clock frequency. That is incorrect. The SYSCTL_XTAL_* option needs to specify the actual crystal frequency connected to the TM4C123 oscillator. Which in the case of a EK-TM4C123GXL should be fixed as SYSCTL_XTAL_16MHZ.

    If the SYSCTL_XTAL_25MHZ option is used, but the actual crystal frequency is 16 MHz then the actual clock frequency will be different to that returned by SysCtlClockGet() which means lines of the following form will set an incorrect baud rate:

    UARTConfigSetExpClk(UART0_BASE,SysCtlClockGet(), 115200, ( UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); 

    The SYSCTL_SYSDIV_* option can be used to change the clock frequency according to the valid combinations shown in the TM4C123GH6PM datasheet.

    Some examples, where 80 MHz is the highest clock frequency which can be used:

        //
        // Set the clock to 40Mhz derived from the PLL and the external oscillator
        //
        SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
    
        //
        // Set the clock to 66.67 Mhz derived from the PLL and the external oscillator
        //
        SysCtlClockSet(SYSCTL_SYSDIV_3 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
    
        //
        // Set the clock to 80 Mhz derived from the PLL and the external oscillator
        //
        SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);