RS485 info

Go To Last Post
29 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As we seem to repeat a lot of stuff regarding RS485 I thought it may be a good idea to make up a sticky with some information that prospective users may chew on.

As RS485 is an ELECTRICAL standard the info here is not dealing with software at present, maybe we can move the thread elsewhere in the future and add simple RS485 type code.

This link was posted by Brian Fairchild

Removed dead link 16/12/2106 http : // www .lvr. com/rs-485_circuits.htm

 

I'm adding a couple of PDFs which should be able to be posted without infringing any copyrights. If you feel that some should not be posted I will remove it/them.

Attachment(s): 

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Thu. Dec 15, 2016 - 06:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you interesting..
Thierry

Thierry Pottier

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And the wikki article is http://en.wikipedia.org/wiki/RS-485

It's a fast, pretty long distance multidrop wired communication system. Distances up to 1200 meters and speeds up to 35M bits per second.

Bits per second * meters should not exceed 10^8.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Excellent idea John!
You might want to put a sticky in the AVR forum as a link to this sticky as it is asked about quite a bit there if you have not already.

Once again, great thought.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All the knowledgeable people know about the thread so that they can point newbees to it. :-)

A while ago I had in mind to post some MPCM code based on the "famous" Ampertronics' protocol but then my mind got distracted... :roll:

I had started an AS4 C project and the intention was to port the same code to ICC and CVAVR and of course have an assembler version too, now I'm thinking that an Xmega version would also be good but I haven't got a ROUND TUIT.

If I get one of those maybe the whole thread can go to Atmel spaces or not....

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, all the knowledgeable people will tell newbees to search for it, so that any search for RS485, RS-485, TIA458 or TIA-458 will turn up 153 threads saying to use search.

(Mainly posted to be sure this thread comes up when somebody does search.)

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RS-422 uses the same drivers over two pairs, if you want full duplex. Of course you lose the multi-point bit, then... (can still have many receivers, though).

 

It's handy if you want a mile long serial link. normal code for 232 is the same, only thing changed is electrical interface in this case.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may also use Manchester encoding like Ethernet, and pulse transformers in middle to avoid ground issues, interface to hardware connected to mains, etc.

 

while(!solution) {patience--;}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's an excellent article from Circuit Cellar by Jan Axelson.  I've used his her 555 pulse stretcher for automatic DE enable a few times with great success.

 

 

Attachment(s): 

Cheers,

Tom

Last Edited: Fri. Nov 7, 2014 - 04:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tblough wrote:

article from Circuit Cellar by Jan Axelson.  I've used his 555 pulse stretcher.....

 

That would be Janet Louise Axelson,  no doubt.

http://en.wikipedia.org/wiki/Jan_Axelson

 

If only her parents named her Mary, there would be no confusion.smiley

Last Edited: Fri. Nov 7, 2014 - 04:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks so much for material, I spent last week on RS485 for a new project 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the info js, have a RS485 project I'm working on and this came in very handy.

 

On question I have though;

I'm using a 4 pair cable and I thought to solve the contention problem I would use a single PIO on the MCU to indicate that the bus was in use.  What would I have to do to get this signal to run over long distance?

Happy Trails,

Mike

JaxCoder.com

Last Edited: Wed. Mar 24, 2021 - 12:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1


js wrote:

I had started an AS4 C project and the intention was to port the same code to ICC and CVAVR and of course have an assembler version too, now I'm thinking that an Xmega version would also be good but I haven't got a ROUND TUIT.

If I get one of those maybe the whole thread can go to Atmel spaces or not....

Here you go:

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

Lets go Brandon!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Ideally, a line driver and receiver; otherwise, a comparator as a receiver and generate the differential signal from a single-ended signal (buffer and inverter, OTA, etc)

Contention can be detected then resolved by variable hold-off.

The Art of Electronics 3rd Edition | by Horowitz and Hill

Download a sample chapter

[page 16]

TWELVE: Logic Interfacing 790

 

P.S.

5.15.5 A riff on robust input protection 362

for one way in the presence of lightning; another way is a TBU®.

TCS™ & TBU® High-Speed Protectors Electronic Current Limiters (Bourns®) (page 7, top left)

 

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

gchapman thanks for the info

Happy Trails,

Mike

JaxCoder.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mike32217 wrote:
What would I have to do to get this signal to run over long distance?

 

The transceivers (THVD1500, 3172EIBZ) I have been using look to do over 1000 meters on CAT5. I make heavy use of fail-safe biasing (non-standard), but that should not affect the range.  I tested it on a 600 ft (of 1000ft) spool with one signal going back and forth from one pair to the next until all were used (total ~2400ft). I could tap the signal at each end of the cable and found it to diminish over the distance, and the loss seemed to agree with the transmission line copper loss of CAT5. How far do you need to go?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using a 4 pair cable and I thought to solve the contention problem I would use a single PIO on the MCU to indicate that the bus was in use.  What would I have to do to get this signal to run over long distance?

I don't quite understand, are you trying to use multi master RS485?

 

If not then there should not be any contention. (Politically incorrect statements follow)

 

The slaves are in listening mode at all times except when the master addresses one of the slave with a data request.

 

After a few ms the roles reverse, the master listens for the addressed slave's response and thing go back to the status quo.

 

If you need the busy line signal I would think that another RS485 chip would be good enough to drive the line.

 

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ron_sutherland wrote:
The transceivers (THVD1500, 3172EIBZ) I have been using look to do over 1000 meters on CAT5.
Likewise by 10BASE-T1L though the PHY are connected to an Ethernet MAC.

 

How 10BASE-T1L single-pair Ethernet brings the network edge closer with fewer cables - Analog - Technical articles - TI E2E support forums

DP83TD510E IEEE 802.3CG 10BASE-T1L Ethernet PHY | TI.com

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks everyone for all the advice. 

 

I'm using RS485 in a multi-drop mode but was thinking of multi-server (instead of master, since it not politically correct) and just bouncing around right now looking for ideas for bus contention.  Not sure witch way to go.  Using some RS485 breakout boards I got.

Happy Trails,

Mike

JaxCoder.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even with the busy line you can still end up with a collision if 2 or more devices start sending at the same time, the beauty of a single "boss" is that it can't happen unless there is a fault on the line.

 

The "usual" way of handling collisions is that the transmitting devices in collision resend the data with a random amount of delay before sending.

 

Of course all devices can listen to the line for data before sending but making a foolproof anti collision system is almost impossible as far as I can tell.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:
making a foolproof anti collision system is almost impossible as far as I can tell.

 

I am trying to make it impossible to lock up the connection, but not with half-duplex, with full-duplex and heavy use of the non-standard built-in fail-safe of some transceivers; should be able to unlock the connection and upload another attempt (that is less lock-ee up-ee).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Send out a preamble before transmitting. Other stations can sense this and back off if they want to transmit. If you do have a collision, then hopefully it happens within the preamble time and someone backs off, otherwise the data packet gets corrupted and no ack happens. retry.

 

Otherwise known as carrier sense multiple access. Then you need a binary backoff algorithm. If you want to go long distance and be somewhat immune to lightning etc, then ethernet is cheap and easy for microcontrollers these days then use copper to fiber converters. Even the WDM ones aren't cost prohibitive, so you can do full duplex on one fiber. Should be straightforward to interface an ESP32 to a SFP module methinks - note I haven't looked closely at the specs.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for this John, I have a project I have been mulling over that would use RS485 so this comes in very handy!

 

Wayne

East London
South Africa

 

  • No, I am not an Electronics Engineer, just a 54 year old hobbyist/enthusiast
  • Yes, I am using Proteus to learn more about circuit design and electronics
  • No, I do not own a licensed copy of Proteus, I am evaluating it legitimately
  • No, I do not believe in software or intellectual property piracy or theft
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for sharing, this helps me a lot.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Almost the "bible" of RS485 hardware design:

 

https://www.ti.com/lit/an/slla27...

 

Lots of excellent references at the end. Many are TI publications but TI has especially good AN's in this area.

 

NB: TI also has some very good RS422 ANs.

 

Jim

 

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Fri. Apr 30, 2021 - 05:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ron_sutherland wrote:
The transceivers (THVD1500, 3172EIBZ) I have been using look to do over 1000 meters on CAT5.
1.5 km max on off-line power with THVD8000 that entered production this year.

due to THVD8000 RS-485 Transceiver - TI | Mouser

 


THVD8000 Design Guide (Texas Instruments, bottom of page 3)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nicely timed...

 

So...  Other people have added "rs485 support" to Optiboot.  I guess it works for them.
BUT - it seems that they enabled and disable the "transmitter" for each byte sent, where-as I would have thought (based on half-duplex rs232, SPI, and others) that the thing to do would be to not disable the transmitter until you were completely done transmitting your "message", even if that were multiple bytes.  That would be easy to implement in the bootloader by not disabling the transmitter until it hits the next "receive character" call (which is always pretty soon after transmitting, since the whole stk500 thing is very much "receive a command, send a response, wait for another command."

Is a multi-byte transmit duration not preferred for some reason?  Or is the code I've seen just sub-optimal?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

not disable the transmitter until you were completely done transmitting your "message", even if that were multiple bytes

That's the way I have always done it for more than 35 years.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:
1.5 km max on off-line power with THVD8000 that entered production this year.

 

The THVD8000 does not look to be a fail-safe transceiver; it does not consider the -50mV to 200mV range to be a one, which the THVD1500, 3172EIBZ transceivers do.