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.

CCS/EK-TM4C1294XL: UARTSend does not send large strings back - they are being cut for some reason

Part Number: EK-TM4C1294XL

Tool/software: Code Composer Studio


i have a strange issue with "UARTSend" function from "uart_echo.c" example. for some reason, the response i'm getting when sending the command "info" through uart is cut.
i am supposed to get back:
{\"version\": \"1.0\", \"id\": \"37826342234\" }

but instead i'm getting only this back:
{"version": "1.0"

when i do this char by char with a breakpoint inside the loop at "UARTSend" it returns the entire string fine. maybe a delay is needed here?

these following are my UARTSend and UARTIntHandler:

void UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
    //
    // Loop while there are more characters to send.
    //
    while(ui32Count--)
    {
        //
        // Write the next character to the UART.
        //
        ROM_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++);
    }
}

i am using the following UART interrupt handling function:

void UARTIntHandler(void)
{
    uint32_t ui32Status;

    //
    // Get the interrrupt status.
    //
    ui32Status = ROM_UARTIntStatus(UART0_BASE, true);

    //
    // Clear the asserted interrupts.
    //
    ROM_UARTIntClear(UART0_BASE, ui32Status);

    //
    // Loop while there are characters in the receive FIFO.
    //
    char b[5];
    int i = 0;

    while(ROM_UARTCharsAvail(UART0_BASE))
    {
        //
        // Read the next character from the UART and write it back to the UART.
        //
        b[i] = ROM_UARTCharGetNonBlocking(UART0_BASE);
        i++;
    }


    if (strstr(b, "info"))
    {
        char* response = "{\"version\": \"1.0\", \"id\": \"37826342234\" }";
        UARTSend(response, strlen(response));
    }
}

  • Liran Sorani said:
    instead i'm getting only this back:
    {"version": "1.0"

    Would it not serve you to,  'Count that,  'clipped field?'     It totals 16 chars - which supplies a substantial clue - does it not?

    What 'feature' w/in the MCU's UART - also shares this '16' count?     Might that be a good place to start your analysis?

    You don't mention - yet have you 'Checked for the parallel effect' - inflicting itself upon your UART Reception?

  • actually it is 17 bytes - not 16 - please recount. that was the first thing i checked. please take a look at the code i sent - there is nothing related to a "limit" of some size or am i missing something? as i also said - in debug it is working good - all bytes are translated if i BP inside the UARTsend loop for each character.
    what do you mean by parallel effect? this is serial communication - the delivery is guaranteed to to keep the order or do you mean something else - please explain.
  • Hi,
    In your UARTSend you are calling the ROM_UARTCharPutNonBlocking(). You should check the boolean returned value of this API call. If it returns false then then there is no space in the TX FIFO. You should wait until FIFO space is available. This is especially true when your baudrate is slow. Try it and see if it makes a difference. Or use ROM_UARTCharPut() instead to see if it works. UARTCharPut() is blocking. It will wait until there is space in the TX FIFO.
    When you use breakpoint it allows the UART to complete the transmission while the CPU is being halted. I think this may be the reason why it works when you break.
  • that did it - thanks :)