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.

UART Long Packet truncated in TIROS FOR CC1310

Other Parts Discussed in Thread: CC1310

Hi Everyone

I am having a code on TIRTOS and the platform is cc1310 , the code simply reads the message from UART and send it over the air. But now the problem is that the UART can not read all messages. For example, I used a 30-byte buffer, and sent a 100-byte message through UART, it only read three times, giving me two 30-byte payload and one 2 byte payload(62 bytes in total). Ideally, it shall be 30+30+30+10. So I am just wondering how shall I read a long message through UART.

Below is my code

static void rfEasyLinkTxFnx(UArg arg0, UArg arg1)
{

    /* Create a semaphore for Async */
    Semaphore_Params params;
    Error_Block eb;

    /* Init params */
    Semaphore_Params_init(&params);
    Error_init(&eb);

    /* Create semaphore instance */
    txDoneSem = Semaphore_create(0, &params, &eb);
    rxDoneSem = Semaphore_create(0, &params, &eb);

    EasyLink_init(EasyLink_Phy_50kbps2gfsk);
    /* Set Freq to 868MHz */
    EasyLink_setFrequency(868000000);
    /* Set output power to 12dBm */
    EasyLink_setRfPwr(12);
    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    //uartParams.readMode=UART_MODE_CALLBACK;
    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=(1000000 / Clock_tickPeriod);
    //uartParams.readCallback=readCB;
    uart = UART_open(Board_UART0, &uartParams);

    while(1) { 
        number = UART_read(uart, txPacket.payload, RFEASYLINKTXPAYLOAD_LENGTH);
        if(number>0)
        {
          UART_write(uart, txPacket.payload, number);

          txPacket.len = number;
          txPacket.dstAddr[0] = 0xaa;
          int numbersToTransmit = 3;
        
//            EasyLink_transmitAsync(&txPacket, txDoneCb);
//            /* Wait 300ms for Tx to complete */
//            if(Semaphore_pend(txDoneSem, (300000 / Clock_tickPeriod)) == FALSE)
//            {
//                /* TX timed out, abort */
//                if(EasyLink_abort() == EasyLink_Status_Success)
//                {
//                    /*
//                     * Abort will cause the txDoneCb to be called, and the txDoneSem ti
//                     * Be released. So we must consume the txDoneSem
//                     * */
//                   Semaphore_pend(txDoneSem, BIOS_WAIT_FOREVER);
//                }
//            }
          

        }
         
    }
}

I am debugging it with HTERM. I sent over 100 bytes, and only 62 bytes received. The code is based on the example easylinkTX

The problem happens also in UARTecho when one sending a long packet(more than 60 bytes)

Thanks in advance

  • Hi

    What version of TI-RTOS are you using?

    If you change the UARTECHO to echo back say 100 bytes back instead of the character received, what do you receive in the terminal session? Can you make the buffer contain unique characters for examole "abc..zABC...1234...+×÷=/_<>...." So we can tell if what is getting dropped.

    Please don't change anything else e.g. baud rate, port, power management being disabled (I think it's disabled in that example...I don't have good access to the code right now)

    Todd
  • Hi Todd

    The version is 2.16 and I did what you suggested. Say the buffer is 30 bytes, and I echoed back 100 bytes, the number I actually got from the terminal was 62 bytes as always.

    I did not change the settings and I can say that there is no special character get dropped. The message got truncated I suppose.

    Yuefan
  • What buffer is 30 bytes? What exactly did you send and what exactly did you receive?
  • I sent ASCII 0123456789 and repeated 3 times. If I sent 10 times, I got 012356789 6 times and 01 in the end
  • Please include the code that does the writing.
  • Include the whole function from the slightly modified uart echo
  • static void rfEasyLinkTxFnx(UArg arg0, UArg arg1)
    {

    /* Create a semaphore for Async */
    Semaphore_Params params;
    Error_Block eb;

    /* Init params */
    Semaphore_Params_init(&params);
    Error_init(&eb);

    /* Create semaphore instance */
    txDoneSem = Semaphore_create(0, &params, &eb);
    rxDoneSem = Semaphore_create(0, &params, &eb);

    EasyLink_init(EasyLink_Phy_50kbps2gfsk);
    /* Set Freq to 868MHz */
    EasyLink_setFrequency(868000000);
    /* Set output power to 12dBm */
    EasyLink_setRfPwr(12);
    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    //uartParams.readMode=UART_MODE_CALLBACK;
    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=(1000000 / Clock_tickPeriod);
    //uartParams.readCallback=readCB;
    uart = UART_open(Board_UART0, &uartParams);

    while(1) {
    number = UART_read(uart, txPacket.payload, RFEASYLINKTXPAYLOAD_LENGTH);
    if(number>0)
    {
    UART_write(uart, txPacket.payload, number);

    txPacket.len = number;
    txPacket.dstAddr[0] = 0xaa;
    int numbersToTransmit = 3;

    // EasyLink_transmitAsync(&txPacket, txDoneCb);
    // /* Wait 300ms for Tx to complete */
    // if(Semaphore_pend(txDoneSem, (300000 / Clock_tickPeriod)) == FALSE)
    // {
    // /* TX timed out, abort */
    // if(EasyLink_abort() == EasyLink_Status_Success)
    // {
    // /*
    // * Abort will cause the txDoneCb to be called, and the txDoneSem ti
    // * Be released. So we must consume the txDoneSem
    // * */
    // Semaphore_pend(txDoneSem, BIOS_WAIT_FOREVER);
    // }
    // }


    }

    }
    }
  • This is not the uart echo example. Do the following steps:
    1. Import the uart echo example from TI-RTOS 2.16.00.
    2. Build the uart echo example.
    3. Run the uart echo example.
    4. Verify the characters are being echo'd on the host terminal application. Look at the Readme file in the project to see how to verify it is working properly.
    5. Modify the uart echo example to send the thing you said fails to work. Do not change anything else.
    6. Build the modified uart echo example.
    7. Run the modified echo uart example.
    8. Do a screen capture of the terminal session. I want to see exactly what was sent and what is wrong.
    9. Export the modified uart echo example.
    10. Attach the screen shot of the terminal session and the exported modified uart echo example to this thread.
  •  3782.uartecho.c

    The attachments include my screen capture and example code in which I didnt do any modification 

  • HI Todd

    Its really annoying . I could not understand why the demo code doesnt work in long message case. Could you also try it in your computer?
    I am using smartRF06 with CC1310-7xd modules.
  • Hi Chen,

    I was able to recreate your problem above. I imported the uartecho example & tried to send 100 bytes of data. I saw the application hang after returning ~60 bytes, just like your screenshot above. I have filed the TIDRIVERS-400 bug to track this issue with the purpose of fixing it in a future release.

    Regards,
    -- Emmanuel
  • Hi

    I also found that UART write doesnt work in long message mode. BTW, the TIRTOS seems not stable in some case. I modifed simpleTx sample code and found that under debugging mode(with IDE) it worked fine, it can send message and receive uart bytes. But once I disable the debugging mode under IDE, it doesnt work. The message got truncated.

  • Hi Chen... did you resolve this issue?