RTOS/CC3220SF-LAUNCHXL: UART_read function reads from terminal window, but not from another development board

Prodigy 115 points

Replies: 2

Views: 54

Part Number: CC3220SF-LAUNCHXL

Tool/software: TI-RTOS

Hi everyone!

Problem statement

I have a problem with reading bytes from UART. I can successfully write data, but I can't read. It's twice strange, because communication worked several times and bytes were received while reading, but it was another program, modified "portable" example, but it was like a lottery, sometimes it worked, sometimes not.

In my test case I expect LED toggling by pressing a button of adjacent board. This board should write one byte to UART, and another one should read this byte from UART. Also their own LED toggle by pressing own buttons. When I press button on a board, its own LED toggles, one byte sends to UART, but another board read nothing for some reason. If I open a terminal windows on PC, connected to development boards throw USB, I will be able to send an appropriate byte to there and these board read them successfully, and hence their LEDs will be toggle. Also I can see this byte read by terminal windows when I push buttons.

Please, indicate possible problems with my configuration and code. I need to arrange UART connection with sending and receiving data between boards, not with terminal windows. I will be very appreciated for any help.

Hardware settings

I set up CC3220SF-LAUNCHXL to LAUNCHXL-CC3235SF connection by UART without flow control (RTS/CTS). And what I did for that, I connected devices something like that:

GND           <->    GND
TX (Pin 3)    <->    RX (Pin 4)
RX (Pin 4)    <->    TX (Pin 3)

You can visually see my configuration on photos:

Software settings

I utilize modified your TI Drivers "uartecho" example. I modified "uartecho.c" in this manner (the same code for both boards):

 *  ======== uartecho.c ========
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

/* Driver Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/UART.h>

/* Example/Board Header files */
#include "Board.h"

bool gpio_led0_on = false;
bool flag_send_msgByte = false;

void gpioButtonFxn1(uint_least8_t index) {
    flag_send_msgByte = true;

    /* Toggle LED state */
    gpio_led0_on = (gpio_led0_on == true) ? false : true;

 *  ======== mainThread ========
void *mainThread(void *arg0)
    char        input;
    const char  msgByte = '@';
    UART_Handle uartHandle;
    UART_Params uartParams;

    /* Call driver init functions */

    /* Configure the LED pin */

    /* Turn on user LED */
    GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);

    /* install Button callback */
    GPIO_setCallback(Board_GPIO_BUTTON1, gpioButtonFxn1);

    /* Enable interrupts */

    /* Create a UART with data processing off. */
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;
    uartParams.readTimeout = 1000;  // 1 second

    uartHandle = UART_open(Board_UART0, &uartParams);
    if (uartHandle == NULL) {
        /* UART_open() failed */
        while (1);

    /* Loop forever echoing */
    while (1)
        /* Switch LED to appropriate state */
        if (gpio_led0_on)
            GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
            GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_OFF);

        /* Send msgByte to UART */
        if (flag_send_msgByte)
            UART_write(uartHandle, &msgByte, 1);
            flag_send_msgByte = false;

        /* Waiting for msgByte from UART */
        UART_read(uartHandle, &input, 1);
        if (input == msgByte)
            /* Toggle LED state */
            gpio_led0_on = (gpio_led0_on == true) ? false : true;

Also I set up UART pins in "UART configuration structure" of "CC3220SF_LAUNCHXL.c" (similarly for "CC3235SF_LAUNCHXL.c") file like so:

/* UART configuration structure */
const UARTCC32XX_HWAttrsV1 uartCC3235SHWAttrs[CC3235SF_LAUNCHXL_UARTCOUNT] = {
        .baseAddr = UARTA0_BASE,
        .intNum = INT_UARTA0,
        .intPriority = (~0),
        .flowControl = UARTCC32XX_FLOWCTRL_NONE,
        .ringBufPtr  = uartCC3235SRingBuffer[CC3235SF_LAUNCHXL_UART0],
        .ringBufSize = sizeof(uartCC3235SRingBuffer[CC3235SF_LAUNCHXL_UART0]),
        .rxPin = UARTCC32XX_PIN_04_UART0_RX,
        .txPin = UARTCC32XX_PIN_03_UART0_TX,
        .ctsPin = UARTCC32XX_PIN_UNASSIGNED,
        .rtsPin = UARTCC32XX_PIN_UNASSIGNED,
        .errorFxn = NULL
        .baseAddr = UARTA1_BASE,
        .intNum = INT_UARTA1,
        .intPriority = (~0),
        .flowControl = UARTCC32XX_FLOWCTRL_NONE,
        .ringBufPtr  = uartCC3235SRingBuffer[CC3235SF_LAUNCHXL_UART1],
        .ringBufSize = sizeof(uartCC3235SRingBuffer[CC3235SF_LAUNCHXL_UART1]),
        .rxPin = UARTCC32XX_PIN_57_UART1_RX,
        .txPin = UARTCC32XX_PIN_55_UART1_TX,
        .ctsPin = UARTCC32XX_PIN_UNASSIGNED,
        .rtsPin = UARTCC32XX_PIN_UNASSIGNED,
        .errorFxn = NULL

2 Replies

  • Roman,

    What is reason for the resistors on your UART lines?

  • In reply to Vincent Rodriguez:

    Good evening, Vincent!

    Thanks for you answer. They are not very high-power resistors. These are just 470 Ohm. I can't say actual intention of these resistors right now. And unfortunately, I will be able to exactly know that from engineers on Monday. I didn't write in my post, but we physically checked signals by an oscilloscope. TX pins correctly produce signals and these signals come to RX pins. It seems like on physical layer everything works fine. Signals really come to RX pins. As I understand, that's the reason, why you asked me about extra resistors, wasn't it?