Maker Pro
Maker Pro

RS485 trouble

S

ScadaEng

Jan 1, 1970
0
I have worked allot with RS232, and other serial protocols, but this is my
first RS485 project. It seemed straight forward to me, but now I have a big
problem.

I am using the max490 chip. I'm doing full duplex, 4 wire. Each of my nodes
have the max490 communicating with a 16F877A pic chip. The whole project
will have 25 nodes. I just built two pcb's (nodes) and individually they
work as expected. However when I put both of them on the rs485 bus, I can't
talk to either of them! Probably some kind of collision, but as it turns out
my scope just died and I'm on a tight deadline. Any help is greatly
appreciated.
 
D

D Yuniskis

Jan 1, 1970
0
ScadaEng said:
I have worked allot with RS232, and other serial protocols, but this is my
first RS485 project. It seemed straight forward to me, but now I have a big
problem.

I am using the max490 chip. I'm doing full duplex, 4 wire. Each of my nodes
have the max490 communicating with a 16F877A pic chip. The whole project
will have 25 nodes. I just built two pcb's (nodes) and individually they
work as expected. However when I put both of them on the rs485 bus, I can't
talk to either of them! Probably some kind of collision, but as it turns out
my scope just died and I'm on a tight deadline. Any help is greatly
appreciated.

What sort of protocol do you have in place? Do you think you
can just start chattering any time?
 
G

George Jefferson

Jan 1, 1970
0
ScadaEng said:
I have worked allot with RS232, and other serial protocols, but this is my
first RS485 project. It seemed straight forward to me, but now I have a
big problem.

I am using the max490 chip. I'm doing full duplex, 4 wire. Each of my
nodes have the max490 communicating with a 16F877A pic chip. The whole
project will have 25 nodes. I just built two pcb's (nodes) and
individually they work as expected. However when I put both of them on the
rs485 bus, I can't talk to either of them! Probably some kind of
collision, but as it turns out my scope just died and I'm on a tight
deadline. Any help is greatly appreciated.

Sounds like you are not enabling them properly. Obviously they cannot all
communicate at some time and there must be some type of
arbitration/negotiation.

Since it seems that it has to do with the number of devices chances are this
is the problem. How are you arbitrating the chips? AFAIK there is no built
in arbitration for RS485 unlike I2C so you'll have to implement it yourself.

Basically only one chip can be enabled to communicate at any one time and
you do this either by selecting that chip or where each chip checks to see
if the bus is free(if the enable pin is low then it can raise it and take
control(for the most part as it is possible two or more devices could
simultaneously take control which can cause problems)).

You really haven't given enough information to give any real help. AFAIK
RS485 wasn't meant to be used as a bus(but I have done no real work with
RS485 so I could be wrong and I'm not saying it can't work). If that is the
case then that is your problem and you'll need to go from there.
 
S

ScadaEng

Jan 1, 1970
0
Bit Farmer said:
Check your output enables. You can't have both on at the same time. The
system must be designed to allow only one transmitter to be on at a time.
The easiest way to do this is to have the master poll each device in turn.
When polled, each device can then send either a NoData packet or reply
with the data that it needs to send. This approach was used for several
generations of point of sale systems and works quite well. You will need
to have unique addresses for each device and a means of setting them.

b. Farmer
That's the thing, there are no output enables with the max490 chip. I do
have unique addresses, and I can call each board by itself with it fully
functioning. Its when I put more than one board on the network(485) that I
can't commmunicate with any of them. Not that it should matter, but I am
using a modified RTU Modbus protocol.
 
S

ScadaEng

Jan 1, 1970
0
ScadaEng said:
That's the thing, there are no output enables with the max490 chip. I do
have unique addresses, and I can call each board by itself with it fully
functioning. Its when I put more than one board on the network(485) that I
can't commmunicate with any of them. Not that it should matter, but I am
using a modified RTU Modbus protocol.
And yes, I am polling each device one at a time.
 
M

Martin Riddle

Jan 1, 1970
0
ScadaEng said:
That's the thing, there are no output enables with the max490 chip. I
do have unique addresses, and I can call each board by itself with it
fully functioning. Its when I put more than one board on the
network(485) that I can't commmunicate with any of them. Not that it
should matter, but I am using a modified RTU Modbus protocol.

You need the 489 - 491 with transmitter Enables and implement that in
your protocols.
Looks like you need to hack the board too, since the it’s a 14 pin
device.

Cheers
 
S

ScadaEng

Jan 1, 1970
0
Martin Riddle said:
You need the 489 - 491 with transmitter Enables and implement that in your
protocols.
Looks like you need to hack the board too, since the it's a 14 pin device.

Cheers
I understand the transmit enables, but how does the 490 chip do it? It has
no transmit enables, it must negotiate the transmit in some fashion.
 
J

Joerg

Jan 1, 1970
0
ScadaEng said:
That's the thing, there are no output enables with the max490 chip. ...


There are. It's called DE, pin 3 on the SO package. You need to use those.

... I do
have unique addresses, and I can call each board by itself with it fully
functioning. Its when I put more than one board on the network(485) that I
can't commmunicate with any of them. Not that it should matter, but I am
using a modified RTU Modbus protocol.

If you don't use the DE pins I have no idea how you'd get this working.
In case you do use them, have a polling system set up like Bit Farmer
described and it still doesn't work I urgently suggest you borrow a
scope. Someone in the area has got to have one, it can be a fairly
simple and slow 2-channel scope. Best would be a digital scope but I
guess with the tight deadline you can't be picky.
 
J

Joerg

Jan 1, 1970
0
ScadaEng said:
I understand the transmit enables, but how does the 490 chip do it? It has
no transmit enables, it must negotiate the transmit in some fashion.


Whoops, Martin was right, I had mixed it up with the 481. With an enable
there is no negotiation, it's always driving in the direction the input
says it should.
 
S

ScadaEng

Jan 1, 1970
0
Joerg said:
There are. It's called DE, pin 3 on the SO package. You need to use those.



If you don't use the DE pins I have no idea how you'd get this working.
In case you do use them, have a polling system set up like Bit Farmer
described and it still doesn't work I urgently suggest you borrow a
scope. Someone in the area has got to have one, it can be a fairly
simple and slow 2-channel scope. Best would be a digital scope but I
guess with the tight deadline you can't be picky.

Thanks for your input, Joerg, however I must disagree. There are no enables
on the max490 chip. They do exist on the 489, 491 however not on the 491.
The 491 is apparently auto negotiable, however I can not find documentation
on how it is implemented. Thanks.
 
M

Martin Riddle

Jan 1, 1970
0
ScadaEng said:
I understand the transmit enables, but how does the 490 chip do it? It
has no transmit enables, it must negotiate the transmit in some
fashion.

No it does not. If you look at the application info, its used for
repeaters.

What you can do, is use one chip for RX and one for TX. And power down
the TX chip when not transmitting.
When the 490 is powered down its output might be in a high impedance
state. Look at the LTC490.
Or use a transceiver with enables.


Cheers
 
J

Joerg

Jan 1, 1970
0
ScadaEng said:
Thanks for your input, Joerg, however I must disagree. There are no enables
on the max490 chip. They do exist on the 489, 491 however not on the 491.
The 491 is apparently auto negotiable, however I can not find documentation
on how it is implemented. Thanks.

Yep, sorry, mixed it up the the 481. Never heard of auto-negotiation
though. How would they know which one is allowed to transmit?
 
H

hamilton

Jan 1, 1970
0
I have worked allot with RS232, and other serial protocols, but this is my
first RS485 project. It seemed straight forward to me, but now I have a big
problem.

I am using the max490 chip. I'm doing full duplex, 4 wire. Each of my nodes

Looking at the data sheet:
http://datasheets.maxim-ic.com/en/ds/MAX1487-MAX491.pdf

The MAX490 does not have an enablse on either the TX or RX, see table on
the first page.

The MAX490 is not for multi-master applications.

Its for a one-to-one or one to many applications.

Check out the data sheet for the correct usage.

sorry

hamilton
 
S

Spehro Pefhany

Jan 1, 1970
0
Thanks for your input, Joerg, however I must disagree. There are no enables
on the max490 chip. They do exist on the 489, 491 however not on the 491.
The 491 is apparently auto negotiable, however I can not find documentation
on how it is implemented. Thanks.

THere's a good reason for that... it isn't.


Best regards,
Spehro Pefhany
 
S

ScadaEng

Jan 1, 1970
0
Tim Wescott said:
You have to turn the transmitter on under processor control, and for that
you have to have an enable pin on the transceiver. That chip isn't really
an RS-485 transceiver at all -- it's more a 422 transceiver without
internal terminations.

Sorry. That's the breaks.

Either daisy-chain everything, with board 1 transmitting to board 2 etc.,
back to board 1, and wait for the system failure when one board fails, or
rip out the 490 and put in a real 485 transceiver, like the MAX-485.

Yeah, thats what I was affraid of. I was grabing at straws, I was hoping
someone would see a way out of this. Thats what happens when you get caught
up in the rush, and get talked into "not waisting time making a prototype".
I think I will order the max491 and hack the hell out of 25 boards.

Thanks to everyone for your responses.
 
P

Paul Keinanen

Jan 1, 1970
0
That's the thing, there are no output enables with the max490 chip.

You can use that chip only on the master.

In a "4 wire RS-485" network, the master will always have both the Tx
as well as Rx active all the time.

The slaves will always have the Rx enabled (listening for the master
Tx pair), however, the slave Tx must only be activated, when that
slave has been addressed and is ready to send the response to the
master. Have you looked at e.g. MAX485, which has separate
ReceiverEnable and DriverEnable pins, which you need for the slaves.

I do not know about the PIC UART, but make sure that actually the last
stop bit for the last byte has been transmitted out of the shift
register, before turning off the transmitter.

Some stupid UART designs such as the 14550 family generate an
interrupt when the last byte has been loaded into the Tx shift
register, however, you can not turn of the transmitter at time, but
you have to wait for the last byte has actually been shifted out.

For Modbus, you should actually keep the transmitter enabled for an
additional 3.5 character times after the last data byte has actually
been transmitted (thus sending constant Mark state), however, with a
properly terminated line, this is not necessary as the last stop bit
will put the line into the Mark state and the "fail-safe" termination
will keep the line in Mark state, even if the transmitter is disabled.
 
N

Nico Coesel

Jan 1, 1970
0
ScadaEng said:
I have worked allot with RS232, and other serial protocols, but this is my
first RS485 project. It seemed straight forward to me, but now I have a big
problem.

I am using the max490 chip. I'm doing full duplex, 4 wire. Each of my nodes

You can't do full duplex on a RS485 bus with more than two nodes
unless you use some kind of hub. Every device needs to receive the
transmit signal from all other devices.
 
S

ScadaEng

Jan 1, 1970
0
Paul Keinanen said:
You can use that chip only on the master.

In a "4 wire RS-485" network, the master will always have both the Tx
as well as Rx active all the time.

The slaves will always have the Rx enabled (listening for the master
Tx pair), however, the slave Tx must only be activated, when that
slave has been addressed and is ready to send the response to the
master. Have you looked at e.g. MAX485, which has separate
ReceiverEnable and DriverEnable pins, which you need for the slaves.

I do not know about the PIC UART, but make sure that actually the last
stop bit for the last byte has been transmitted out of the shift
register, before turning off the transmitter.

Some stupid UART designs such as the 14550 family generate an
interrupt when the last byte has been loaded into the Tx shift
register, however, you can not turn of the transmitter at time, but
you have to wait for the last byte has actually been shifted out.

For Modbus, you should actually keep the transmitter enabled for an
additional 3.5 character times after the last data byte has actually
been transmitted (thus sending constant Mark state), however, with a
properly terminated line, this is not necessary as the last stop bit
will put the line into the Mark state and the "fail-safe" termination
will keep the line in Mark state, even if the transmitter is disabled.
You make a good point about the UART, I will be sure to look into the
timing. As for the new chip, I'm going to test with the max491, I am keeping
my 4 wire configuration, I don't want to change more by going two wire.
Thanks for your input.
 
P

Paul Keinanen

Jan 1, 1970
0
That's the thing, there are no output enables with the max490 chip. I do
have unique addresses, and I can call each board by itself with it fully
functioning. Its when I put more than one board on the network(485) that I
can't commmunicate with any of them. Not that it should matter, but I am
using a modified RTU Modbus protocol.

One dirty non-standard trick that has sometimes used in RS-232
environment _might_ work with constantly on RS-422 transmitters (such
as MAX490) on RS-485 buses.

Put a diode in series between the RS-422 output port and the RS-485
bus. Two diodes are required with opposite polarity for the Tx+ and
Tx- ports. The diode polarity must be set so that they conduct only
when Space ("0") is transmitted, but isolate the transmitter from the
bus, when Mark ("1") is transmitted.

When the transmitter is in the Idle Mark state, the bus is pulled to
the Mark state by the "fail-safe" termination resistors on the bus or
driven to Space by an other transmitter.

The diodes will reduce the noise margin by the diode voltage drop and
not be used, when making "RS-485" compliant slaves.

However, if you are in full control of both the master and slaves and
the slaves and the cables between them, you might consider this dirty
trick.
 
S

ScadaEng

Jan 1, 1970
0
Paul Keinanen said:
One dirty non-standard trick that has sometimes used in RS-232
environment _might_ work with constantly on RS-422 transmitters (such
as MAX490) on RS-485 buses.

Put a diode in series between the RS-422 output port and the RS-485
bus. Two diodes are required with opposite polarity for the Tx+ and
Tx- ports. The diode polarity must be set so that they conduct only
when Space ("0") is transmitted, but isolate the transmitter from the
bus, when Mark ("1") is transmitted.

When the transmitter is in the Idle Mark state, the bus is pulled to
the Mark state by the "fail-safe" termination resistors on the bus or
driven to Space by an other transmitter.

The diodes will reduce the noise margin by the diode voltage drop and
not be used, when making "RS-485" compliant slaves.

However, if you are in full control of both the master and slaves and
the slaves and the cables between them, you might consider this dirty
trick.
Thanks Paul, its a neat trick. I have ordered the max489 it has the needed
enable pins and also is slew rate limited. With my low baud rate of 57.6K,
it will give me a little extra insurance of good comm. Thanks again.
 
Top