-
Strange issue with RS485
Posted by
nardev
on 07 Feb, 2024 21:01
-
I just "solved" one issue and now a new one appeared. Strange one.
If you have any hint, i would be grateful a lot!
Ok, Three things:
- Main Board OR Computer
- "My RS485-to-Serial" module OR "Aliexpress RS-485 <-> TTL"
- The Device
1. Computer communicates to "The Device" through both "My RS485-to-Serial" module OR "Aliexpress RS-485 <-> TTL" - OK
2. My "Main Board" communicate just fine with "The Device" if i use "Aliexpress RS-485 <-> TTL" - OK
3. However, if i use "My RS485-to-Serial" to communicate between "Main Board" and "The Device", it works partially.
-
If i send message from "Main Board" through "My RS485-to-Serial" module, it passes and "The Device" responds ok as long as i'm catching the response on the side. So, the TX on "My RS485-to-Serial" module is not connected to RX on "Main Board". - If i also connect Everythign as it should, the response never arrives from "The Device".
What's confusing is that it does work with of the self module in all situations but with my board it seems like when "return message" line is connected, everything is down.I checked all the schematics, i had an issue with wrong capacitors but i changed it and everything should be 1:1 same as "Aliexpress RS-485 <-> TTL".
Here is the schematics (caps are corrected).
If you have any suggestion what to do now, how to check this, please.
-
#1 Reply
Posted by
berke
on 07 Feb, 2024 22:24
-
It seems that there is an attempt at automatically controlling the transmit enable using an R/C timer discharged using the data signal. Could work but it's tricky and the timing needs to be right, so that part of the circuit looks suspicious to me.
Are you able to probe those signals (/RE,DE) with a scope or a logic analyzer at the same time as RXD/TXD and A/B to see what's going on?
-
#2 Reply
Posted by
nardev
on 08 Feb, 2024 00:09
-
I'm gonna try now with logic analyzer...
-
#3 Reply
Posted by
ajb
on 08 Feb, 2024 02:13
-
What does "as long as i'm catching the response on the side" mean?
So "The Device" has an RS485 interface, and your "Main Board" and computer are using the TTL side of the adapter? What's the baud rate? What did you correct the cap value to?
As pointed out in your other thread as well as by berke here, using a cap to control the transceiver direction is tricky and could be part of the problem if the cap value isn't exactly right. It's worth checking that your stop bit configuration is the same between computer and "Main Board", a difference there could be part of the problem with this circuit.
Since you have a second RS485-TTL converter and a computer, you could tap into the RS485 bus and view the activity in a serial terminal. Seeing what appears on the bus might give a useful hint.
-
#4 Reply
Posted by
nardev
on 08 Feb, 2024 14:07
-
What does "as long as i'm catching the response on the side" mean?
So "The Device" has an RS485 interface, and your "Main Board" and computer are using the TTL side of the adapter? What's the baud rate? What did you correct the cap value to?
As pointed out in your other thread as well as by berke here, using a cap to control the transceiver direction is tricky and could be part of the problem if the cap value isn't exactly right. It's worth checking that your stop bit configuration is the same between computer and "Main Board", a difference there could be part of the problem with this circuit.
Since you have a second RS485-TTL converter and a computer, you could tap into the RS485 bus and view the activity in a serial terminal. Seeing what appears on the bus might give a useful hint.
First of all, thank you.
"catching the response on the side" means that i wire TX from the device to a USB-Serial-Computer and catch the response.
Btw. in that case the RXD LED on this board actually blinks where if i connect botx RX/TX to TX/RX, RXD LED doesn't blink. Whic is unusual for me.
Yes, i used exact caps as are used on the "Off the self" RS485 board.
I'm just about to probe bot of the things, my Digilent was not available until now.
-
#5 Reply
Posted by
ajb
on 08 Feb, 2024 15:52
-
Can you show a diagram of how everything is connected? Specifically, do you have grounds connected between boards on the TTL and RS485 sides? What you're describing with the RX line and the LED makes me think something isn't connected properly. Worth checking the RS485 A and B connections, having one of those disconnected can cause weird intermittent operation sometimes.
And what's the baud rate?
-
#6 Reply
Posted by
nardev
on 09 Feb, 2024 11:38
-
The baud rate is 9600.
No, i did not connect grounds there.
Btw. Here is the scope difference, the aligned one is TX/RX on a working board and the one which is significantly shifted is the one which has the problem i was complaining about.
Here is more.
first one:when my RS485 is plugged in as it should be, orange is TX from my board, blue is the response from "The Device" that i'm talking to
second one:Same as above but the response TX from "The Dervice" is on the side and probed separately.
Ground connected between My device, through My RS485 and "The Device" i'm talking to.
third one:
Same as the second but Ground disconnectedfourth one:The "Aliexpress" module which works ok, conencted between as it should be
p.s. third one i can't reproduce now...
-
#7 Reply
Posted by
ajb
on 09 Feb, 2024 15:58
-
You need to run your scope at a much higher sample rate. ~8ksps is nowhere near enough for even 9600 baud, you should be running at least 10x faster so you can see the individual bits in the serial stream properly.
But the first trace does give a hint about the problem: since we can see that the blue trace is stuck near 3.3V, something is holding the TX line up.
-
#8 Reply
Posted by
nardev
on 09 Feb, 2024 22:11
-
You need to run your scope at a much higher sample rate. ~8ksps is nowhere near enough for even 9600 baud, you should be running at least 10x faster so you can see the individual bits in the serial stream properly.
But the first trace does give a hint about the problem: since we can see that the blue trace is stuck near 3.3V, something is holding the TX line up.
Thank you
@ajbWell, the bits are the same, it's just "looks" attenuated when compared to the working module.
Which tells me that i should really check out the schematics again. Only things which could be slightly different is the hex inverted 5-6 that i used to power up the RX led.
Wondering, if that can ruin the signal?
p.s. removing R7/RXD, nothing changed
-
#9 Reply
Posted by
nali
on 09 Feb, 2024 22:26
-
What exactly are you probing here? The A & B lines?
RS485 as you have it here is a differential, half-duplex signal, so both A&B lines should have data for both devices transmitting (one should be the inverse of the other). There is no seperate RX & TX.
-
#10 Reply
Posted by
nardev
on 09 Feb, 2024 22:30
-
What exactly are you probing here? The A & B lines?
RS485 as you have it here is a differential, half-duplex signal, so both A&B lines should have data for both devices transmitting (one should be the inverse of the other). There is no seperate RX & TX.
No, not A and BA. I'm only focused on TX/RX as i can confirm that A/B are consistent.
But here is another thing.
I just wired scope to R0 of MAX3485 and here is what i have got. Looks like this could be ok signal just not inverted.
-
#11 Reply
Posted by
nardev
on 09 Feb, 2024 22:42
-
Or completely different theory, something is not ok with my main controller board, despite the fact that it works ok with "Aliexpress board".
-
#12 Reply
Posted by
nali
on 10 Feb, 2024 09:21
-
OK, in that case looks like you've got a short somewhere. Ajb mentioned it above, something's pulling txd high, so I'd guess you either have a short probably between pins 3&4 on J2, or maybe a defective U1.
-
-
No, i did not connect grounds there.
RS485 NEEDs a common round - without it you have no idea if the inputs are within the common-mode range of the receiver. There are some cheap 485 interfaces with no ground connection - throw them in the bin.
Trying to control TE with an RC network will often end in tears. Use a proper interface with active TE control produced by the UART to accurately enable the transmitter.
When debugging RS485, a scope (even a cheap crappy one) is essential. RS485's intrinsic robustness can be its downfall, as even when the hardware is partly broken ( data line open/shorted, resistive connections, water ingress, flaky transceiver etc.), it can "sometimes" work, so you may not be aware of issues until something else changes ( cable length, common-mode voltage, Phase of the Moon etc.) and problems surface.
-
#14 Reply
Posted by
nali
on 10 Feb, 2024 11:53
-
Agree with avoiding the RC network if possible. Some converters just use the data line to enable the transceivers directly which sort of works but it's only using half the transciver to drive the Space and relying on bias resistors to bring the line back to Mark (if I've remembered by RS485 polarity correctly)
Below is from a commercial transceiver used by a company I used to work at. These were only used for a 1-1 connection at 9600 with a twisted-pair cable of 5-10m though they do claim 115k max and 4000 feet @19200
-
#15 Reply
Posted by
nardev
on 11 Feb, 2024 12:13
-
Thank you all guys for looking into this.
Can't wait to come back home to check this again today.
@nali i can't trace any short there, wouldn't it be unusual that it works with PC<->USB-TTL<->My MAX485<->The Device but it doesn't work when instead of my computer and USB-TTL i switch to My Main controller board?
-
#16 Reply
Posted by
nardev
on 11 Feb, 2024 12:16
-
Here is the PCB traces, any clue there?
-
-
It seems to me that the main problem is the automatic switching of RX/TX.
It takes time for the transmitter to react and the line to discharge.
Personally, I don't like the idea with R5-C2 - you need to select the parameters so that the transmitter can switch, but the starting bit has not yet been completely eaten.
I did not understand the сhinese USB/RS-485, but it is likely that his USB/COM converter signals such as DTR/DSR are used there to control the transmitter, and they are formed not by the front of the incoming signal, but by the presence of a word in the buffer.
Moreover, using an uninsulated RS-485 is not the best solution.
-
#18 Reply
Posted by
nardev
on 11 Feb, 2024 23:53
-
weee..
new thing discovered but i still can't figure out why.
while connected to My Control main board, TX is connected to ground.
I have no idea why and how. But that explains why the signal is attenuated
However, the "Aliexpress board" doesnt" have that issue.
Also, i checked my board and all traces, also when it's disconnected and GND is definitely not connected to TX
-
#19 Reply
Posted by
nardev
on 12 Feb, 2024 01:17
-
-
-
Obviously, there is a high potential between the two devices.
You can measure it between the GND of two devices. But do not try to connect the GND of two devices - this can be disastrous.
I have already told you that an uninsulated RS-485 is not the best option.
Use ADM2582 or ADM2682 - it is as convenient as possible.
Or isolate your transmitter with optocouplers and separate power supply.
-
#21 Reply
Posted by
ajb
on 12 Feb, 2024 17:03
-
while connected to My Control main board, TX is connected to ground.
I have no idea why and how. But that explains why the signal is attenuated
Not really, because your scope traces show that TX is pulled UP to 3.3v, not down to Gnd. So there's something else going on. But I think you may have measured incorrectly, see below.
1. If i check continuity between GND and TX on "my RS485" board, while the board is disconnected from everything, i get very short buzz signal. and that's all. ALWAYS!
Don't use the continuity mode. Use regular resistance mode, and measure with the meter probes both ways around. There is active circuitry connected to these pins, with things like ESD diodes and input/output transistors, which can cause misleading measurements. Exactly what happens depends on the circuitry and the meter you use, but if you see different resistance measurements when you swap the probes, then you know something tricky is going on.
If you want further help, please provide more information. Photos or diagrams showing CLEARLY how EVERYTHING is connected would help a lot. Your descriptions aren't very clear and it's hard to understand how you have everything set up. That makes it very hard to help you.
Obviously, there is a high potential between the two devices.
No, there's no indication of that at all. There could be, but OP has not provided any information that suggest that is the case.
But do not try to connect the GND of two devices - this can be disastrous.
No, ground needs to be connected between all devices on both the TTL UART side AND the RS485 side. RS485 requires a common connection to work properly.
I have already told you that an uninsulated RS-485 is not the best option.
There is nothing wrong with a non-isolated RS485 link in most cases. RS485 is specifically designed to work with a common mode voltage offset of several volts. There are some situations that benefit from isolation, but no reason to believe that OP's situation would, or that isolation would solve the problems OP is experiencing.
-
-
If there is a grounding system, of course, it must be connected.
But you can not connect GND together - one of the sources can become a conductor for displacement and is quite rigid.
It is necessary to make sure that this does not happen.
But this does not guarantee the absence of a sufficiently high potential bias.
The sluggish glow of the LED and the ringing just hint at this, an unnecessary current is flowing somewhere.
Modern switching power supplies are not always good and often have the sin of bias.
-
#23 Reply
Posted by
tooki
on 12 Feb, 2024 17:30
-
-
-
If there is a grounding system, of course, it must be connected.
But you can not connect GND together - one of the sources can become a conductor for displacement and is quite rigid.
It is necessary to make sure that this does not happen.
This is completely untrue and incorrect. See e.g. the response from TI in https://e2e.ti.com/support/interface-group/interface/f/interface-forum/923991/ground-connections-in-isolated-rs485-system
TI has closed access to its website for Russia. They think closed...
However. Give me specifically what TI refutes my words?
Do the devices not need to be grounded or can you safely connect GND togever?
In addition, TI strangely equates PE to GND - I doubt the qualifications of the specialist who gave such answer.
I'm talking about the isolated transmitter example.
PE is never equal to GND for a normal engineer, but there is connection. Personally, I install a 1nF 2.5kV capacitor and a 1 MOm resistor between PE and GND.
And pay attention, in that answer talking about an isolated transmitter.
That is, the linear part of the transmitter is connected to one side and isolated from the other.
There will be no significant bias at the different ends of the twisted pair.
I wrote about this earlier too - as a more reliable way.
-
#25 Reply
Posted by
ajb
on 12 Feb, 2024 18:56
-
There are plenty of app notes out there you can read that show how RS485 networks should be wired, but going on about this isn't going to help the OP, because there is no indication that the RS485 link is the problem. In fact, the OP's scope screenshots suggest that the RS485 data is coming through just fine, but there is some issue with the TTL side of things that is keeping the output of the adapter high.
-
#26 Reply
Posted by
nali
on 12 Feb, 2024 19:25
-
Lots of puzzling factors and lack of photos or diagrams make it kinda hard to pin anything down exactly. What is the mystery board and "device" for example?
The continuity reading sounds like a distraction, maybe an ESD diode or voltage offset causing dodgy readings. if it was *RXD* shorting that could be a reversed pinout on J2 but not TXD.
OP needs to break things down into logical blocks. I'd start by disconnecting "the device", remove U2 and link the RO & DI pins. That should give local echo between TX & RX and test the integrity of the signal path via all the U1 gates (U1 could be counterfeit, static damaged etc). Check the enable signal on U2(2,3) works when you type. Then replace U2 and maybe use the Aliexpress adapter with another UART & see if you can type between them. Then connect the device, see if it stops working etc etc.
-
-
There are plenty of app notes out there you can read that show how RS485 networks should be wired, but going on about this isn't going to help the OP, because there is no indication that the RS485 link is the problem. In fact, the OP's scope screenshots suggest that the RS485 data is coming through just fine, but there is some issue with the TTL side of things that is keeping the output of the adapter high.
TTL can be affected by currents of parasitic loops, so the connection method is also important here.
But, as I pointed out earlier, the most suspicious thing is the automatic switching to transmission along the front of the first bit.
We are waiting for the author to check it out and discuss the essentials so as not to get bored.
-
#28 Reply
Posted by
nardev
on 14 Feb, 2024 23:55
-
Well, thank you very much for all of you for your kind efforts.
Everything is pretty find with my board and another board but not everything looks to be fine with my "main controller board".
Also, why some of the boards RS485 work and not my board. Well, i have used 4069 IC for hex inverted and the working "RS485 Aliexpress" board uses 74HC04 and that's the only difference i was able to determine.
Also, i got several different RS485-TTL boards from amazon, from different manufacturers and same thing happened.
I have no idea in depth what could be the difference when CMOS Schmitt Trigger on 74HC04 is used vs this one but that's how it is.
I would love to know if it is safe, i would switch the hex on my board and use it like that.
-
-
Well, thank you very much for all of you for your kind efforts.
Everything is pretty find with my board and another board but not everything looks to be fine with my "main controller board".
Also, why some of the boards RS485 work and not my board. Well, i have used 4069 IC for hex inverted and the working "RS485 Aliexpress" board uses 74HC04 and that's the only difference i was able to determine.
Also, i got several different RS485-TTL boards from amazon, from different manufacturers and same thing happened.
I have no idea in depth what could be the difference when CMOS Schmitt Trigger on 74HC04 is used vs this one but that's how it is.
I would love to know if it is safe, i would switch the hex on my board and use it like that.
Have you read the recommendations and switched to manual transfer mode control?