Strange issue with RS485 - Page 1
Forum section: electronics / projects

author: nardev
author_rank: Unknown
timestamp: February 07, 2024, 09:01:43 pm
content: 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 Device1. Computer communicates to "The Device" through both "My RS485-to-Serial" module OR "Aliexpress RS-485 <-> TTL" - OK2. My "Main Board" communicate just fine with "The Device" if i use "Aliexpress RS-485 <-> TTL" - OK3. 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.

author: berke
author_rank: Frequent Contributor
timestamp: February 07, 2024, 10:24:00 pm
content: 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?

author: nardev
author_rank: Unknown
timestamp: February 08, 2024, 12:09:58 am
content: I'm gonna try now with logic analyzer...

author: ajb
author_rank: Super Contributor
timestamp: February 08, 2024, 02:13:33 am
content: 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.

author: nardev
author_rank: Unknown
timestamp: February 08, 2024, 02:07:43 pm
content: Quote from: ajb on February 08, 2024, 02:13:33 amFirst 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.

author: ajb
author_rank: Super Contributor
timestamp: February 08, 2024, 03:52:57 pm
content: 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?

author: nardev
author_rank: Unknown
timestamp: February 09, 2024, 11:38:59 am
content: 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 tosecond 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 bep.s. third one i can't reproduce now...

author: ajb
author_rank: Super Contributor
timestamp: February 09, 2024, 03:58:10 pm
content: 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 atleast10x 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.

author: nardev
author_rank: Unknown
timestamp: February 09, 2024, 10:11:08 pm
content: Quote from: ajb on February 09, 2024, 03:58:10 pmThank 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

author: nali
author_rank: Frequent Contributor
timestamp: February 09, 2024, 10:26:27 pm
content: 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.

author: nardev
author_rank: Unknown
timestamp: February 09, 2024, 10:30:07 pm
content: Quote from: nali on February 09, 2024, 10:26:27 pmNo, 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.

author: nardev
author_rank: Unknown
timestamp: February 09, 2024, 10:42:29 pm
content: Or completely different theory, something is not ok with my main controller board, despite the fact that it works ok with "Aliexpress board".

author: nali
author_rank: Frequent Contributor
timestamp: February 10, 2024, 09:21:17 am
content: 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.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: February 10, 2024, 10:43:50 am
content: Quote from: nardev on February 09, 2024, 11:38:59 amRS485 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.

author: nali
author_rank: Frequent Contributor
timestamp: February 10, 2024, 11:53:10 am
content: 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

author: nardev
author_rank: Unknown
timestamp: February 11, 2024, 12:13:06 pm
content: Thank you all guys for looking into this.Can't wait to come back home to check this again today.@nalii 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?

author: nardev
author_rank: Unknown
timestamp: February 11, 2024, 12:16:02 pm
content: Here is the PCB traces, any clue there?

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 11, 2024, 01:31:28 pm
content: 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.

author: nardev
author_rank: Unknown
timestamp: February 11, 2024, 11:53:48 pm
content: 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 attenuatedHowever, 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

author: nardev
author_rank: Unknown
timestamp: February 12, 2024, 01:17:51 am
content: One more interesting finding1. 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!2. however, if i connect board to my device which is powered but turned off. So there is only GND connected to power source but power is off, there is continual buzzing sine between TC and GND.Any help would be appreciated. Schematics is up there.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 12, 2024, 07:59:07 am
content: 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.

author: ajb
author_rank: Super Contributor
timestamp: February 12, 2024, 05:03:34 pm
content: Quote from: nardev on February 11, 2024, 11:53:48 pmNot 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.Quote from: nardev on February 12, 2024, 01:17:51 amDon'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.Quote from: S. Petrukhin on February 12, 2024, 07:59:07 amNo, there's no indication of that at all. There could be, but OP has not provided any information that suggest that is the case.QuoteNo, 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.QuoteThere 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.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 12, 2024, 05:21:10 pm
content: 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.

author: tooki
author_rank: Super Contributor
timestamp: February 12, 2024, 05:30:12 pm
content: Quote from: S. Petrukhin on February 12, 2024, 05:21:10 pmThis is completely untrue and incorrect. See e.g. the response from TI inhttps://e2e.ti.com/support/interface-group/interface/f/interface-forum/923991/ground-connections-in-isolated-rs485-system

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 12, 2024, 06:07:16 pm
content: Quote from: tooki on February 12, 2024, 05:30:12 pmTI 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.

author: ajb
author_rank: Super Contributor
timestamp: February 12, 2024, 06:56:01 pm
content: 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.

author: nali
author_rank: Frequent Contributor
timestamp: February 12, 2024, 07:25:44 pm
content: 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.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 12, 2024, 07:32:38 pm
content: Quote from: ajb on February 12, 2024, 06:56:01 pmTTL 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.

author: nardev
author_rank: Unknown
timestamp: February 14, 2024, 11:55:20 pm
content: 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.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: April 17, 2024, 12:47:12 pm
content: Quote from: nardev on February 14, 2024, 11:55:20 pmHave you read the recommendations and switched to manual transfer mode control?