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.

CC2650STK: CC2650 UART tx dropping bytes, corrupting output

Part Number: CC2650STK
Other Parts Discussed in Thread: CC2650

Good day -

I'm using a cc2650 sensortag, along with the XDS110 debug probe (CC-DEVPACK-DEBUG). I'm developing a Contiki application and streaming output over the UART. I've observed over many instances that data appears to be corrupted. Examining the data, it appears that data existing in the FIFO is dropped in preference for newer data.

I've observed the problem at speeds of 115200, 230400, 460800, and 921600.  Looking at contiki cpu/cc26xx-cc13xx/dev/cc26xx-uart.c, it is simply calling UARTCharPut.

Any advice would be appreciated.

  • Hi Thomas,

    How are you sending data over the UART? Are you using the UART API directly, or calling printf of some sort?
    Also, how are you retrieving the UART data on the other side? Are you simply setting up a serial connection with a terminal?

  • I'm using puts, which invokes UARTCharPut.

    The code empties the MPU 9250 FIFO, and produces 200 lines a second of

    {
    ...
    puts ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
    ...
    }

    Must of the time the output is correct, but there are several instances of additions and deletions. Example of addition is (insertion of "qrstuvwxyz"):
    ...
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    ...

    and an example of deletion is (subtraction of "p"):
    ...
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

    I've seen this behavior both on Linux and Windows (Emulation Software Package 7.0.188.0).
    On Linux, I perform
    stty -F /dev/ttyACM0 raw clocal 921600
    cat /dev/ttyACM0 > file

    On windows, I use putty.
  • I used usbmon to monitor the data coming from the XDS110. I do see the corruption happening in the bulk_in. I'm providing the output and usbmon pcapng (use wireshark to parse).

    Information on the XDS110 is:

    USB Device Firmware Upgrade Utility

    Copyright (c) 2008-2015 Texas Instruments Incorporated.  All rights reserved.

    Scanning USB buses for supported XDS110 devices...

    <<<< Device 0 >>>>20180327.tar.gz

    VID: 0x0451    PID: 0xbef3

    Device Name:   XDS110 Embed with CMSIS-DAP

    Version:       2.3.0.12

    Manufacturer:  Texas Instruments

    Serial Num:    L3000751

    Mode:          Runtime

    Found 1 device.

  • What baud rate are you using? Contiki uses default 115200 baud rate if you don't override the setting in your project-conf.h file.
  • The above results were collected with the uart configured for 230400bps.

    From project-conf.h:
    #define CC26XX_UART_CONF_BAUD_RATE 2304000

    Mind you, the output is not garbled, it is dropping characters. It can be seen in the bulk_in messages

    The question is where does the problem exist: in the cc2650 uart, the devpack uart-to-usb interface, or contiki.
  • Thomas,

    This sounds very much like a bad connection with your device. I've been using Contiki-NG extensively with a terminal connection with no problems. You should double check your cable/connection to verify this isn't caused by a sub-optimal connection.

    Out of curiosity, are you using Contiki or Contiki-NG?

    Btw, it seems you've specified one zero to many for your project-conf baud rate, namely 230400 instead of 2304000? You should also do a total rebuild of your project after modifying project-conf, i.e.

    $ make clean && make *your arguments*

  • Edvard -

    My copy and paste went astray. The baud rate was set to 230400.

    I wrote a simple program using TIRTOS. See attached. I operate the UART at 9600. I observe the same problem: bytes are being dropped.

    These test suggest the problem is not with TI-RTOS nor contiki, but either with the devpack  (which interfaces the UART TO ACM) or the CC2650 UART.

    This is frustrating. Just trying to get clean data off the sensortag.

    Advice appreciated.

    /*
     * Copyright (c) 2015-2016, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== uartecho.c ========
     */
    
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    /* TI-RTOS Header files */
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/UART.h>
    
    /* Example/Board Header files */
    #include "Board.h"
    
    #include <stdint.h>
    #include <string.h>
    
    #define TASKSTACKSIZE     768
    
    Task_Struct task0Struct;
    Char task0Stack[TASKSTACKSIZE];
    
    /* Global memory storage for a PIN_Config table */
    static PIN_State ledPinState;
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config ledPinTable[] = {
        Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    
    /*
     *  ======== echoFxn ========
     *  Task for this function is created statically. See the project's .cfg file.
     */
    Void echoFxn(UArg arg0, UArg arg1)
    {
        UART_Handle uart;
        UART_Params uartParams;
        static const char test[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n";
    
        /* Create a UART with data processing off. */
        UART_Params_init(&uartParams);
        uartParams.writeDataMode = UART_DATA_BINARY;
        uartParams.readDataMode = UART_DATA_BINARY;
        uartParams.readReturnMode = UART_RETURN_FULL;
        uartParams.readEcho = UART_ECHO_OFF;
        uartParams.baudRate = 9600;
        uart = UART_open(Board_UART0, &uartParams);
    
        if (uart == NULL) {
            System_abort("Error opening the UART");
        }
    
        /* Loop forever echoing */
        while (1) {
            UART_write(uart, test, sizeof(test)-1);
        }
    }
    
    /*
     *  ======== main ========
     */
    int main(void)
    {
        PIN_Handle ledPinHandle;
        Task_Params taskParams;
    
        /* Call board init functions */
        Board_initGeneral();
        Board_initUART();
    
        /* Construct BIOS objects */
        Task_Params_init(&taskParams);
        taskParams.stackSize = TASKSTACKSIZE;
        taskParams.stack = &task0Stack;
        Task_construct(&task0Struct, (Task_FuncPtr)echoFxn, &taskParams, NULL);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, ledPinTable);
        if(!ledPinHandle) {
            System_abort("Error initializing board LED pins\n");
        }
    
        PIN_setOutputValue(ledPinHandle, Board_LED1, 1);
    
        /* This example has logging and many other debug capabilities enabled */
        System_printf("This example does not attempt to minimize code or data "
                      "footprint\n");
        System_flush();
    
        System_printf("Starting the UART Echo example\nSystem provider is set to "
                      "SysMin. Halt the target to view any SysMin contents in "
                      "ROV.\n");
        /* SysMin will only print to the console when you call flush or exit */
        System_flush();
    
        /* Start BIOS */
        BIOS_start();
    
        return (0);
    }
    

    JKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR

  • Thomas,

    We've tried your code snippet with the latest CC2650 SDK and we're not observing the same issues as you. How often do you observe this issue?

    What Contiki version are you using (Original Contiki or Contiki-NG)? Also, what CC2650 SDK version are you using?
  • Hi Thomas,

    Do you have any updates on this issue?
  • I'm closing this thread due to inactivity. If you still have a problem with this or something related please feel free to open a new thread.