2020-07-24 10:42 AM
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:
here is my test main:
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!
2020-07-24 12:18 PM
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
2020-07-27 05:08 AM
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