Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

RS485 Pi issues with modbus.

The RS485 Pi is an RS485 interface for the Raspberry Pi

22/06/2017

Posted by:
edis

edis Avatar

Hi. I'm having issues using the RS485 Pi with modbus. If I connect it to the bus with only the slave (EVCO EVK411M7; http://www.evco.it/en/15754-evk) connected, the slave doesn't respond to queries. If I add another RS485-USB dongle to the bus it starts working (the dongle has to be plugged in the USB port; if it is not plugged, the communication is not working). I've checked the communication with an oscyloscope and the only difference is, that the whole signal shifts for about 200mV. The whole signal is completely the same (same form, same noise etc.). The difference between high and low is (if I remmeber correctly) about +2,2V.The peculiar thing is (it might not be peculiar since this is the first time I'm working with RS485 or modbus) when the communication is not working, the low signal is 0V and the high is 2,2V. When I power the RS485-USB dongle, the signal shifts for about -200mV, so the low is -0,2V and high is +2V. Is the first situation (lo:0V, hi:+2,2V) by the book. In other words, conforming to the RS485 standard (I can't find anyting usefull and definitive on the internet)?Just for comparision, the signal the RS485-USB dongle is producing is lo:-2V, hi:+2V. Any help would be very appreciated. Kind regards,Edi

22/06/2017

Posted by:
edis

edis Avatar

To be clear. When it is not working, the slave (EVCO) doesn't respond at all.

22/06/2017

Posted by:
andrew

andrew Avatar

Hi Edi

RS485 uses a differential signal for communication so the receiver should measure the difference between the two wires to determine if the signal is high or low. According to the standard, the difference has to be at least ±200mV but that can be anywhere in the voltage range of –7V to 12V so a low signal of 0V and a high of 2.2V would be within the standard as the difference is more than 200mV. Similarly, your RS485-USB dongle is also within the standard as -2V to +2V is more than a 200mV difference. If the Modbus device conforms to the RS485 standards then it should recognise signals from the RS485 Pi or the USB dongle.

Does your Modbus device have a terminator resistor fitted? If not then reflections on the wire could stop it from working.

22/06/2017

Posted by:
edis

edis Avatar

Hi Andrew. I'm sorry, I'm not too fammiliar with the terminology, so I will clarify a bit more (so that I can understand exactly what is happening). With the osciloscope I'm measuring the difference between the A and B wires. The RS485Pi gives 0V (difference between the wires) for the logical "0" on the bus and the difference of 2,2V for the logical "1". So, you are saying that this is ok with the standard, since there is more than 200mV difference between the logical "0" and the logical "1". Do I understand you correctly?But, to put it short, I solved the problem. I came across a document named "Specification and implementation Guide for MODBUS over serial line (http://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf). And there I learned, that in some cases, you need "Line polarisation". This must be implemented if at least one device requires it. Unfortunately, the EVCO device has practically non existent documentation (at least not avalable on-line) and I didn't know I had to use it. Anyway, the polarisation means, you have to pull the line A to +5V, and the line B to the common line (ground) through 450-650 Ohm resistors. When I did this it started working immediately.And I now noticed another thing in this document (page 22). It states that the voltage V0 is the voltage of the line A and V1 is the voltage for the line B. For the binary 1, V1>V2 and for the binary 0, V0>V1. So, in my case, the difference between V0 and V1 was 0, so technically this is prohibited I guess. I hope my interpretation is correct. Anyway, it is working now and thank you for your help.

22/06/2017

Posted by:
edis

edis Avatar

Btw, I tested with and without the line terminators. No difference. Also the osciloscope showd very small spikes because of the missing terminators.

22/06/2017

Posted by:
andrew

andrew Avatar

Hi Edi

I am glad you managed to get it working. RS485 seems to be a very flexible specification with different companies interpreting it in different ways.

The line termination resistors are needed mainly for high speeds or if you have long cable runs between the devices as it gives more space for reflections to build up. On short cables, you can often go without the terminators.

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout