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.

RTOS clock frequency criteria for configuring baudrate

Part Number: TM4C123GH6PM

Tool/software: TI-RTOS

My sincere Apologies in advance to take this shortcut instead of going through documentation/debug !


RTOS: tirtos_tivac_2_14_00_10

Boards: EK_TM4C129EXL and Custom board for TM4C123GH6PM

Does TI-RTOS probe for factual system frequency of TM4C12x for configuring baud-rate to UARTs or it just assumes designated frequencies(120MHz for TM4C129 and 80MHz for TM4C123GH6PM ).

The UARTs on board EK_TM4C129EXL , deliver correct Tx/Rx with my external device when configured as

SysCtlClockFreqSet((SYSCTL_USE_PLL|SYSCTL_XTAL_25MHZ|SYSCTL_OSC_MAIN|SYSCTL_CFG_VCO_480),120000000);

While UARTs on custom board for TM4C123GH6PM, deliver correct Tx but response Rx from external device becomes garbage after approx 40 bytes when configured as

SysCtlClockFreqSet((SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN),80000000);

SysCtlClockGet()  too returns correct value of  80000000.

E2E forum, suggested API "SysCtlClockSet" is meant for TM4C123 only and "SysCtlClockFreqSet" is meant for TM4C129 only.

On custom board for TM4C123GH6PM, replacing

SysCtlClockFreqSet((SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN),80000000); 

with

SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

 causes garbage bytes being transmitted on Tx itself, by TM4C123GH6PM, resulting in no response Rx from external device

SysCtlClockGet(); too returns  40000000.

!! An immediate Concern from above observation is, had TI-RTOS been probing actual frequency on TM4C123GH6PM, be it 40M or 80M, to configure baud-rate, Tx  would had remained intact !!

NOTE:

The custom board for TM4C123GH6PM does not have 32K crystal populated as no use of hibernate/RTC modules at the moment. Respective crystal pins and wake left open in above setup !

  • Hello LuckLuck,

    TM4C123x uses SysCtlClockSet API and TM4C129x uses SysCtlClockFreqSet API for system clock configuration. If you wish to get 80MHz for TM4C123x then replace SYSCTL_SYSDIV_5 with SYSCTL_SYSDIV_2_5

    Make sure that the UART is configured after system clock configuration.

    As for crystal pins, make sure that if the pins are not being used then XOSC0 is connected to GND. It is a standard practice,
  • As per observation shared above, SysCtlClockFreqSet API helps partial communication, for TM4C123x.
    Whereas SysCtlClockSet API breaks communication altogether
  • luck luck said:
    As per observation shared above, SysCtlClockFreqSet API helps partial communication, for TM4C123x.
    Whereas SysCtlClockSet API breaks communication altogether

    TI-RTOS for TivaC has options for the Tiva C clock configuration, where SYS/BIOS computes the expected CPU clock frequency. The following example is from TI-RTOS TivaC 2.16.01.14 :

    If your code calls SysCtlClockSet() such that the actual CPU clock frequency is different from that computed (expected) by SYS/BIOS then SYS/BIOS will be using the incorrect CPU clock frequency in its calculations.

    Instead of calling SysCtlClockSet() in your code, try setting the required clock configuration in the SYS/BIOS "Boot - Clocking Options".

  • Hello Luck Luck,

    SysCtlClockFreqSet API is "NOT" for TM4C123x device. As Chester mentioned you may try to use the TI-RTOS Settings.