Part Number:CC2640R2F
Hi,
I have implemented UART to process per byte. Here is my code below. There is no problem with this code when I enter manually through Tera Term by typing at keyboard. However, when I copy and paste to Tera Term more than 37 bytes or characters only the 32 bytes is stored at CmdRxBuf. We have a Labview program that sends the same 37 characters and I get same results. The copying and pasting at Tera Term problem was solved when I set a 1 msec/char transmit delay. What could be causing this UART problem?
void UartApp__UartRxCB(UART_Handle handle, void *buf, size_t count) { TxBuf = ((uint8_t*)buf)[0]; if(TxBuf == '\r') { CmdRxBuf[charcount] = TxBuf; UartApp__WriteString("\r\n"); for (i = 0; i < charcount; i++) { TestApp__DecodeData(CmdRxBuf[i]); } CmdRxBuf[i] = '\0'; TestApp__DecodeData(CmdRxBuf[i]); /* Clear CmdRxBuf */ for (i = 0; i < UART_RX_DATA_LENGTH; i++) { CmdRxBuf[i] = '\0'; } charcount = 0; } else { CmdRxBuf[charcount] = TxBuf; charcount++; } UART_write(hUART, &TxBuf, sizeof(TxBuf)); UART_read(hUART, &RxBuf, sizeof(RxBuf)/sizeof(BUFTYPE)); } void UartApp__Init(void) { const char echoPrompt[] = "UART Initialized ! ! !\r\n"; UART_Params uartParams; /* Call driver init functions */ UART_init(); /* Create a UART with data processing off. */ UART_Params_init(&uartParams); uartParams.readMode = UART_MODE_CALLBACK; uartParams.writeMode = UART_MODE_CALLBACK; uartParams.readCallback = UartApp__UartRxCB; uartParams.writeCallback = UartApp__UartTxCB; uartParams.readEcho = UART_ECHO_OFF; uartParams.baudRate = 115200; uartParams.readDataMode = UART_DATA_BINARY; uartParams.writeDataMode = UART_DATA_BINARY; uartParams.dataLength = UART_LEN_8; uartParams.readReturnMode = UART_RETURN_FULL; hUART = UART_open(Board_UART0, &uartParams); if (hUART == NULL) { /* UART_open() failed */ while (1); } UART_write(hUART, echoPrompt, sizeof(echoPrompt)); UART_read(hUART, &RxBuf, sizeof(RxBuf)/sizeof(BUFTYPE)); charcount = 0; }
- kel