RS485 hardware connection issues.

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
I have a problem with a hardware board where i do not receive the uart data but the board can transmit. The transceiver is SN65HVD08D, i have given 3.3V as supply to the transceiver, but the micro controller is 5V so the DE, UART Rx and Tx are all 5V from the microcontroller. i am testing using USB to RS485 converter connected to the PC. USB to RS485 Converter Module - leetechbd
1782880031717.png
 

Irving

Joined Jan 30, 2016
5,195
That's maybe because for most MCU a logic 1 is 0.7Vdd = 3.5v @ 5v, and your UART Rx output is not high enough. Try running the UART on 5v, or a 10k pullup resistor to 5v on the Rx pin might work.
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
That's maybe because for most MCU a logic 1 is 0.7Vdd = 3.5v @ 5v, and your UART Rx output is not high enough. Try running the UART on 5v, or a 10k pullup resistor to 5v on the Rx pin might work.
Changing the VCC from 3.3V to 5V on the RS485 transceiver SN65HVD08D is what you are recommending, am i correct?
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
I have changed from 3.3V to 5V i find some improvement in that the receive interrupt is triggered but data is always 0 even if i send any value from coolterm software. Below are the observations

1. The waveforms when i send the data from coolterm is as below from A to Ground, the waveform does not look good.
1782915713293.png

The waveform when i transmit from board to cool term is as below when i send 'A' continuously and received properly
1782915840135.png

Observation2: When i tried to send a character i also receive data at the same time
1782916005344.png
61 is what i send the letter a but at the same time i also receive 4F, if i send different characters, i receive different characters. i am flashing only the receive program with D set as 0.
1782916114101.png when i click something TX and RX glow at same time.
Observation: There is a blue led indicating RXD which always glows with full brightness, but TXD for transmission blinks when transmitted.
1782916412055.png
 

MrChips

Joined Oct 2, 2009
34,974
Replace R4 and C8 with one 120 ohm resistor.

Be aware that some devices and interface boards have A and B functions interchanged.
 

Irving

Joined Jan 30, 2016
5,195
That doesn't match the product datasheet.

To test & validate, Put a 10k pullup on Rx, and 10k pulldown on DE/REN. Remove R7/R8/C8/R4, and add 120ohm between A & B. R7/R8 just define bus state when all nodes are idling on larger systems, they aren't needed for testing. C8 is going to have an impact on received data - I've never seen that actually used on a RS485 bus, but if used (and not needed here) the capacitor is measured in pF not uF:

"AC Termination

AC termination is used to reduce the power consumption of idle links as well as to reduce ringing voltages. The negative effect though is a reduction in cable length and bit rate. A resistor and capacitor can be placed in series across the bus (between A and B) as shown in Figure 5. The Capacitor CT is selected by using the following formula:"
1782928496485.png
 

Irving

Joined Jan 30, 2016
5,195
Oh, when looking at differential signalling, measuring to ground is meaningless - use two probes on A & B then use 'scope math function to do A - B. to see actual bus voltage. To measure common mode voltage, split the termination resistor and measure from there to ground.
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
Below are the changes i have done
a. Removed the capacitance C8, it effectively means R4 is removed.
b. Added 100 Ohms resistance between A and B externally
c. For DE / REN as of now i have tried activating the internal pull down of the pin using
1782967378956.png
but not sure if it actually works.

I see improvement in that the code receives the data sent.
One issue still remains the terminal receives some data when i send data, as mentioned in the previous posts. And the RXD led always ON when i make DE low. Only when i make DE high for transmission from controller it goes OFF.
1782967548322.png

I will try the other recommendations now.
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
I have interchanged the A and B, now the RXD led does not glow continuously, one time is sent from coolterm with no immediate rxd data, but the controller receives invalid data
ex:
1782970495977.png

i am unable to figure out which is A and which is B.
 
Last edited:

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
I have measured the voltage between A and B using differential probe with *20 factor and below are the results
1782980998696.png
and it aligns with around 2.5V on the positive side and -2.5V on the negative side.

when the bus is idle 5mV * 20 = 100mV
1782981137418.png

As per the analog devices document you have shared page 6 and 7
1782981292469.png
does the tool will be in undefined state? Do i need to actually put a valid pull up and pull-down resistor to avoid it? One observation from my schematic is as per the document A line to be pulled up and B to be pulled down but is reverse in the schematic. How do i proceed is the issue with USB to RS485 converter do i need to buy a better one?
 

Irving

Joined Jan 30, 2016
5,195
Receiving while sending is normal usage for a multi-drop system to implement anti-collision strategies. In a pure Master - Slave scenario you can simply ignore received data until the last Tx byte has actually left the UART, though checking that you received what you expected to transmit is useful for line integrity checks.

RS485 designates voltages for logic 1 A<B and logic 0 A>B but does not define bit protocol. Normally the line should idle at logic 1 ('mark' in RS232 parlance) and the start bit is a logic 0, stop bit a logic 1.

Disconnect the USB adapter from the RS485 and the USB. Measure the resistance from A to B both ways round - it should be either 120ohm or a high resistance >10k. If high, connect 120ohm resistor from A to B. Connect to USB but not RS485. Without transmitting, measure voltage A to B with 'scope. It should ideally be logic 1. If not, connect A to +5v (OUT) on adapter with a 10k and B to GND(OUT) with 10k. Confirm that output is now logic 1; if not swap A and B over. Now transmit 0x00 and 0xFF alternately on 8N1 configuration and show the results here. 0x00 should be 9 0s and at least one 1 before the next 0, and 0xFF should be one 0 and 8 or more 1s before the next 0.

Once that's working do the same with the STM board. Once both ends are operating identically connect them together so that the A and B polarities match.

1782987420650.png
 
Last edited:

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
Hello Irving,
I have made most of the connections, i got a question, in the USB to RS485 product sheet on the internet it was mentioned to use the +5V for any external purpose, and i assume that A and B are already driven by internal supply, I am confused how do i proceed?
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
One conclusion i have reached after multiple testing is whenever the A is pulled to ground i can see that the RXD is glowing continuously, so can i remove both the pull up and pull-down resistors as you have mentioned already. In the schematic i can see that A is pulled to ground may be it is mistake.
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
288
Receiving while sending is normal usage for a multi-drop system to implement anti-collision strategies. In a pure Master - Slave scenario you can simply ignore received data until the last Tx byte has actually left the UART, though checking that you received what you expected to transmit is useful for line integrity checks.

RS485 designates voltages for logic 1 A<B and logic 0 A>B but does not define bit protocol. Normally the line should idle at logic 1 ('mark' in RS232 parlance) and the start bit is a logic 0, stop bit a logic 1.

Disconnect the USB adapter from the RS485 and the USB. Measure the resistance from A to B both ways round - it should be either 120ohm or a high resistance >10k. If high, connect 120ohm resistor from A to B. Connect to USB but not RS485. Without transmitting, measure voltage A to B with 'scope. It should ideally be logic 1. If not, connect A to +5v (OUT) on adapter with a 10k and B to GND(OUT) with 10k. Confirm that output is now logic 1; if not swap A and B over. Now transmit 0x00 and 0xFF alternately on 8N1 configuration and show the results here. 0x00 should be 9 0s and at least one 1 before the next 0, and 0xFF should be one 0 and 8 or more 1s before the next 0.

Once that's working do the same with the STM board. Once both ends are operating identically connect them together so that the A and B polarities match.
I understand now what you told i will perform the tests and post it.
 

Irving

Joined Jan 30, 2016
5,195
Hello Irving,
I have made most of the connections, i got a question, in the USB to RS485 product sheet on the internet it was mentioned to use the +5V for any external purpose, and i assume that A and B are already driven by internal supply, I am confused how do i proceed?
Yes, they are driven, while transmitting. But in the idle state when no device is transmitting they are not driven so the bus state becomes indeterminate which to the Rx port looks like a 0. This is not ideal as a transmitter could come online already transmitting a start bIt and that could be missed by one or more receivers. Since RS485 does not define signalling protocol it cannot dictate how a transmitter should behave

Biassing resolves that. Only 1 node needs the bias to be applied, but on a large network it's not obvious who that would be, so the default position is that each gets a small bias so as not to overly increase bus loading. 10k resistors and local power sources are sufficient for bench testing. On a larger system over long cable lengths where that power is supplied from may need careful consideration.

On another point, there is a lot of confusion about which way round A & B should be ie is A>B a 0 or a 1? From the UARTs perspective a start bIt is a 1 to 0 transition. RS485 defines a 0 as A>B >=3v and a 1 as A<B <= -3v ie negative logic, whereas AN960 appers to define logic 1 as A>B , ie A-B > 3v. The short answer is that it doesn't really matter as long as both ends match. Hence test what each transmitter does in isolation, designate A & B on the basis A>B is logic 0 and adjust the bias resistors to maintain a 1, A<B on idle. Since the PCB is the hardest to change, use that as the guide, as long as the biassing is correct.

Useful link on RS485/422/232 signalling
 
Last edited:
Top