# Mega2560 master on RS485 bus stops communicating with VFD when I add another RS485 module

I’m doing a project where I’m building a control panel for a VFD (inverter/variable frequency drive). I’m connecting the two over half duplex RS485 and use Modbus RTU. As a master I use a Arduino Mega 2560 with a TTL to RS485 module. Yes the VFD and the Mega are correct baud rates (9600) and pairity (8N1), it works if the master and VFD are the only devices on the bus. But when I add another slave (Arduino nano) with this TTL to RS485 module (even without a microcontroller nad no code) the communications seems to be broken.

I’m using a shielded twisted pair wire of about 3 metres to a circuit board daisy-chaining the module for the nano (10cm) and the VFD (1 meter).

What did I try?

I started with the mega as master, nano as slave, and the VFD as slave. Because I did not know the extra module on the bus was causing the problem at this point I was wondering if it was my code or hardware setup. I’ve read multiple topics of people having trouble with the Mega and the RS485 module but never got to the exact problem or a solution. I need the mega for the scale of my control panel so I kept digging.

I use modbusmaster (see example of halfduplex on the github) and then just 2 lines of code writing to single register (0x2000, 0x0006 for example) just as a simple test to start/stop the VFD. Worked before when testing the VFD and an UNO as the only two devices on the bus, why not now? The nano slave does not have any code at this point to rule out any software issues interfering. I tried flushing as well, did not solve the problem.

Back to hardware troubleshooting

So I tried the same setup with another nano as a master instead of the mega (leaving the other nano as slave connected). It works! But I need the Mega… So I started looking into things. I tried hardware serial, altserial and softwareserial. None worked. Then I started questioning the lines, nothing that was having short-circuits or big interference (doing this in my living room, not on an industrial site). When I pulled out the module for the nano slave and it started to work with mega as master and the VFD as only slave connected.But hell why, I need the nano slave to be on the bus as well!

Trying termination resistors

So I desoldered R5 to R7 (termination resistors) of the extra module, which helps for some people. Leaving the module of the mega as is. Same situation, communication is fine until I drop in the module for my nano slave.

Making the nano slave repeat works??!

I also experimented with the communication between the mega master and the nano slave, that works! But the VFD will not listen to the master. When I programmed the nano slave to repeat what it hears (yes, like a parrot) then the VFD is responding correct with the setup I want (master, VFD slave, nano slave). But the nano slave should not be the one acting as a master, let alone repeat a message on the bus. The weird thing here is, the VFD is not responding to the message of the master, but the nano picks it up and is able to repeat it so the communication IS correct somehow, but not good enough for the VFD?? I'm really freaking out now.. I can't sleep anymore! please help.

Other ideas

I do admit, I have grounded the shield of the 3 meter cable on both ends, but this should not be the problem, it works with just a master and the VFD as slave setup so why not when adding another module for the nano as slave.

The line is now measuring 120 ohm resistance (comes from the TTL to RS485 module on the Arduino Mega side). The VFD has a jumper, on position is 18,2 kOhm and off position is 500 ohm. Due to the parallel connection no matter what position the line resistance between A and B stays on or around 120 ohm. The problem just occurs when attaching the extra module for the nano slave, even when I leave out the slave itself.

Anyone out there who might be able to help me troubleshooting this? Anything I don’t know of? (Yes my first RS485/Modbus application, but doing good so far I guess).

Should I desolder the termination resistors of the other module as well? Any other ideas on why the communication would be broken when I throw in another module?

If anything is unclear, please tell me. I tried my best to clarify the setup and what I tried. Again, code does not seem to be an issue here.

UPDATE

schematic of the converter

Hope this helps

• You'll have to be clearer about what the failure mode is, perhaps by first investigating that. What state is the code in? Is it not transmitting? Is it transmitting but being ignored? Are collisions happening? With just two wires you should be able to hook up an RS485 converter to an ordinary UART and log everything from everybody, parse it and see if it makes sense. – Chris Stratton Aug 14 '18 at 15:02
• I tested the communication between master mega and slave nano, it is sending and receiving. But the VFD will only act on commands when the slave nano is diconnected from the bus, or when I let the nano slave repeat the message from the master mega. The RS485 converter is connected to UART. – Matthijs van Hest Aug 14 '18 at 15:05
• Again, you need to figure out what is happening when the system fails. Setup something to capture all traffic on the wire (like an additional RS485 converter connected to a USB UART and PC for receive only monitoring) and write scripts to interpret that. Give your master some additional status outputs... Also make sure that you only have termination resistors at the physical ends of the line, nowhere else. – Chris Stratton Aug 14 '18 at 15:06
• The fact that you even tried module in the middle with termination resistors tells me that there could be more wiring problems in your setup. You need to post complete wiring diagram and links to the adapter modules you use if you want to get meaningful help. – Maple Aug 14 '18 at 15:21
• For the third time, you need to figure out how. Either buy a scope and probe the lines, or rig up something to let you see what is going on, like the previously mentioned outputs from your master or PC based scheme for snooping the entire bus. And make sure that when you have your "without code" module in there, you've wired the transmit enable inactive and not merely left it floating. – Chris Stratton Aug 14 '18 at 15:40

You should correct your schematic symbol to show the logical sense of the enables - DE is active high and /RE is active low. Then change your circuit to default them safely.
If you're going to keep using this defective module as is, you'll have to be sure that the DE pin is always kept low, except at the proper time for that node to transmit.