Go Down

Topic: Odd problem with RS485 messasging between 2 uno's (Read 1 time) previous topic - next topic

adwsystems

Are the RS-232 modules half-duplex? Do the RS-232 modules have TX and RX enable lines (Ri and Do)?

chopperaddict

I am not using RS232 modules, just software serial lib and defining ports as required for
Tx and Rx ?  I only have 2 wires for RS232 between the defined pins on M and S, and they work just fine receiving and transmitting from both ends.

I have tried replacing the M<-TX to S<-Rx with the Di connection of the RS485 but left as original (on separate pins) on the S. I have pulled the Enable pin of both RS485 boards high and low without any success.

No data flows either way.

Is there any way I can use my DMM to check these boards perhaps ?  I have tried A-B on each board and get around 2.5v fluctuating a little. Checking the A-A and B-B at opposite ends I am seeing the same 2.5v BETWEEN A-B and B-A, not on the expected A-A and B-B ?  The opposite (A-A and B-B) show almost zero volts.

My poor understanding of the protocol leads me to believe that basically when working one side will be at or around 5v ( sending data) and the other at 0v. the reverse is true when the network is quiet

adwsystems

How do you have RS-232 if you do not have any RS-232 modules? Are you just connecting TX/RX with wires and using 0 & 5V (TTL)?

Protocol refers to the data format (software), RS-232 and RS-485 refer to the electrical signals in the network (hardware). For example, you can use Modbus, over RS-232, RS-485, and over Ethernet. Same protocol, different networks, different electrical signal requirements.

Since you haven't changed the software and only the hardware changed, then there must be something wrong with the hardware.

You should be able to setup the RS-485 modules and drive the pins with jumper wires, while testing the inputs and outputs (ie., do no connect to the Arduino until you know they work in both directions)

chopperaddict

I am really sorry to be dim, but hardware is not my forte as you can tell !

As I have said, I am using the software serial library to create my RS232 port on each Uno, I then declare 2 objects, one for RS232 direct connection, the other for the RS485 board.

I think I understand correctly that the DE and RE pins on the 485 are just the DTR and RTS pins of the RS232 i/f, the RO and DI are the TXD and RXD of the 232     So far ?

So my theory is that if I apply 5v to to the DO pin of the 485 **AND** pull the ENABLE pin high, the A output should show around 5v and B show near zero v ?  Reverse that entirely and apply 5v to B which should appear at RO when ENABLE pin is pulled LOW

If I am wrong, can you please describe exactly how I can "Test" the board by driving the pins with jumpers (ENABLE pins I assume we mean here ?)

adwsystems

#34
Apr 08, 2018, 06:27 pm Last Edit: Apr 08, 2018, 06:27 pm by adwsystems
We need to get to the same lingo to understand what you have in both hardware and software. Software does not declare hardware. You do not declare in software to use RS-232 hardware. The software declaration is a serial port. Which adapter, if any do you have attached to the serial port you have declared in software? USB, RS-232, RS-485, Ethernet?

I understand that you have RS-485 boards available. Do you have any RS-232 boards (same look, but different output)?

Testing the board is simple. Hook up 5V and ground to each board and connect the A and B wires as they should be. Then use jumper wires to configure one for TX and the other for RX. On the RX board attached a voltmeter to the RX line and ground. To the TX board, jump TX to +5V and ground. The voltmeter should respond (may be inverted where TX ground gives +5V RX). Then reverse the setup and test again. Timing is of no importance. There is no 'protocol' we are trying to adhere to, and there is no processor to complain about it. This is strictly a hardware test.

In the process you will be able to gain an understanding of which lines need to have which voltages to do what.

chopperaddict

I agree totally about lingo.  First I think I mislead you by using the term RS232 for what is just a 2 wire pin to pin connection using the serialsoftware library to handle whatever protocols are required by that connection.  I also understand the difference betwen hardware protocols and software protocols.

I have about 3x485 boards available, but I do not have any 232 boards.

i THINK I UNDERSTAND YOUR LAST PARA, THANKS FOR THAT, so will test it all out and let you know what results I get !

adwsystems

I have learned that with all the clone and cheap stuff floating around in the Arduino world, I need to test the hardware or have a baseline of some sort to ensure it is the hardware and not the software that is causing the issue I am observing. That's why when venturing into new territory, I start from Hello World and work outwards. Always maintaining a step behind me that is a known working version that, if need be, I can fall back to and try again.

You know that with pin to pin at TTL level your software works. You added the RS485 boards and boat sunk. Let's check the boards to make sure they work and how they work.

chopperaddict

You have a great outlook on this process for sure.  As you say, this chinese gear is less than reliable, but we all assume it is going to work.

I think I am up against that very issue right now.  I have wired 3 off 485 boards onto a breadboard, fed them 5v from an outside source, and then checked the voltages at Ro, Enable and Di (I will just call them R,E,D)

To my surpise, they all returned totally different values so I have no basis to work from.  Do you know what voltages I should see on the R, E and D pins with just thier own 5v supply connected, but connected to each other via A and B ?

I just cannot get a sensible starting position right now ?

adwsystems

#38
Apr 12, 2018, 04:29 pm Last Edit: Apr 12, 2018, 04:30 pm by adwsystems
I don't know what "totally different voltages" mean. Should be 0 or 5V on the R, E, D pins. Pins A and B are another story.

I'm going to be guessing at how the boards are wired, but it is an educated guess by looking at the MAX485 data sheet.

Connect 5V, GND  and A-A and B-B

From here you need to test all 4 possible combinations. With two boards only and using 1 power supply and no Arduinos:

Board 1 En to GND, Di to GND, Board 2 En to 5V, What is Board 2 Ro reading?
Board 1 En to GND, Di to 5V, Board 2 En to 5V, What is Board 2 Ro reading?

Board 2 En to GND, Di to GND, Board 1 En to 5V, What is Board 1 Ro reading?
Board 2 En to GND, Di to 5V, Board 1 En to 5V, What is Board 1 Ro reading?

pylon

Quote
Should be 0 or 5V on the R, E, D pins.
That could be anything as these pins are floating most of the time if not connected. Most of them are inputs and Ro is floating if Enable (to be clear RE) is not pulled low actively. Post a wiring diagram of your current setup if you want exact forecasts but from your description I got the impression that you didn't wire these to the Arduino, so they're floating.

The test setup of adwsystems is correct. Post the results of these.

adwsystems

The test setup of adwsystems is correct. Post the results of these.
Maybe I had it mostly right. If the Ro pin is floating that would explain those "totally different values" on that one pin.

Let's add a 10K from the Ro pin to 5V. Just in case. Either way it won't hurt anything. Probably should also use another 10K when connecting En to 5V.

pylon

Quote
Probably should also use another 10K when connecting En to 5V.
That's not necesary (at least if the En contact is connected to the RE/DE pins of the MAX485), you can connect it directly to 5V.

chopperaddict

OK, here we are finally :

4.9v     Board 1 En to GND, Di to GND, Board 2 En to 5V, What is Board 2 Ro reading?
4.9v     Board 1 En to GND, Di to 5V, Board 2 En to 5V, What is Board 2 Ro reading?

0.001v Board 2 En to GND, Di to GND, Board 1 En to 5V, What is Board 1 Ro reading?
0.001v Board 2 En to GND, Di to 5V, Board 1 En to 5V, What is Board 1 Ro reading?

I have chcked and rechecked every connection etc, and done the testing several times, often getting different readings, hence the connection checking.  These readings are definitely correct.

What do they tell you ?

Thanks guys

adwsystems

It tells me your voltmeter is working and I think I screwed up the instructions.

When En is ground it sets that MAX485 to receive on Ro. When En5 is 5V it sets it to transmit on Di.

Lets try again.

Board 1 transmit, Board 2 receive:
Board 1 En to 5V, Di to GND, Board 2 En to GND, What is Board 2 Ro reading?
Board 1 En to 5V, Di to 5V, Board 2 En to GND, What is Board 2 Ro reading?

Board 2 transmit, Board 1 receive:
Board 2 En to 5V, Di to GND, Board 1 En to GND, What is Board 1 Ro reading?
Board 2 En to 5V, Di to 5V, Board 1 En to GND, What is Board 1 Ro reading?

chopperaddict

Ho hum :-))

Board 1 transmit, Board 2 receive:
0.015v  Board 1 En to 5V, Di to GND, Board 2 En to GND, What is Board 2 Ro reading?
 4.6v     Board 1 En to 5V, Di to 5V, Board 2 En to GND, What is Board 2 Ro reading?

Board 2 transmit, Board 1 receive:
0.005v  Board 2 En to 5V, Di to GND, Board 1 En to GND, What is Board 1 Ro reading?
0.007v  Board 2 En to 5V, Di to 5V, Board 1 En to GND, What is Board 1 Ro reading?

Have retried with them connected to the Uno's, still no comms occuring.  Tests above with Unos disconnected !

Go Up