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.
Tool/software: TI-RTOS
Hi Team,
My earlier project was made using TIVA board. However, now we have moved to MSP432 launchpad and we are using the Simplelink SDK version.
I am using the RTOS concept and I am trying to find if there is any function similar to "UARTCharsAvail(uint32_tBase)" that is available in the TIVA driver library to check if any characters are been there in the receive FIFO for continuous UART operation?
Please let me know if not I have to find a work around.
Thank you in advance.
Vikram
Vikram,
If I read your intent correctly, I think the UART_read() function may already do what you want. This API uses the uartParams structure to define, among other things, a "read Return Mode" that will cause the read buffer to fill until the input stream hits a Newline.
This behavior is illustrated in the MSP432P4111 OutOfBox demo program. Look at the uart_thread.c source file to see the following code snippet shown below. In this code, the UART_RETURN_NEWLINE read mode is used when setting up the uart_handle. This sets up an ISR callback function which gets called whenever the input stream hits a newline.
Let me know if this is the kind of functionality you were after.
/* Define UART parameters*/
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_TEXT;
uartParams.readDataMode = UART_DATA_TEXT;
uartParams.readReturnMode = UART_RETURN_NEWLINE;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart_handle = UART_open(Board_UART0, &uartParams);
if (uart_handle == NULL) {
/* UART_open() failed */
while (1);
}
while (1) {
UART_read(uart_handle, &rxString, MAX_STR_LENGTH); //input = RXD byte
------------------------------
Regards,
Bob
Thank you Bob for your input.
I will try this out and get back to you.
Regards,
Vikram
Hi Bob,
I tried to use the concept for the demo uart code but did not find any difference in the outcome so will it be possible for you to please explain what is the difference in using the UART_RETURN_NEWLINE v/s UART_RETURN_FULL;
The source that I will be getting data from is a black box to me as we don't have access to it in terms of what sort of data will it be sending.
The task is that there is a pulser which triggers through a watchdog event on MSP432 and starts sending data over its uart line to the MSP432. So we are not sure whether it sends a new line character everytime or not?
Thank you
Vikram
Hi Bob,
Thank you for your reply.
Yes, I have just one MSP432 device that communicates with the other device (micro pulser) over the UART. The concept of watchdog is not triggered by the other device instead the watchdog is triggered at a fixed time interval in MSP432 and post this watchdog triggered event, I turn on the other device and send some command in reply to which the other device starts sending stream of data for some time.
So I want to ensure I don't get the buffer overflow error and since, I have to use the ring buffer to constantly collect the data received I also don't want to miss out on the data received.
I am using the UART_read command but the problem is at times, I still run into the buffer overflow error.
So if there is a function similar to UARTCharsAvail, I can use that to verify after certain fixed data value if something else is left to be received or not.
Thank you
Vikram
Vikram,
Determining the righ approach here will requre knowing a little about the incoming datastream, but here are a few things to consider:
1. The UART driver APIs have the options when opening/initiatlizing (UART_params_init() ) a UART instance
2. You could alternately use UART_readPolling(), which won't return until it has read <size> number of bytes. How you use this and the size to set depends on your incoming data. Again, if <size> is much less than your buffer size, then you reduce the chance of overunning your buffer.
Regards,
Bob
**Attention** This is a public forum