cancel
Showing results for 
Search instead for 
Did you mean: 

wrong UART interrupt is getting fired

Anwar.786
Associate II

I am using UART to transmit and receive data. for transmitting I am using polling method function HAL_UART_Transmit(&hart1, buf, 8,1000) and for receiving i am using HAL_UART_Receive_IT(&hart, Rx_buf,8);

receiving is working fine but after transmitting any data the receive callback is getting fired and after that the receiving interrupts are not getting fired even though I am transmitting data from another device.

17 REPLIES 17

uint8_t RX_Buf[8];

uint8_t i;

uint8_t TX_Buf[8]={1,2,3,4,5,6,7,8};

uint8_t Uart_status;

these are the variables I am using.

Answers to your questions

  • RX_Buf is for storing the data once the reception is completed.
  • TX_Buf is having a size 8 and the data is 1,2,3,4,5,6,7,8.
  • I am using STM32H743BIT6 and Dock light software.
  • Yes, havent implemented the code for Uart_status.
  • During all the transmissions.
  • I mentioned those in above.

I am using STM32H743BIT6 and i selected STM32H743BI

@Guenael Cadier​ please have a look

Sorry @Anwar.786​  i'm a bit lost. I'm afraid I don't uderstand your issue.

From my understanding, if data that are sent on Tx are echoed on rx, it is normal in my opinion, that Rx complete callback is triggered in the use case you described :

  • start reception of 8 bytes in IT mode
  • Sent 8 bytes on Tx => also received on Rx
  • Reception is considered as complete, as expected data have been received
  • Rx Complete callback is executed

Please correct me if I'm wrong.

@Guenael Cadier​ 

  • start reception of 8 bytes in IT mode
  • Sent 8 bits on Tx in blocking mode and receiver received it correctly.
  • receiver is not sending any data, but I am getting a callback to RX with the same data which I transferred.

So it looks like there's a connection between your Tx and Rx pins on sender side.

If you look at RX pin signal with a logic analyzer, what do you see when you are sending your 8 bytes ?

Either bytes are really echoed by distant part, or it is a hw issue on your sender device.

What happens if you disconnect anything from the sender device ? Is your Rx callback still executed ?

Karl Yamashita
Lead II

So it comes down to how the hardware is connected. Is this a custom board with a STM32H743BIT6? I assume you are using a USB<>Serial adapter to connect to Docklight and if so what is the part # or link to the adapter? A block diagram of your connections would help a lot.

I Can't Believe It's Not Butter. If you find my answers useful, click the accept button so that way others can see the solution.

@Guenael Cadier​ Thanks for your help.

I found the issue, as you said the real issue is with the hardware, I am using Uart to RS485 with an auto direction circuit that auto direction circuit is causing an echo of transmitted data in Rx line since Receiver is configured in interrupt mode it is generating the interrupt.