AnsweredAssumed Answered

IR communication echo removal through turning interrupt on and off

Question asked by Lakhani.Sagar on Mar 9, 2017
Latest reply on Mar 13, 2017 by howard n2wx

I am developing IR half duplex communication between two stm32f030 MCU, in the USART section, it is working as full duplex. i want that, whenever i receive anything from first usart, it is then sent to second usart. And to remove echo i want to turn off the usart receiving interrupt and turn it on as soon as it the data is sent to other usart. but the problem is when i do that, Echo is still received please give me any useful solution, i am attaching my code.

 

void USART2_IRQHandler(void)
{
USART_ITConfig(USART2, USART_IT_RXNE, DISABLE);
if( USART_GetITStatus(USART2, USART_IT_RXNE) ){

char t = USART2->RDR; // the character from the USART1 data register is saved in t
USART_SendData(USART1,t);

USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);

}

void USART1_IRQHandler(void)
{
USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
if( USART_GetITStatus(USART1, USART_IT_RXNE) ){

char t = USART1->RDR; // the character from the USART1 data register is saved in t
USART_SendData(USART2,t);

USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

}

Outcomes