Other Parts Discussed in Thread: MSP-TS430PEU128
Dear Experts,
I am testing UART on MSP430F6779A with board MSP-TS430PEU128.
My problem is on reading UART and cannot get all data from RX, here is the code how I to do that,
Void echoFxn(UArg arg0, UArg arg1) { BYTE buffer[10]; char input; int readSize = 1; UART_Handle uart; UART_Params uartParams; UART_Params_init(&uartParams); uartParams.readMode = UART_MODE_BLOCKING; uartParams.writeMode = UART_MODE_BLOCKING; uartParams.writeDataMode = UART_DATA_BINARY; uartParams.readDataMode = UART_DATA_BINARY; uartParams.readReturnMode = UART_RETURN_FULL; uartParams.readEcho = UART_ECHO_OFF; uartParams.readTimeout = 1; uartParams.baudRate = 115200; uart = UART_open(1, &uartParams); /* P3.4,5 = USCI_A1 TXD/RXD */ if (uart == NULL) { System_abort("Error opening the UART"); } while (1) { UART_read(uart, &input, readSize); //read 1 at once System_printf("%c\n", input); System_flush(); } }
I am using accessport tool to send data "1234567890", after run, I only got "1" and "0" which those are first and last characters. No mater what baudrate I set, only those two can be received.
Where I did wrong?
I also tried another way to read RX data which is read a block:
Void echoFxn(UArg arg0, UArg arg1) { BYTE buffer[10]; char input; int readSize = 1; UART_Handle uart; UART_Params uartParams; UART_Params_init(&uartParams); uartParams.readMode = UART_MODE_BLOCKING; uartParams.writeMode = UART_MODE_BLOCKING; uartParams.writeDataMode = UART_DATA_BINARY; uartParams.readDataMode = UART_DATA_BINARY; uartParams.readReturnMode = UART_RETURN_FULL; uartParams.readEcho = UART_ECHO_OFF; uartParams.readTimeout = 1; uartParams.baudRate = 115200; uart = UART_open(1, &uartParams); //open PM_UCA1 if (uart == NULL) { System_abort("Error opening the UART"); } while (1) { UART_read(uart, &buffer, 10); //read 10 at once System_printf("%s\n", (char *)buffer); System_flush(); } }
I use same tool to send data "1234567890" and got all data "1234567890" without missing. But here is the problem, if I just send data less than 10, then I'll never get returned from UART_read. Seems the readTimeout setting is not working, why is that happen?
Thanks in advanced.