AnsweredAssumed Answered

Receive text file from HyperTerminal via UART

Question asked by labastie.florian on Mar 3, 2015
Latest reply on Mar 3, 2015 by labastie.florian
Hello everybody,

I have to send a file from the computer (so from HyperTerminal) to the STM3240G eval via USART3 (or any UART).
I wrote a program to receive one data from USART (getchar() ) and it works fine but I don't understand how I can receive more than one data ...
I think I have to play with the flag RXNE with a reset after each reception but i'm not sure.

My getchar() program :

char USART_getc(USART_TypeDef* USARTx)
{
    while(!(USARTx->SR & USART_FLAG_RXNE));
    return ((int)USARTx->DR & 0xFF);
}


My program to receive a text file from HyperTerminal

void reception_donnee(USART_TypeDef* USARTx,tablo tableau)
{
    uint8_t i;
    char T='\0';
    while(!USART_GetFlagStatus(USART3,USART_FLAG_RXNE) && (T !='\n') && i<SIZE_BUFFER)
    {
        T= USART3->DR;
        tableau[i]= T;
        i++;
    }
}


For information the SIZE_BUFFER is a constant for tablo. Here tablo[600] tableau.

I hope you understand my problem. If not, I can answer to your questions.
Sorry for my english mistakes, I'm French :)

Thanks in advance.

Outcomes