ABB Inverter(slave) + MAX485 + Arduino(master) : 0xE0 (ModbusMaster invalid response slave ID exception)

I am trying to perform the acquisition of data from an ABB inverter (PRO-33) with MAX485 with the arduino as master. I have already tested the TX / RX ports of the inverter with a USB-RS485 adapter and I can get the data perfectly using a SCADA. But when I test the code with the same Modbus parameters with arduino I get the error 0xE0 (ModbusMaster invalid response slave ID exception). The ID I am using is the same as that shown on the inverter monitor and for which I was able to obtain the data with SCADA … I don’t understand why this error appears! Mainly because I tested the code with the Modbus Tools simulator as a slave and I was right.
  • I connected the A and B of the inverter to A and B of the MAX485. On the arduino I placed the DI and RO pins on TX1 and RX1, respectively. And pins RE and DE on 2 and 3.
 
Are you using this Modbus library for the Arduino?
https://github.com/4-20ma/ModbusMaster

If so, the 0xE0 error code is explained here:
https://4-20ma.io/ModbusMaster/group__constant.html#ga19521b4671bdc1ded03af72e2f3b958e

The description of that error states, "The slave ID in the response does not match that of the request."

This would seem to indicate one of two possibilities:
1. A bug in the ModbusMaster Arduino library where it is not properly matching the slave ID of the request and response.
2. A Modbus driver bug with the ABB inverter where it is not putting the correct slave ID in its response.

I recommend that you use a Modbus master software tool to make the same request to the ABB inverter and view the communication traffic. Both ModScan and Modbus Poll have the ability to show communication traffic. The slave ID is the first byte in the request and response.

ModScan
https://www.win-tech.com/

Modbus Poll
https://www.modbustools.com/modbus_poll.html
 
Hi,
Yes, I am using the ModbusMaster library.
I used Scada software that supports Modbus serial, in the settings I used the ID 07, the address on the equipment, and everything went well.
I also used ModbusTool to simulate a slave with the code in Arduino and it also went well. But when I turn on the inverter, it always gives this error.
Thanks for the indication, I will test the software you indicated.
 
HI, i used the ModbusPoll (image below). The Slave ADDRESS is 7 and the entire structure of the message received is in accordance with the plan. This leads me to believe that the problem is between the MAX485 and the Inverter or in the ModbusMaster library (as you indicated). I don't know how to solve it. Please, do you have any idea how I can solve it?

ModPoll.png
 
Great, you've confirmed that the ABB inverter is responding correctly.

This could be a case of a misleading error code taking us down the wrong path. It's possible the ModbusMaster library is returning this error as a catch-all due to some other issue.

One guess is that the Arduino may be receiving its own request transmissions and interpreting it as a response.

  • I connected the A and B of the inverter to A and B of the MAX485. On the arduino I placed the DI and RO pins on TX1 and RX1, respectively. And pins RE and DE on 2 and 3.
Since you have the RE and DE connected to pins 2 and 3 on the Arduino, is your code setting both of these pins to 1 before transmission and returning them both to 0 after transmission as shown in the following example?
https://4-20ma.io/ModbusMaster/exam...x_2_r_s485__half_duplex_8ino-example.html#_a0

Additionally, I recommend that you use the getResponseBuffer() function to inspect the response packet that the ModbusMaster library has received from the inverter when you receive the 0xE0 error and see if/how it differs from the responses you see in Modbus Poll. This will allow you to confirm whether or not the first byte is the inverter's address (0x07) and should help narrow down the issue.
 
Hi,

Since you have the RE and DE connected to pins 2 and 3 on the Arduino, is your code setting both of these pins to 1 before transmission and returning them both to 0 after transmission as shown in the following example?
https://4-20ma.io/ModbusMaster/exam...x_2_r_s485__half_duplex_8ino-example.html#_a0
Yes, my code setting both of these pins to 1 before transmission and returning them both to 0 after transmission.

Additionally, I recommend that you use the getResponseBuffer() function to inspect the response packet that the ModbusMaster library has received from the inverter when you receive the 0xE0 error and see if/how it differs from the responses you see in Modbus Poll. This will allow you to confirm whether or not the first byte is the inverter's address (0x07) and should help narrow down the issue.
I used the getResponseBuffer(), but i so receive 0.
 
If you're receiving all 0's, then this may be an indication that your A and B wires are swapped.

On some equipment A is + and B is -, but on others, it's reversed A is - and B is +.

Try connecting A to B and B to A between the MAX485 and inverter.
 
When I change A and B the error is 0xE2 (timeout error). I have also replaced the Arduino boards and the MAX485 converter.
 
OK, let's try to rule out the hardware and your connections. Can you please try the following?

First, connect your USB/RS-485 adapter to the inverter and establish communications using Modbus Poll. After you have confirmed successful communications between your PC and the inverter, close Modbus Poll and power down the inverter, but keep your USB/RS-485 adapter wired to the inverter.

Next, add wiring from the inverter to the MAX485/Arduino, while keeping the wiring from your USB/RS-485 adapter connected to the inverter. Open your Modbus Tools simulator on your PC, run your application on the Arduino and establish successful communications.

Finally, close the Modbus Tools simulator and power on the inverter. Assuming you were able to successfully perform the above steps and are using the same slave ID, register address, etc. settings, you should be able to communicate between the Arduino and inverter.
 
One additional note regarding wiring. RS-485 actually requires 3 signals, not just 2 (+, -, and ground).

Please make sure that all of your devices (USB/RS-485 adapter, MAX485/Arduino, and inverter) share a common ground connection.
 
Yes, establishing communications between Modbus Tools on your PC and the MAX485/Arduino should be done with the inverter powered off.

Both the Modbus Tools simulator and the inverter should be configured for the same Slave ID, so you cannot have both on the RS-485 network at the same time.
 
One additional note regarding wiring. RS-485 actually requires 3 signals, not just 2 (+, -, and ground).

Please make sure that all of your devices (USB/RS-485 adapter, MAX485/Arduino, and inverter) share a common ground connection.

I didn't really connect to GND, is it possible that this is the reason for the error?
 
I didn't really connect to GND, is it possible that this is the reason for the error?
Yes, not connecting an RS-485 reference wire (a.k.a. common/ground) can cause devices to be unable to communicate. If the grounds are very different, the RS-485 circuitry of the devices could even be damaged.

An important thing to note is that RS-485 reference/common/ground is NOT the same as shield. The RS-485 reference/common/ground provides a 0V reference for the + and - signals and must be connected to every RS-485 devices' ground reference.

The shield, on the other hand, is to prevent induced and radiated EMI and must be daisy chained through the entire network and connected to earth ground only at one end of the bus.
 
Yes, not connecting an RS-485 reference wire (a.k.a. common/ground) can cause devices to be unable to communicate. If the grounds are very different, the RS-485 circuitry of the devices could even be damaged.

An important thing to note is that RS-485 reference/common/ground is NOT the same as shield. The RS-485 reference/common/ground provides a 0V reference for the + and - signals and must be connected to every RS-485 devices' ground reference.

The shield, on the other hand, is to prevent induced and radiated EMI and must be daisy chained through the entire network and connected to earth ground only at one end of the bus.
Thank you so much for the explanation! As in most of the tutorials that I saw indicated that there was no need to connect to GND, I didn't do it. Unfortunately, I will only be able to test again on Monday because the inverter is at the university. As soon as I test it I will return here. Thank you very much for your attention and help.
 
You're quite welcome. Glad to help.

I also wanted to point out another thing that can cause devices to be unable to communicate, which is if you have termination resistors on the bus without applying appropriate idle biasing (note that some devices have built-in termination resistors that can be enabled through a dip switch, configuration setting, by shorting pins together, etc.). This can cause the RS-485 differential (+ to -) voltage to drop within the undefined -200mV to +200mV range.

Termination should only be applied at the far ends of the RS-485 bus and is really only necessary when using long cable runs and high baud rates. The purpose of termination is to dampen signal reflections on the RS-485 wires. When using short cables and low baud rates, these reflections dampen out on their own well before the bits are sampled by the devices, so termination is unnecessary.

Additional information on when termination is necessary can be found here:
https://e2e.ti.com/blogs_/b/analogw...nation-is-necessary-and-how-to-do-it-properly

Please remove/disable any termination that you may have on your devices, at least until you have achieved successful communication.
 
I also wanted to point out another thing that can cause devices to be unable to communicate, which is if you have termination resistors on the bus without applying appropriate idle biasing (note that some devices have built-in termination resistors that can be enabled through a dip switch, configuration setting, by shorting pins together, etc.). This can cause the RS-485 differential (+ to -) voltage to drop within the undefined -200mV to +200mV range.
Ok, i'm using the converter MAX485 (picture follow) .. with termination resistor of 120ohm. Do I have to remove the resistor even though it is connected to the only device on the RS485 network?
The network cabling is short.

1607110539056.png
 
irst, connect your USB/RS-485 adapter to the inverter and establish communications using Modbus Poll. After you have confirmed successful communications between your PC and the inverter, close Modbus Poll and power down the inverter, but keep your USB/RS-485 adapter wired to the inverter.

Next, add wiring from the inverter to the MAX485/Arduino, while keeping the wiring from your USB/RS-485 adapter connected to the inverter. Open your Modbus Tools simulator on your PC, run your application on the Arduino and establish successful communications.

Finally, close the Modbus Tools simulator and power on the inverter. Assuming you were able to successfully perform the above steps and are using the same slave ID, register address, etc. settings, you should be able to communicate between the Arduino and inverter.


Hi,
I did the procedure you indicated and also connected the inverter's GND to the MAX485 and Arduino. I was not successful, I can only get data only if I use the USB / RS485 adapter and use Modbus Poll but with Arduino I can't. The last alternative really is to include the resistors in the circuit.

One question: if I used the USB / RS485 converter and connected to the arduino using another USB / TTL converter, would I be able to establish a successful communication?
 
Top