AnsweredAssumed Answered

Simple UART - Clear RX Buffer

Question asked by PHIL HALE on Dec 28, 2015
Latest reply on Jan 26, 2016 by Kyi Zaw Win

Hello again.

 

I am now receiving UART data in the rx callback buffer using the rx interrupt callback routine.

 

Now that I have "processed" the byte of data, how do I clear the buffer?  I have tried to set the first byte to '/0' or strcpy a null string and the buffer doesn't clear. I suspect that the buffer is a copy of the uartState->rxBuff when the rx callback routine is called. So, how do I clear the real rx buffer properly?

 

A little more detail:  When I type "a" then send out the resulting rx buffer I get "a", just as expected. But, after the subsequent character is entered, such as "b", printing out the rx buffer returns "ab"...and so on. The rx buffer is not getting cleared.

 

Incidentally, does the SDK implement a FIFO buffer by default?  Is this a FIFO clearing problem?  I didn't intentionally implement a FIFO is that is the case.

 

Thanks.

 

Phil

Outcomes