AnsweredAssumed Answered

STM32f205 manual half-duplex on UART

Question asked by fritzsche.tobias on Sep 1, 2015
Latest reply on Sep 2, 2015 by fritzsche.tobias
Hello!
I use a interrupt controlled uart communication which sends and receives its data over a powerline circuit. Both sending and receiving work fine but due to the circuit all the data which is send on TX will be received at the same time on RX. To prevent receiving my own data all the time I'd like to disable the receiving interrupt during transmission. I tried to do this via the following function:
void PL_SendData(uint16_t data)
{
    USART_ITConfig( USART6, USART_IT_RXNE, DISABLE );    //disable the receiving interrupt
    USART_SendData(USART6, data);                        //actually send the data
    USART_ITConfig( USART6, USART_IT_RXNE, ENABLE );     //enable the receiving interrupt
}

Inside the interrupt I simply send all received data over a different uart connection.
void USART6_IRQHandler (void) {
    if (USART_GetFlagStatus (USART6, USART_FLAG_RXNE) == SET)
    {
            GPIO_Toggle_LED(1);
            //send all data to another UART
            USART_SendData (USART2, USART_ReceiveData (USART6));
    }
}

My expected behavior would be that I only see data on USART2 which comes from the communication partner of USART6 but NOT the data USART6 is sending itself.
Unfortunately I still receive every message on USART2 which is transfered by USART6.

Did I disable the interrupt correctly or did I miss something else? I'd be glad about some advice!
Thanks in advance

Outcomes