cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving Null byte on UART Rx everytime I send something on UART Tx (485 mode)?

MFord.1
Associate III

Hi all,

I am using an ST32F091 micro and using RS-485 to communicate over the UART port. I have a 485 transceiver that handles the 485 scaling part.

I am using an interrupt based Rx and Tx on the UART. I am encountering a very weird problem in that whenever I send something using HAL_UART_Transmit_IT() I receive a null byte on my HAL_UART_Transmit_IT() immediately.

This null byte is offsetting all of the received bytes by one and is messing everything up.

Here is my UART setup:

0693W000003BGoVQAW.png

here is my test main:

0693W000003BGoaQAG.png

After every "Test" transmit my Rx interrupt triggers with a null byte.

Does this maybe have anything to do with the DE control or timing? I am out of ideas.

Thanks!

2 REPLIES 2

How do you control RE on the RS485 transceiver, is it connected to DE or to ground? Do you have some fail-safe pullup/down on the RS485 bus?

Observe the Rx pin using oscilloscope/logic analyzer (LA).

JW

prain
Senior III

Maybe your usart RX pin is in floating state,​ so RS485 direction change affects the RX pin and produce a falling edge. try RX pin internal pull up