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.

UART clock source in TI-RTOS



After I changed the tick period in the clock module (default is 1000), the UART will no longer work. I guess UART transmission use the timer that clock module use. However, I can't find the information or configuration file that set up the baud rate of the UART.

1. How do I find out which timer/clock that UART use and the baud rate configuration.

2. Can I have 2 clock module (not instance). Say, clock module 1 use timer 1, that has tick period 1000us, which has clock1_0 and clock1_1 instance. and clock module 2 that has tick period of 741us which has clock2_0 and clock2_1 instance. 

Hardware : Stellaris Launchpad (M4F120).

CCS : 5.4.

TI-RTOS : 1.10.

BIOS:6.35

sink.

  • sink said:
    1. How do I find out which timer/clock that UART use and the baud rate configuration

    I just tried changing the Clock module to use 750us instead of 1ms in the uartEcho example and it worked fine. Can you describe what you are running and what the failure was. The UART driver (more specifically the ti\drivers\uart\UARTTiva.c file) has the following call in the open API

    BIOS_getCpuFreq(&freq);
    UARTConfigSetExpClk(hwattrs->baseAddr,
                            freq.lo,
                            object->params.baudRate,
                           (object->params.dataLength |
                            object->params.stopBits |
                            object->params.parityType));

    The timer used for the SYS/BIOS Clock should not impact the UART (unless potentially you make it really small and flood the system with interrupts:)

    sink said:
    2. Can I have 2 clock module (not instance). Say, clock module 1 use timer 1, that has tick period 1000us, which has clock1_0 and clock1_1 instance. and clock module 2 that has tick period of 741us which has clock2_0 and clock2_1 instance.

    Sorry. The SYS/BIOS Clock module is driven by 1 timer (there is also an option to have no timers...different discussion). You'll have to create a different Timer(s) and use it to call your functions as needed.

    Todd

  • sink said:
    However, I can't find the information or configuration file that set up the baud rate of the UART.

    In TI-RTOS 1.10 I was also unable to find any configuration option to change the baud rate of the UART.

    In the uartconsole_TivaTM4C123GH6PM example the only way I was able to change the baud rate was to add code to the openHandle function inUARTUtils.c to change the uartParams variable before the call to UART_open. i.e. added the write to uartParams.baudRate in the following:

    /* Create a UART with the parameters below. */
    UART_Params_init(&uartParams);
    if (binary == TRUE) {
        uartParams.readEcho = UART_ECHO_OFF;
        uartParams.writeDataMode = UART_DATA_BINARY;
        ports[index].binary = TRUE;
    }
    else {
        ports[index].binary = FALSE;
    }
      uartParams.baudRate = 19200; // Override default - doesn't seem to be a config param for this
    ports[index].handle = UART_open(ports[index].base, &uartParams);

     

  • Todd,

    Thanks for you reply. I rechecked again. I found that indeed the change of module tick period won't affected the UART. It affected Task_sleep() function. And since I increased the tick period too long so my Task_sleep() function act like hang. Actually, it just because of the long sleep. 

    However, I am very curious/concerned which timer in hardware that Ti_RTOS use to control the UART baud rate. I hope I won't accidentally change it for other purpose. In my application, I will use different timers for different controls. There is no document at all about it.

    Thanks.

    sink

  • Hi,

    Thanks for your help. It's a good example to change the baudRate. However, like in my other post, I also concerned if I will accidentally change the baud rate if I change the hardware timer. Because of the Ti-RTOS in between, I can't make sure if my timer usage will have any side effect if it happened to be the same timer that RTOS use to control the baudRate.

    Regards,

    Sink.

  • Please take a look at the chip's data sheet. The device's system clock is used to drive the baud rate. Please do not confuse this with the SYS/BIOS Clock module.

    Todd