Previous in Forum: intergrated circuits   Next in Forum: Soldering Disaster!
Close
Close
Close
4 comments
Rate Comments: Nested
Associate

Join Date: Oct 2008
Location: South Africa and China
Posts: 52
Good Answers: 1

RS485 Communications and "Bit Stuffing"

03/26/2010 2:35 AM

I am in the process of designing industrial control systems that require intercommunication between them. Because of certain requirement, I need a fast link with a high degree of data integrity but the amount of data transmitted between systems is not large, about 10 bytes. I would use RS485, half-duplex wire as the physical link. All this is basically a given and fixed. All I need to know is if I would require to do "bit stuffing" on the data as to prevent the line "seeing" more than 4 consecutive "0" or 4 consecutive "1". The references I can find only refers to "bit stuffing" in order for synchronization between receiver and transmitter. Because RS485 is an asynchronous bit stuffing is not required. What are your view points?

__________________
The best vision is insight - Malcolm Forbes
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#1

Re: RS485 Communications and "bit stuffing"

03/26/2010 4:13 AM

The requirement for bit stuffing and the like depends on the interface protocol, not the medium. I use RS485 (and RS232 for point-to-point) with DF1 protocol (Allen-Bradley). Error checking is done by appending a CRC to each message. The only "tricky" bit in the messaging is that certain codes need to be repeated (to distinguish them from escape codes) if they happen to turn up in a data packet.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Associate

Join Date: Oct 2008
Location: South Africa and China
Posts: 52
Good Answers: 1
#2
In reply to #1

Re: RS485 Communications and "bit stuffing"

03/26/2010 4:32 AM

I am writing my own protocol, and would like to use an USART built in on the micro controller rather than write a dedicated "bit stuffing" routine for the serial comms. CRC checking is a must and requires only 8 bits (one byte) thus the burden is not so much for data integrity. Thanks for your comments, appreciated.

__________________
The best vision is insight - Malcolm Forbes
Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#3
In reply to #2

Re: RS485 Communications and "bit stuffing"

03/26/2010 5:06 AM

If you are writing your own protocol you can do what you like.
When I've done stuff like that I've just made it up as I went along, Start bit, transmit the data twice for error checking stop bit...bish bash bosh, ugly dirty but it worked fine.
Point I'm making is, if you write it all yourself you can make it as complicated or as simple as you like.
Del
(Mine was just a local/short distance tx rx between two processors on a data line...simple shmidtt trigger inverting buffers and a few Rs for isolation/matching, hmm it sounds a bit agricultural now I think of it)

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#4

Re: RS485 Communications and "bit stuffing"

03/26/2010 9:39 AM

But stuffing is not a requirement of RS485, which is merely an electrical signal standard. Normally, but stuffing is used for long data messages so that the receiver doesn't lose sync in the event that there are lots of zeroes or ones in a row - and hence no edge to sync to. The start bit in a standard serial comm does the same thing. A simple way to achieve this in your case would be to send the 10 bytes as 10 separate characters - each one with it's own start/stop bit.

Register to Reply Score 1 for Good Answer
Register to Reply 4 comments

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

bhankiii (1); JohnDG (1); lewisthebear (1); user-deleted-1105 (1)

Previous in Forum: intergrated circuits   Next in Forum: Soldering Disaster!

Advertisement