EmbeddedRelated.com
Forums

RS485: two transceivers

Started by aleksa April 14, 2011
On 14/04/2011 21:53, Grant Edwards wrote:
> On 2011-04-14, Rich Webb<bbew.ar@mapson.nozirev.ten> wrote: > >> Now if I could just understand why UARTs idle on mark 'high' and both >> 232 and the 422/485 'A' line idle on mark 'low' but the standard >> symbology for 422/485 drivers has the inversion circle on the 'B' >> line. > > That path leads to madness -- not even silicon and equipment vendors > can agree on which terminal is "A" and which is "B". > > It's best not to try to figure out RS485/RS422 polarities. No matter > how much thought and research you put it into it your chances of it > coming out right are always 50-50. > > Just build something, and if it doesn't work swap the two. > > [And I'm not entirely joking.] >
Even for RS-232, it's good to plan for the possibility that your Tx and Rx are mixed up. I once designed a RS-485 system with automatic polarity detection and swapping, because the installation guys were never consistent. Just monitor the idle line and see if it is idling high or low, and invert as appropriate. It made connecting the system /much/ easier.
"aleksa" wrote:

>I have two CPUs, master and slave. >They are (will be, actually) connected with one SN75176B IC
if you use CAN transceivers instead, you avoid the RS285 problems. Oliver -- Oliver Betz, Munich despammed.com is broken, use Reply-To:
"Oliver Betz" <obetz@despammed.com> wrote in message news:9cufq6dbshumn9bf3fmvvpj5mb705djrg9@z1.oliverbetz.de...
> "aleksa" wrote: > >>I have two CPUs, master and slave. >>They are (will be, actually) connected with one SN75176B IC > > if you use CAN transceivers instead, you avoid the RS285 problems. > > Oliver > -- > Oliver Betz, Munich > despammed.com is broken, use Reply-To:
Don't know anything about CAN... will check it out. Thanks
>> >> But, as Grant wrote, if you exceed the common-mode tolerance of the >> receivers it will not work anymore ... > > And I've seen it fail many times. >
Yes, but i think, the reason is something different. I am not so good in english, so i try to explain: If both, the master and the slave have a connection to the GND-level, there may be a difference in the voltage level. This will probably cause the problems you mentioned. To prevent this, you can have the devices on a floating level at least at the rs485 inputs. In such a case, when there is a level difference, an additional gnd-line would cause a current on the ground wire which can also lead to problems. best regards Stefan DF9BI
On 2011-04-15, Stefan Brr?ring <stefan___@broering.de> wrote:
>>> >>> But, as Grant wrote, if you exceed the common-mode tolerance of the >>> receivers it will not work anymore ... >> >> And I've seen it fail many times. > > Yes, but i think, the reason is something different. > > I am not so good in english, so i try to explain: If both, the master > and the slave have a connection to the GND-level, there may be a > difference in the voltage level. This will probably cause the problems > you mentioned. To prevent this, you can have the devices on a floating > level at least at the rs485 inputs.
Even if they're floating, you still need a signal ground conneciton. I've seen optically isolated RS485 interfaces on industrial control systems that were floating fail without a signal ground. They would fail intermittently as the signal ground on one end floated in and out of the allowed 7V common-mode range for the other end. Maybe there was something wrong with the isolation, but without a signal ground it didn't work, and with a signal ground they did.
> In such a case, when there is a level difference, an additional > gnd-line would cause a current on the ground wire which can also lead > to problems.
If both ends connect signal ground to earth ground and the two earths differ by more than 7V, then it's just not going to work -- period. You bought equipment designed by idiots and you're paying the price for that. -- Grant Edwards grant.b.edwards Yow! I want to kill at everyone here with a cute gmail.com colorful Hydrogen Bomb!!
In article <jhieq6paekk7ioevigmgam02lh3igpf6vu@4ax.com>, 
bbew.ar@mapson.nozirev.ten says...
> > On Thu, 14 Apr 2011 12:15:01 -0700, Mark Borgerson > <mborgerson@comcast.net> wrote: > > >In article <io6kto$6p8$1@dont-email.me>, aleksazr@gmail.com says... > >> > >> "aleksa" <aleksazr@gmail.com> wrote in message news:io6k61$upc$1@dont-email.me... > >> >I have two CPUs, master and slave. > >> > They are (will be, actually) connected with one SN75176B IC > >> > on each side, with two wires connecting them. > >> > > >> > After reset, the master will be in transmit mode, slave in recv mode. > >> > > >> > When the master sends a command to slave, the master will > >> > switch into recv mode and slave into transmit mode. > >> > > >> > Now, what happens while they are switching? At one moment, > >> > both sides may be in input mode, and the wires will float, > >> > maybe generating a start impulse. > >> > > >> > How is this situation usually handled? > >> > > >> > I could probably solve this with software, by waiting > >> > some time, then discarding the byte received, if any. > >> > The slave would have to wait even longer and then start sending. > >> > > >> > >> Do I just place a pull-up one one line, and a pull-down on the other? > > > >That's the most common solution. I suggest that you read through the > >B&B RS-485 application note: > > > >http://www.bb-elec.com/tech_articles/rs422_485 > >_app_note/table_of_contents.asp > > Should be on the required reading list. > > >(The link may need to be reassembled). > > For many (most?) modern newsreaders, putting the link in angle brackets > <http://www.bb-elec.com/tech_articles/rs422_485_app_note/table_of_contents.asp> > prevents the line break. >
Hmm. When I replied to your message, the link remained intact. However, if I copy and paste the link, I get: <http://www.bb-elec.com/tech_articles/rs422_485 _app_note/table_of_contents.asp> (Broken into two lines on my screen). I'm using MicroPlanet Gravity 3.0. I'll check to see if there is a setting that can be changed. Perhaps the link will be restored to one line when the message is sent.
> Now if I could just understand why UARTs idle on mark 'high' and both > 232 and the 422/485 'A' line idle on mark 'low' but the standard > symbology for 422/485 drivers has the inversion circle on the 'B' line.
The saving graces of both RS-232 and RS-485 are that getting the lines mixed up doesn't let the smoke out of the usual driver chips an you have a 50% probability of getting it right the first time! ;-) Mark Borgerson
On Fri, 15 Apr 2011 08:13:09 -0700, Mark Borgerson
<mborgerson@comcast.net> wrote:

>In article <jhieq6paekk7ioevigmgam02lh3igpf6vu@4ax.com>, >bbew.ar@mapson.nozirev.ten says... >> >> On Thu, 14 Apr 2011 12:15:01 -0700, Mark Borgerson >> <mborgerson@comcast.net> wrote: >> >> >In article <io6kto$6p8$1@dont-email.me>, aleksazr@gmail.com says... >> >> >> >> "aleksa" <aleksazr@gmail.com> wrote in message news:io6k61$upc$1@dont-email.me... >> >> >I have two CPUs, master and slave. >> >> > They are (will be, actually) connected with one SN75176B IC >> >> > on each side, with two wires connecting them. >> >> > >> >> > After reset, the master will be in transmit mode, slave in recv mode. >> >> > >> >> > When the master sends a command to slave, the master will >> >> > switch into recv mode and slave into transmit mode. >> >> > >> >> > Now, what happens while they are switching? At one moment, >> >> > both sides may be in input mode, and the wires will float, >> >> > maybe generating a start impulse. >> >> > >> >> > How is this situation usually handled? >> >> > >> >> > I could probably solve this with software, by waiting >> >> > some time, then discarding the byte received, if any. >> >> > The slave would have to wait even longer and then start sending. >> >> > >> >> >> >> Do I just place a pull-up one one line, and a pull-down on the other? >> > >> >That's the most common solution. I suggest that you read through the >> >B&B RS-485 application note: >> > >> >http://www.bb-elec.com/tech_articles/rs422_485 >> >_app_note/table_of_contents.asp >> >> Should be on the required reading list. >> >> >(The link may need to be reassembled). >> >> For many (most?) modern newsreaders, putting the link in angle brackets >> <http://www.bb-elec.com/tech_articles/rs422_485_app_note/table_of_contents.asp> >> prevents the line break. >> >Hmm. When I replied to your message, the link remained intact. However, >if I copy and paste the link, I get: > ><http://www.bb-elec.com/tech_articles/rs422_485 >_app_note/table_of_contents.asp> > >(Broken into two lines on my screen).
Here, too.
>I'm using MicroPlanet Gravity 3.0. I'll check to see if there is a >setting that can be changed. > >Perhaps the link will be restored to one line when the message is sent.
Nope. But, as you say, there may be a configuration setting that will retain long links. Or, it's a great excuse to diddle with the source...
>> Now if I could just understand why UARTs idle on mark 'high' and both >> 232 and the 422/485 'A' line idle on mark 'low' but the standard >> symbology for 422/485 drivers has the inversion circle on the 'B' line. > >The saving graces of both RS-232 and RS-485 are that getting the lines >mixed up doesn't let the smoke out of the usual driver chips an you >have a 50% probability of getting it right the first time! ;-)
So true. It's a PITA for the field service crew, though. If you aren't seeing the expected $GPGLL is it because A/B are swapped? Or the sender is at 38400? You forgot to enable that port altogether? Or you just grabbed the wrong pair? Life is too short! ;-) -- Rich Webb Norfolk, VA
In article <2mogq6tbhh79n7c99kgdj9m15q7j7va425@4ax.com>, 
bbew.ar@mapson.nozirev.ten says...
> > On Fri, 15 Apr 2011 08:13:09 -0700, Mark Borgerson > <mborgerson@comcast.net> wrote: > > >In article <jhieq6paekk7ioevigmgam02lh3igpf6vu@4ax.com>, > >bbew.ar@mapson.nozirev.ten says... > >> > >> On Thu, 14 Apr 2011 12:15:01 -0700, Mark Borgerson > >> <mborgerson@comcast.net> wrote: > >> > >> >In article <io6kto$6p8$1@dont-email.me>, aleksazr@gmail.com says... > >> >> > >> >> "aleksa" <aleksazr@gmail.com> wrote in message news:io6k61$upc$1@dont-email.me... > >> >> >I have two CPUs, master and slave. > >> >> > They are (will be, actually) connected with one SN75176B IC > >> >> > on each side, with two wires connecting them. > >> >> > > >> >> > After reset, the master will be in transmit mode, slave in recv mode. > >> >> > > >> >> > When the master sends a command to slave, the master will > >> >> > switch into recv mode and slave into transmit mode. > >> >> > > >> >> > Now, what happens while they are switching? At one moment, > >> >> > both sides may be in input mode, and the wires will float, > >> >> > maybe generating a start impulse. > >> >> > > >> >> > How is this situation usually handled? > >> >> > > >> >> > I could probably solve this with software, by waiting > >> >> > some time, then discarding the byte received, if any. > >> >> > The slave would have to wait even longer and then start sending. > >> >> > > >> >> > >> >> Do I just place a pull-up one one line, and a pull-down on the other? > >> > > >> >That's the most common solution. I suggest that you read through the > >> >B&B RS-485 application note: > >> > > >> >http://www.bb-elec.com/tech_articles/rs422_485 > >> >_app_note/table_of_contents.asp > >> > >> Should be on the required reading list. > >> > >> >(The link may need to be reassembled). > >> > >> For many (most?) modern newsreaders, putting the link in angle brackets > >> <http://www.bb-elec.com/tech_articles/rs422_485_app_note/table_of_contents.asp> > >> prevents the line break. > >> > >Hmm. When I replied to your message, the link remained intact. However, > >if I copy and paste the link, I get: > > > ><http://www.bb-elec.com/tech_articles/rs422_485 > >_app_note/table_of_contents.asp> > > > >(Broken into two lines on my screen). > > Here, too. > > >I'm using MicroPlanet Gravity 3.0. I'll check to see if there is a > >setting that can be changed. > > > >Perhaps the link will be restored to one line when the message is sent. > > Nope. But, as you say, there may be a configuration setting that will > retain long links. Or, it's a great excuse to diddle with the source... > > >> Now if I could just understand why UARTs idle on mark 'high' and both > >> 232 and the 422/485 'A' line idle on mark 'low' but the standard > >> symbology for 422/485 drivers has the inversion circle on the 'B' line. > > > >The saving graces of both RS-232 and RS-485 are that getting the lines > >mixed up doesn't let the smoke out of the usual driver chips an you > >have a 50% probability of getting it right the first time! ;-) > > So true. It's a PITA for the field service crew, though. If you aren't > seeing the expected $GPGLL is it because A/B are swapped? Or the sender > is at 38400? You forgot to enable that port altogether? Or you just > grabbed the wrong pair? Life is too short! ;-)
Hey, I can see some potential sales for a small (DVM-size) box to which you connect the two wires. A pushbutton would cycle through the possibilities of A/B and baud rate. An LCD would show decoded text. when you recogize the data, the box would tell you which is A and which is B and the baud rate. For known data formats ( GPS, etc.) the box could auto-search. Shouldn't take anything more than a few receiver chips, a small MPU and a display. If you put a USB interface on it, you could program it to recognize custom protocols. I'd pay $25 for one of those. Mark Borgerson
On Fri, 15 Apr 2011 10:15:51 -0700, Mark Borgerson
<mborgerson@comcast.net> wrote:


>Hey, I can see some potential sales for a small (DVM-size) box to >which you connect the two wires. A pushbutton would cycle through >the possibilities of A/B and baud rate. An LCD would show decoded >text. when you recogize the data, the box would tell you which is >A and which is B and the baud rate. For known data formats ( >GPS, etc.) the box could auto-search. Shouldn't take anything >more than a few receiver chips, a small MPU and a display. >If you put a USB interface on it, you could program it to >recognize custom protocols. I'd pay $25 for one of those.
Actually, I had one of those designed and ready to go, with autobaud, auto-polarity, and 232/422 recognition as well. But we're tuned for low volume and high cost, so the Powers That Be pulled the plug. Besides, as Grant pointed out, even after you've identified what the per-spec A and B ends of the cable are, odds are 50-50 that what it is connecting to got it backwards... ;-) -- Rich Webb Norfolk, VA
In article <pc1hq61hu701i0b1uj08uof8cgu4ku299i@4ax.com>, 
bbew.ar@mapson.nozirev.ten says...
> > On Fri, 15 Apr 2011 10:15:51 -0700, Mark Borgerson > <mborgerson@comcast.net> wrote: > > > >Hey, I can see some potential sales for a small (DVM-size) box to > >which you connect the two wires. A pushbutton would cycle through > >the possibilities of A/B and baud rate. An LCD would show decoded > >text. when you recogize the data, the box would tell you which is > >A and which is B and the baud rate. For known data formats ( > >GPS, etc.) the box could auto-search. Shouldn't take anything > >more than a few receiver chips, a small MPU and a display. > >If you put a USB interface on it, you could program it to > >recognize custom protocols. I'd pay $25 for one of those. > > Actually, I had one of those designed and ready to go, with autobaud, > auto-polarity, and 232/422 recognition as well. But we're tuned for low > volume and high cost, so the Powers That Be pulled the plug. > > Besides, as Grant pointed out, even after you've identified what the > per-spec A and B ends of the cable are, odds are 50-50 that what it is > connecting to got it backwards... ;-)
Ah well. It would seem a logical product for B&B, and I'm sure their engineers could design it. Perhaps the problem you noted would make it less useful if you couldn't force both ends of the circuit to speak on command. Mark Borgerson