CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Detecting collisions in a multi master 3 wire RS 485 Bus

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

Detecting collisions in a multi master 3 wire RS 485 Bus
PostPosted: Wed Sep 16, 2009 3:35 am     Reply with quote

Hi,

How are collisions detected in a RS 485 network ?? Is there any way a PIC might know when a bus is busy ????

thanks
arunb
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Wed Sep 16, 2009 7:47 am     Reply with quote

I would say that RS-485 isn't intended to allow collisions. If you haven't got some scheme to decide who has the right to transmit on the bus (time division, token passing, etc) you should look at something more complicated, like CAN.
Jerson



Joined: 31 Jul 2009
Posts: 125
Location: Bombay, India

View user's profile Send private message Visit poster's website

PostPosted: Wed Sep 16, 2009 8:15 am     Reply with quote

Oh, you can do CSMA using RS485. Been there, done that. You need 2 transceivers on the line. One is used exclusively for receive, the other exclusively for transmit. This is how it works

1. Check for bus activity by listening to the RX port

2. Start transmitting. Keep checking that what goes on the line is exactly what you've been sending. If you get something else, you have a collision and you need to stop sending for a random time delay. At the same time the peer whose data collided also will back off for a random delay.

That's all there is to it. Of course a Hardware solution like CAN will be faster and more elegant.
_________________
Regards
Jerson Fernandes
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Thu Sep 17, 2009 6:52 am     Reply with quote

I prefer RS 485, I use SN75176 transceivers for this.

Is it not possible to use a single transceiver instead of two. I transmit data by keeping RE line low. When no collision occurs the data received by the sending PIC will be the same as the sent data....will this method work..??

thanks
arunb
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Sep 17, 2009 7:00 am     Reply with quote

The suggested two transceiver solution would only offer an advantage, if series resistors are used between the driver and the bus (e.g. for short circuit or overvoltage protection). Otherwise, a single transceiver serves the purpose as well. In both cases, if the colliding transmitters have equal strength, the resulting bus level is unknown, and it's no said, that the monitoring receiver will see the same bus data as the peers.
Jerson



Joined: 31 Jul 2009
Posts: 125
Location: Bombay, India

View user's profile Send private message Visit poster's website

PostPosted: Thu Sep 17, 2009 7:44 am     Reply with quote

When you talk CSMA/CD you need two transceivers. I do not agree that a single transceiver solution would help here. Fact is that the peers will anyway see junk and not respond. But, if they see some valid pattern in the junk, they might respond and you will have problems.

The 2 trx solution makes sure what you put on the bus is clean at least from the transmitter end.
_________________
Regards
Jerson Fernandes
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Sep 17, 2009 8:58 am     Reply with quote

You didn't manage to explain the effective difference between both configurations.

In my opinion, if both transceivers are directly connected to the bus, without e.g. series resistors in between, they can be expected to receive the same signal, if one transmitter is sending simultanously or not.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group