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/TM4C1294NCPDT: TI-RTOS UART Console Example - Configuring Baud

Part Number: TM4C1294NCPDT


Tool/software: TI-RTOS

Fellows,

Just started venturing into TI-RTOS. I have a reasonable experience using TivaWare. IDE is CCS7.

I got the empty example to properly import and compile, and after that I got the uartconsole_EK_TM4C1294XL_TI example to properly compile and run, and can interact with the MCU via a UART port.

As basic as this questions appears, I could not actually find where is the uart baud rate configured on that example. I did try to step debug, step into, etc, but  couldn't really figure it out. So thanks in advance for any help here.

Bruno

  • Hi Bruno,

    What version of TI-RTOS are you using?

    Thanks,
    Gerardo
  • Gerardo,
    TI-RTOS is the most recent available for TivaC: 2.16.1.14
    And XDCtools is 3.32.1.22 for what matters.
    Bruno
  • Hi Bruno,

    On the example's main function you call add_device and you pass a pointer to function UARTUtils_deviceopen() from UARTUtils.h. That function is called to open the UART, this function then in turn calls openHandle(), from UARTUtils.c as well, there you can see it sets:

    uartParams.baudRate = 9600;

    That's the way the baud rate is set.

    Thanks,
    Gerardo

  • Gerardo,

    Thank you very much for providing such a detailed reply. The low level C programming used on drivers is usually tricky, and in fact I did not notice some of the calls in the program stepping...

    For future reference, I could see that within main, the first time baudrate is defined is somewhere inside freopen("UART:0, "w", stdout);
    - unfortunately, I could not again find the right flow to get there... and I'll have to put this matter on hold for some time now.

    However, given that this is an EXAMPLE implementation, wouldn't it be wise that the configuration parameters are literally part of the main code, even if they coincidentally match the default value? I can't still even find the declaration for uartParams on the main code. Sure, if I dedicate another 15 minutes or so to the task, I will find it somewhere - or am I really missing to find the adequate documentation for all this, and there is some PDF that I overlooked?

    Thanks again, sorry for the complaint tone...

    Bruno
  • Hi Bruno,

    The reason why that example seems to be so complicated is because it is enabling the use of the TI-RTOS UART driver to implement the C stdio, stdin, and stdout streams for reading and writing through a UART. Thus calls to functions such as printf() will go through the UART, therefore there are more things that need to be setup. The call to freopen() that you mentioned is part of that extra configuration that needs to be done.

    I'm not sure if you actually need all of that though? If all you need is to read and write from a UART you would be better off using the UART echo example. This example has a much simpler configuration and you can see how all the parameters are set right in the main file.

    Hope that helps,
    Gerardo