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/LAUNCHXL-CC1350: How to read through CC1350 UART?

Part Number: LAUNCHXL-CC1350
Other Parts Discussed in Thread: CC1350, CC1310

Tool/software: TI-RTOS

Hi, I want to read data from an external device which is connected to CC1350 launchpad through UART, should I use callback mode? I found that the demo project UART echo seems don't work for my issue, can u kindly help me with this issue?

  • First , check echo example CC1310_LAUNCHXL.h to connect the external device to the correct uart

    ex)
    #define CC1310_LAUNCHXL_UART_RX IOID_2 /* RXD */
    #define CC1310_LAUNCHXL_UART_TX IOID_3 /* TXD */


    second, insert this code
    This code basically configures the uart to be read through the callback function,
    In case of writing, write it in the way you want (ex) event_pend, post)




    /* Call driver init functions */
    UART_init();

    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readMode = UART_MODE_CALLBACK;
    uartParams.readCallback = Uart_ReadCallback;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readTimeout = UART_WAIT_FOREVER; 
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;
    uartParams.dataLength = UART_LEN_8;
    uartParams.stopBits = UART_STOP_ONE;
    uartParams.parityType = UART_PAR_NONE;

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

    UART_read(uart,&input1,sizeof(input1));



    void Uart_ReadCallback(UART_Handle handle, void *rxBuf, size_t size)
    {
    //something you want action
    .................
    UART_read(uart,&input1,sizeof(input1));
    }

  • Thank you, does it mean that the program will hang at UART_read, once there is a new data at UART, the program will jump to the callbackfunction?