MAX485 signal level problem

Hi All!

I am experimenting with a MODBUS sensor and I can not receive it's answer to my request.
I am able to send the request message through the MAX485 module ( I can see it with my oscilloscope), the sensor is sending the requested data (I can see it with my scope too). But I get no data in the MEGA.

The problem is - I think:
The signal (between the MEGA and the MAX485 module) is too "weak": about 0,5V (HIGH: 4,675V, LOW: 4,253V).
I attached a picture of the scope - the blue signal is the MODBUS A+ line. The first transmission is the request, the second is the data from the sensor. The red signal is the RX line between the MEGA and the MAX485 module, where the "reply" transmission is present - but the signal is not "high" enough.

The setup:

Arduino MEGA Serial1 --> MAX485 --> Sensor RS485 (MODBUS)
I think the problem is not in the code - so I did not post it yet.

I already set up this communication with an MKR1310 and an MKR MAX485 module, whitout any problem.

Thanks for any help.
Gergo

Have you put your MAX485 into the receive state after the mega had transmitted the message?

Hi markd833!

Yes, the DE pin is HIGH, (connected to the +5V). I choose this solution as I wanted to be sure, that the rx can receive the data.

G

Your DE PIN should only be high when your MEGA transmits, not permanently connected to +5v.

Normally you connect RE and DE together and connect them both to a port pin. Set the port pin high, then transmit your data, then set the port pin low once your data has been transmitted.

If you connect DE permanently to +5v then your MAX485 is in permanent transmit mode, i.e. driving the 485 bus. So when the receiving device tries to respond, it is fighting with your MAX485 for control of the bus.

Hi markd833!

Thanks for the advice, you were right. Although my problem is not over yet... I can see this on the scope now:
The red signal is the RX line on the MEGA
The blue signal is the MODBUS line A+

The MAX485 is transferring one or two bytes and the rest is "lost".

Do you have any idea?

THX
G

I think your blue waveform looks about the right amplitude in the message on the left hand side. As for the message on the right hand side of the blue wave form, that doesn't look right.

How have you wired up the RS-485 connection between the 2 devices?

Do you have your termination resistors (about 120R) at each end of the RS485 bus?

Do you have your pull up and pull down resistors as well? You might not need these if you have fail-safe receiver chips?

Analog Devices have an nice app note (AN-960) that might be of use to you.

Hi markd833!

Thanks for your answer and the manual.

I do not think it's the line, 2 days ago the Arduino MKR1310 with the MKR RS485 shield worked fine with it. But here is my setup:

Arduino MEGA connected with breadboard wires to a MAX485CSA board. The "device" is a Schneider Electric EasyLogic PM1200 (manual here: https://drive.google.com/file/d/0B3MjwacHV9zAeHN3ZHA5SnlIcG8/view) on the desk connected with two 60cm 0,75mm2 wire.

MAX485 A --- PM1200 D1+
MAX485 B --- PM1200 D0-

The distance is very short and device has a built-in impedance (according to the manual) this is why I do not think it could be the line...

Anyway... I did what you suggested:

  1. Put a 160ohm resistor between A and B. No change in the lineforms.
  2. Put another between D1+ and D0-. No change.
  3. Put in 660ohm resistor between 5V and A, and 660ohm between GND and B. No change (not even the signal level has changed)
    The 5V supplied by the board is only 4,7V, I do not know if this is important or not.

I think I will try this setup with AUX power tomorrow...

If you have any other idea, I appreciate your help.
THX.
G

I had a look at the manual you linked to.

It does say on page 47:

Data port has built-in impedance matched design for low reflectance on
long data cables at high Baud rates. Eliminates need for complicated
impedance matching resistors at the ends of long data cables.

but then on page 48 it talks about adding an external terminator. Either way, I think we can discount that as you have already added a 160R between the data lines.

If you believe that you have your RS-485 cabling correct, then the next thing is to look at what the Arduino MEGA is doing.

I don't know how many channels you have available on your oscilloscope, but you could try:

1.) CH1 onto the DE pin (or RE pin if they are joined together) and CH2 onto the DI pin.

Have a look at the waveform when the MEGA transmits. You should see the DE pin go high, then the data appearing on the DI pin. Once the data has finished, you should see the DE pin go low. You might need to put a delay in your code so that the data has a chance to clear the MEGA UART Tx buffer before you drive DE low.

You also want DE to go low as soon as the data has been transmitted so that you are ready for the reply from the PM1200.

2.) CH1 on the DE pin (again) and CH2 on one of the RS485 data wires (either the + or the -).

You should see that your DE pin has gone back low before the PM1200 puts its data on the bus. You might want to check both the + and the - wires.

3.) CH1 on the RS485+ and CH2 on the RS485-.

You should see 2 waveforms that are the mirror image of each other.

If all that seems ok, then I think you can assume that your MEGA is transmitting correctly, the RS485 bus is working ok and that the PM1200 is responding correctly.

Hi markd833!

Thanks for the help!

I checked the signals as you suggested and found the problem... The breadbordwire connecting the MAEGA and the DE pin was defect... (I picked the signals from the contacts of the RS485 board this time)

It works now.

Thanks for the help! :slight_smile: Again and again.

In the past I had problems with wiring, than I promised myself to change all the wires if something is behaving strange... I think I will keep this promise in the future...

Gergo

Glad you got it working in the end.