View previous topic :: View next topic |
Author |
Message |
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
Detecting collisions in a multi master 3 wire RS 485 Bus |
Posted: Wed Sep 16, 2009 3:35 am |
|
|
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
|
|
Posted: Wed Sep 16, 2009 7:47 am |
|
|
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
|
|
Posted: Wed Sep 16, 2009 8:15 am |
|
|
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
|
RE: |
Posted: Thu Sep 17, 2009 6:52 am |
|
|
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
|
|
Posted: Thu Sep 17, 2009 7:00 am |
|
|
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
|
|
Posted: Thu Sep 17, 2009 7:44 am |
|
|
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
|
|
Posted: Thu Sep 17, 2009 8:58 am |
|
|
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. |
|
|
|