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));
}
}