AnsweredAssumed Answered

STM32F0 - USART receiving only first package of data

Question asked by bosz.adam on Dec 14, 2013
Latest reply on Dec 24, 2013 by Andrew Neil
I have big problem with USART transmission. Here's my simple code:
In main():
-----------------------------
while(1) {
     get_data();
}
-----------------------------

And in get_data():
----------------------------
int get_data(void) {
     uint8_t data[20];
     uint8_t counter = 0;

     while (counter < 6) { // I just want to get first 6 characters 
          if ((USART1->ISR & USART_ISR_RXNE) == USART_ISR_RXNE) {
               data[counter++] = USART1->RDR;
          }
     }
     counter=0;
}
----------------------------
Everything is fine when I receive first pack of data, but then, when I'm second time in get_data function I can only get a few characters from previous pack of data (after the 6 first which I got already) but I can't get any more. I can't get a new package of data. Even if I try few times. Receiver seems to be turned of after getting only 6 first characters from longer message (about 15). Why is that? How to solve this problem?
I'm using STM32F0Discovery.

Outcomes