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.
Part Number: MSP432P401R
Hello all,
I am using MSP432P401R controller and I laoded an example of UARTECHO and I am testing that example for more than 100 character sending and receiving, But some of the characters are missing some time.
My coding are:
char input; const char echoPrompt[] = "Echoing characters:\r\n"; UART_Handle uart; UART_Params uartParams; int UART_DATA = 0; void ReadCallBack(UART_Handle handle, void *buf, size_t count) { UART_read(uart, &input, 1); UART_write(uart, &input, 1); UART_DATA = 1; // return; } /* * ======== mainThread ======== */ void *UART_Thread(void *arg0) { // char input; // const char echoPrompt[] = "Echoing characters:\r\n"; // UART_Handle uart; // UART_Params uartParams; /* Call driver init functions */ GPIO_init(); UART_init(); /* Configure the LED pin */ GPIO_setConfig(CONFIG_GPIO_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); /* Turn on user LED */ GPIO_write(CONFIG_GPIO_0, CONFIG_GPIO_LED_ON); /* Create a UART with data processing off. */ UART_Params_init(&uartParams); uartParams.writeDataMode = UART_DATA_BINARY; uartParams.readDataMode = UART_DATA_TEXT; uartParams.readReturnMode = UART_RETURN_NEWLINE; uartParams.readEcho = UART_ECHO_OFF; // uartParams.readCallback = ReadCallBack; // uartParams.readMode = UART_MODE_CALLBACK; uartParams.baudRate = 115200; uart = UART_open(CONFIG_UART_0, &uartParams); if (uart == NULL) { /* UART_open() failed */ while (1); } UART_write(uart, echoPrompt, sizeof(echoPrompt)); // UART_read(uart, &input, 1); /* Loop forever echoing */ while (1) { // UART_read(uart, &input, 1); // if(UART_DATA) // { // UART_DATA = 0; //// UART_write(uart, &input, 1); //// GPIO_toggle(CONFIG_GPIO_0); // } UART_read(uart, &input, 1); UART_write(uart, &input, 1); } // return 0; }
Check this out coding which I tried. I tried using Callback and polling also. But no were i got prefect output.
Please suggest me something.
Thanks
Anil.
Hi Anil,
I tried the code example, and I didn't see any characters missed even after sending over 100 characters. I would suggest starting over with the code example and making incremental changes to know exactly what change caused this behavior. Perhaps you're sending the characters without enough time between them (too close together). The UART read and write are using polling, so there's obviously a chance where received bytes are skipped if something is getting sent. I would also highly recommend using a logic analyzer to see exactly what's received versus what's sent. Then, you can also toggle a GPIO to determine how long the echo takes to establish a minimum time between packets.
Regards,
James
I think this controller has a 48MHz clock to run. I even worked on 16MHz with MSP430FR5994, but there didn't see this kind of issues.
Why I am facing a problem here only i am not getting,
I Know UART will run with his 115200 speed only, but the processing speed of the controller is 3 times than MSP.
Then why i am facing this issue here?
Okay James,
I tried like, i am saving received data into the buffer and after receiving all bytes i am calling write function, So in this case i am not getting any problem. So I think as you said its taking time for reading and writing.
Thanks for your response.
Anil.
**Attention** This is a public forum