AnsweredAssumed Answered

uart driver, best design for async messages, mqx missing char's in blocking mode

Question asked by Robert Lewis on Jun 15, 2014
Latest reply on Sep 30, 2015 by dave408

K20, MQX 4.01


We are talking to a serial uart that may asynchronously receive messages. We can't just read in non blocking mode because we may miss the message window or pick up parts of the message for the same reason. So we do a fstatus check for a character in non blocking mode and use a timer when a message has started to arrive, then guess at how long to delay to receive a complete message. Herein is the problem. We have to empirically guess at how long between message requests and how long are the message responses because we don't know the length of the message. This is a poor way to work obviously.


Is there any way to just read a full message where a message is defined as the first character received and the last character of the message is a null, for example, and then have an alert/irq/event fires that says. "A message exists"?


Is there anyway to set the driver control so that the serial stream is buffered and the buffer is determined to be complete when a null or other char is received in mqx? We have tried doing an fstatus check followed by a blocking read but char's are missed in the stream, even at 9600 baud.


Any advice would be appreciated.