We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi there,
I've succesfully set up my UART on my MCB-STR9 eval board.
However, when I'm reading a recieved character from the UART DR register it holds that character (when fifo is not enabled!)
when the UART fifo is enabled, after 16 characters it holds that character (and goes into the loop because my software thinks there is a new character everytime I check the DR register)
My ECHO function is:
u8 RxData; while(1) { RxData = UARTx->DR; if(RxData != 0)UARTx->DR = RxData; }
My question is: Am I doing something wrong with reading the incoming characters?
Thanks!
You have an infinite loop that reads the data register. But this loop will not pause and wait while the UART receives any character. If you have 9600 baud, you can manage to send and receive up to about 1000 characters/second. How fast do you think your processor can run through your infinite loop?
Look at the status register for the UART. It contains a lot of nice little helpful flags telling you if there are data available to read out, and if there is room to send more characters.