AnsweredAssumed Answered

USART RX interrupt receive data, while there is nothing.

Question asked by prieur.jean on May 29, 2014
Latest reply on May 30, 2014 by prieur.jean
Hello everybody.

I have a problem whith USART. I send data to my STM32F4 through USART3, everything works fine. But when I stop to send datas, the USART RX interrupt still receive the last char sent each time I use the USART TX. Hope I'm clear :)

This is my USART interrupt code:
void USART3_IRQHandler(void)
{
    static uint8_t data;
 
    // check if the USART3 receive interrupt flag was set
    if (USART_GetFlagStatus(USART3, USART_IT_RXNE) != RESET)
    {
           // Process the new received data
     usart_byte_to_MIDI_message(USART_ReceiveData(USART3));
    }
 
    // check if the USART3 is ready to send something
    if (USART_GetITStatus(USART3, USART_IT_TXE) != RESET)
    {
        // if there is a MIDI message to send (in the fifo buffer)
        if (fifo_bufferOut(&Midi_Out_Fifo, &data) == SUCCESS) USART_SendData(USART3, data);
        // if the fifo buffer is empty, DISABLE Transmit Data interrupt
        else USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
    }
}

I think this is because when I send datas with USART3 TX, USART3_IRQHandler() appends and the condition if (USART_GetFlagStatus(USART3, USART_IT_RXNE) != RESET) is true.

Why USART_IT_RXNE is not RESET if there nothing in USART RX ?

Thanks a lot !

Jean

Outcomes