AnsweredAssumed Answered

Serial Read with TimeOut - Interrupt, blocked with explicit # char's - UART

Question asked by Robert Lewis on Jun 22, 2013
Latest reply on Jun 24, 2013 by Robert Lewis



I am looking for a way to read a specific number of char's from the serial uart channel. If I use blocked and the char's are not received the task hangs... I understand that. But if I use unblocked, I get the number of char's in the stream at that point which may not have been in the window of opportunity.


I can't just put a time delay in and return with whatever is in the buffer; that is non deterministic. We are checking the response from a BT module and the responses are async based on the users response time/or not. I need to call the fread/read function requesting an exact number of char's, but return after a timeout period if we don't get all the char's or any. Other drivers I have worked with have a QIO_TIMEOUT value regardless of blocking/non blocking. Is there anyway to implement this functionality without hacking the mqx driver?


I thought of scheduling a task to do the read using a global buffer and flag, then terminate the task if we timed out. But that seems a bit...lame.


Does anyone have a suggestion please? Thanks