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: TI-RTOS-MCU
Tool/software: Code Composer Studio
I'm developing an application for TM4C1294NCDPT using TI-RTOS. I'm facing a problem that I know how to solve using TivaWare drivers, but using TI-RTOS drivers for such is being a bit of challenge.
I'm using several UART interfaces and routing my packages to a single task responsible for make any processing required. I decided to make a single reception buffer and when any UART receives any package, I lock such buffer using a semaphore. It's working as described.
The problem I'm facing is when receiving any noise bytes, I fall in a deadlock condition. They way to solve this using TivaWare would be checking if there is any bytes available at UART before entering the UART_read blocking function and implementing a timeout to free the semaphore after a little while.
My question is: is there a fuction inside TI-RTOS to know beforehand if there is any bytes on given UART_Handle? Can I use the UART_Handle in conjunction with UartCharsAvail from Tivaware? How so?
The simplified version of my code is just below:
if(UART_read(uart, &input, 1) == 1) // wait for a single byte
if(Semaphore_pend(semHandle2, 100 / Clock_tickPeriod) == true) // try to aquire the semaphore
syscom->receiveChar(input); // put the received byte inside reception buffer
timeout = 3; // set a timeout, which is decremented in another context
while((input != EOT) && timeout > 0) // wait for my end of transmission byte or timeout to expire
UART_read(uart, &input, 1); // my routine get stucks here if i dont have any bytes
syscom->receiveChar(input); // save my byte on reception buffer
if(input == EOT)
// signaling for another task to process what is in inside the buffer
// timeout occorred
else // semaphore was already acquired by another uart interface (sit and cry)
System_printf("COM Blocked uart2!\n"); System_flush();
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to Sean Oliver28:
In reply to daniolip:
Ah yes, the MSP432E4 is one successor to the TM4C129 and so many of the peripherals/drivers are the same. But the naming is different.
The TivaC UART driver seems to have the same control function code UART_CMD_GETRXCOUNT as can be seen here in the doxygen page for TI DRIVERS in 2.16.01.14.
Let me know if you have further questions!
Hi Sean, That solved my problem. Now I can implement a timeout for incomplete messages and get rid of my deadlock condition. Thanks.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.