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.

CC1312R: About the UART FIFO function on CC1312R

Guru 16800 points
Part Number: CC1312R
Other Parts Discussed in Thread: SYSCONFIG

Hello,

Could you confirm the following questions?

1.Could you tell us the way to decide the parameters for the buffer size (UART_write()'s argument) and the baud rate?
We're evaluating the UART_write() function with desabling the FIFO feature.
In case the 2nd argument (*buffer) is 200 and the 3rd argument (size) is 100, first few bytes are sent correctly; however, other data are wrong data.
So we would like to know how to decide the parameters for the buffer size and the baud rate.

2.In case UART FIFO is disabled, is "Ring Buffer Size" in the SysCfg parameter valid?

3.In the TRM, we could find that "For example, if the 1/4 option is selected for the receive FIFO, the UART generates a receive interrupt after 4 data bytes are received." in the FIFO Operation chapter.
Is the "4 data bytes" typo?
We think that the FIFO size is 32-byte (32 entry), so 32 * 1/4 = 8 data bytes.

Best Regards,
Nomo

  • Hi Nomo

    1)

    The UART driver is implemented for a specific configuration of the UART HW module.

    If you change this configuration, you most likely need to re-write the driver implementation as well.

    Why can’t you use the driver implementation available from TI? What functionality do you need that the driver is not providing you?

    The way to use the UART driver, is explained in the UART driver documentation:

    https://dev.ti.com/tirex/explore/node?a=eCfARaV__1.50.00.08&node=AP24VgJ7gbuZWQrdF16tIg__pTTHBmu__LATEST

    You say that the second argument is 200? What is meant by that? The second argument is const void * buffer, where buffer contains the data you want to write:

    const char textToWrite[] = "Test\r\n";
    UART_Handle uart;
    UART_Params uartParams;
    
    UART_init();
    
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.baudRate = 115200;
    
    uart = UART_open(CONFIG_UART_0, &uartParams);
    UART_write(uart, textToWrite, sizeof(textToWrite));
    

    2)

    When you configure the UART through sysConfig, the UART driver must be used as provided by TI. If you alter the driver implementation, we cannot tell you how sysConfig will work together with your modifications.

    3)

    I agree that it looks like there is a typo in the TRM

    BR

    Siri

  • Hi Siri-san,

    Thank you for your reply.
    Of course, we're using the UART driver from you and we want to ask you the question 2 again.
    I appologize to make misunderstanding.
    We never alter the driver implementation and we will only change the argument of the API from you.
    ("the second argument is 200" meant that the buffer size is 200 byte.)

    2.In case UART FIFO is disabled, is "Ring Buffer Size" in the SysCfg parameter valid?

    Best Regards,
    Nomo

  • I am still confused as to why you are asking what happens if you disable the FIFO, as this is not possible with our drivers.

    The FIFO is enabled by setting LCRH.FEN = 1 and this is hard coded in the driver implementation, so unless you are changing our driver, you are not able to disable the FIFO:

    UARTCC26XX_open calls UARTCC26XX_initHw(handle), which does the following:

    /* Enable UART FIFOs */
    HWREG(hwAttrs->baseAddr + UART_O_LCRH) |= UART_LCRH_FEN;

    This is done regardless of the ring buffer size. The ring buffer serves as an extension of the FIFO. If data is received when UART_read() is not called, data will be stored in the ring buffer. The size can be changed to suit the application.

    Also still confused regarding the arguments.

    In the first e-mail you wrote:

    "In case the 2nd argument (*buffer) is 200 and the 3rd argument (size) is 100,"

    In the last e-mail you state that buffer size is 200 byte.

    As explained in the documentation, the first argument is the handle, the second argument is the array where data is stored, and the third argument is the size of that array (if you want to send all elements in the array).

    BR

    Siri

  • Hello Siri-san,

    Thank you for your reply.

    First, you don't recommend to disable FIFO by setting LCRH.FEN = 0?
    We can find the UARTFIFODisalbe API in DriverLib.
    dev.ti.com/.../node
    So, we thought this API can be used.

    As explained in the documentation, the first argument is the handle, the second argument is the array where data is stored, and the third argument is the size of that array (if you want to send all elements in the array).

    I understand what you mention.
    My description was bad.
    We're considering the case that the stored data size in the array and the data size to be sent are different.
    As a example, the whole array size is 200 bytes and the data size to be sent is 100 bytes.

    Best Regards,
    Nomo

  • Hi Nomo

    I guess there are some confusion here with respect to driverLib:

    https://dev.ti.com/tirex/explore/node?node=AGOrZfAC9FxO1GVHEpPQlw__pTTHBmu__LATEST

    vs.

    TI Drivers:

    https://dev.ti.com/tirex/explore/node?node=AP24VgJ7gbuZWQrdF16tIg__pTTHBmu__LATEST

    The TI driver (and the UART driver) is what we recommend the customers to use, and NOT the driverLib.

    The driverLib is a set of low level drivers for accessing the registers found on the CC13xx, while the UART driver (under TI drivers) is based on a portable application programming interface (API) which enables seamless migration across the SimpleLink SDK portfolio. Unless specifically stated otherwise, TI-Drivers are designed to be thread safe and work seamlessly inside of a real time operating system (RTOS) application. All TI-Driver implementations utilize the Power driver APIs to ensure low power consumption at all times.

    The TI drivers uses the driverLib functions, and unless you are using the UART in a way not supported by our UART driver, there is no need for you to use the driverLib functions to make your own driver implementation.

    The configuration done is sysConfig is configurations of the TI drivers (not the low lever driverLib).

    There should not be a problem of sending for example only 100 bytes even if your data is stored in an array of size 200.

    BR

    SIri

  • Hi Siri-san,

    Thank you for your reply.

    Everything is clear.

    Best Regards,

    Nomo