Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to make two RS485 signal crash together?

Status
Not open for further replies.

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
I have a master device which will communicate with 2 slave device using RS485. These 3 devices is connected together. These 2 slave device each have different ID, let say it's ID 1 and ID 2. If master device transmit data to slave ID1, only slave ID 1 will reply. If master device transmit data to slave ID2, only slave ID 2 will reply.

So, if the user accidentally set same ID on the 2 slave devices, if master device transmit data to the 2 slave devices, normally both will reply and the signal will crash with each other making the master device receive rubbish only.

I now face the problem of no crash signal. If I set the two slave devices to same ID, their signal won't crash with each other. Both my slave device is using ATmega mcu and programmed with the same firmware. So, if both reply at the same time, normally the signal will crash, but mine won't. Do you guys know why?
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,354
Helped
1,137
Reputation
2,286
Reaction score
1,154
Trophy points
1,393
Location
California, USA
Activity points
29,264
What do you mean "their signal won't crash"? Unless both slaves are transmitting the exact same data at the exact same time, you are going to have collisions (not "crashes")

- - - Updated - - -

What do you mean "their signal won't crash"? Unless both slaves are transmitting the exact same data at the exact same time, you are going to have collisions (not "crashes")

How do you KNOW both slaves are transmitting?
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
What do you mean "their signal won't crash"? Unless both slaves are transmitting the exact same data at the exact same time, you are going to have collisions (not "crashes")

- - - Updated - - -

What do you mean "their signal won't crash"? Unless both slaves are transmitting the exact same data at the exact same time, you are going to have collisions (not "crashes")

How do you KNOW both slaves are transmitting?

Yes. What i mean by signal crash is signal collisions.
And yes, both my slave devices if with same id, wil send same data at the same time. But for my case, it won't hv collision? Do u hv idea why? I want to make it collide.

I know both slave r transmitting because i put some indicators. The indicators shows both device have transmitted.
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,354
Helped
1,137
Reputation
2,286
Reaction score
1,154
Trophy points
1,393
Location
California, USA
Activity points
29,264
You WANT to make them collide? Okay.....

You've got two outputs connected together. If they both put out the same level then the there's no problem, it's only when each output is trying to supply a different level that you'll have a problem.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,216
Helped
4,958
Reputation
9,938
Reaction score
4,783
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,201
If the two slaves work in unison and return the same data at the same time there is no 'collision', you just have twice as much drive on the lines. The data corruption occurs when one driver transmits a high while the other transmits a low. Instead of the line voltage following logic levels, one driver simply pushes current into the other and both get hot with the line voltage depending on which pushes hardest.

If you want to simulate a collision try sending different data or tieing one of the drivers so it is always in transmit mode.

Brian.
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
You WANT to make them collide? Okay.....

You've got two outputs connected together. If they both put out the same level then the there's no problem, it's only when each output is trying to supply a different level that you'll have a problem.
What do you mean by same level and different level? How do you achieve different level?

- - - Updated - - -

If the two slaves work in unison and return the same data at the same time there is no 'collision', you just have twice as much drive on the lines. The data corruption occurs when one driver transmits a high while the other transmits a low. Instead of the line voltage following logic levels, one driver simply pushes current into the other and both get hot with the line voltage depending on which pushes hardest.

If you want to simulate a collision try sending different data or tieing one of the drivers so it is always in transmit mode.

Brian.
Same data sending at the same time will hv no collision? Wow.. I didn't know that.
But my firmware for the two slave devices is exactly the same. How am I going to make it send different data?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,216
Helped
4,958
Reputation
9,938
Reaction score
4,783
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,201
I can understand two slaves having the same code in them - except for their addresses. There is no point in having two identical units doing identical jobs simultaneously. They may do the same job at different times, that's why they have addresses in the first place.

If you are trying to avoid a human error of manually setting two devices to the same address, you can do it by listening to see if another device has replied before enabling the transmitter. You will have to employ a random timing algorithm before sending so to ensure the two (or more) units don't wait for the same time and then reply together again.

Brian.
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
I can understand two slaves having the same code in them - except for their addresses. There is no point in having two identical units doing identical jobs simultaneously. They may do the same job at different times, that's why they have addresses in the first place.

If you are trying to avoid a human error of manually setting two devices to the same address, you can do it by listening to see if another device has replied before enabling the transmitter. You will have to employ a random timing algorithm before sending so to ensure the two (or more) units don't wait for the same time and then reply together again.

Brian.

The purpose of the signal collision is to avoid the user from using the two slave device of the same id. So, if the user accidentally set two slave device with same id, the master wil know bcos it wil receive rubbish from the signal collision.

So, how do u make the signal colide?
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,354
Helped
1,137
Reputation
2,286
Reaction score
1,154
Trophy points
1,393
Location
California, USA
Activity points
29,264
Have them send different messages!!!! Why don't you listen to what people are telling you???
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Have them send different messages!!!! Why don't you listen to what people are telling you???

So, what u r saying is that there's no way two signal with the same data/message can collide?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,216
Helped
4,958
Reputation
9,938
Reaction score
4,783
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,201
Two units with the same address, same data and SENDING SIMULTANEOUSLY cannot be detected by a collsion mechanism. Obviously it isn't a situation that should ever happen but if you want to guard against human error, do as I suggested and make the addressed unit listen to see if any other unit has replied before sending it's own message.

The other way to do it is to serialize the message, at start up you create a random number and you send it as a 'message counter' embedded in the data and add a CRC byte at the end. After each message you increment the count. It is very unlikely that two units will have the same random seed so their counts will be out of step and their CRCs different. Even if the unit addresses are the same, their message contents wil be different and the corruption can be detected. You don't have to use the count itself unless you want to double check it is sequential from each unit, it's purpose is just to ensure uniqueness of the message.

Brian.

Brian.
 

arbj2

Full Member level 3
Joined
Apr 10, 2012
Messages
166
Helped
10
Reputation
20
Reaction score
10
Trophy points
1,298
Activity points
2,697
get the slave units to transmit data continuously, say after power up, the slaves can immediately start transmiting data.

Have the receiver receive the data continuously so you know if collision occurs.
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,354
Helped
1,137
Reputation
2,286
Reaction score
1,154
Trophy points
1,393
Location
California, USA
Activity points
29,264
do as I suggested and make the addressed unit listen to see if any other unit has replied before sending it's own message.

That's not going to work. The assumption is that both slaves are identical in every respect. Thus, they both wait the exact same amount of time, then they both start transmitting the exact same message at the exact same instant.
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Two units with the same address, same data and SENDING SIMULTANEOUSLY cannot be detected by a collsion mechanism. Obviously it isn't a situation that should ever happen but if you want to guard against human error, do as I suggested and make the addressed unit listen to see if any other unit has replied before sending it's own message.

The other way to do it is to serialize the message, at start up you create a random number and you send it as a 'message counter' embedded in the data and add a CRC byte at the end. After each message you increment the count. It is very unlikely that two units will have the same random seed so their counts will be out of step and their CRCs different. Even if the unit addresses are the same, their message contents wil be different and the corruption can be detected. You don't have to use the count itself unless you want to double check it is sequential from each unit, it's purpose is just to ensure uniqueness of the message.

Brian.

Brian.
Thanks for the suggestion.
But ur way sound like trying to prevent data collision from two slave devices to me.
What i want is to make the data collide.

- - - Updated - - -

That's not going to work. The assumption is that both slaves are identical in every respect. Thus, they both wait the exact same amount of time, then they both start transmitting the exact same message at the exact same instant.

Yes, that's what i have now.
Do you hv any suggestion on how to make the data collide for my case?
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,354
Helped
1,137
Reputation
2,286
Reaction score
1,154
Trophy points
1,393
Location
California, USA
Activity points
29,264
Do you hv any suggestion on how to make the data collide for my case?

I give up.

IF THE DATA FROM THE TWO SOURCES IS IDENTICAL, THERE IS NO COLLISION. Again, IF THE DATA FROM THE TWO SOURCES IS IDENTICAL, THERE IS NO COLLISION.

You need to go back to your very first fundamental electronics course. If you put a 5 volt source in parallel with another 5 volt source you get FIVE VOLTS! If you put a zero volt source in parallel with another zero volt source you get ZERO VOLTS!

There is ABSOLUTELY NO WAY to tell if you've got one 5 volt source or a million 5 volt sources in parallel.

Sorry, but that's just physics.

- - - Updated - - -

If this is such a concern to you, maybe you should think about a daisy chain approach.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,216
Helped
4,958
Reputation
9,938
Reaction score
4,783
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,201
If you are absolutely sure you want to do it, invert the signal going into ONE of the interfaces. Do not reverse the actual RS485 wires and do not do anything to the data coming from the interface IC or it will fail to see it's address.

You will have to invert the data in software or by adding a hardware logic inverter between the processor output and the interface IC input.

Brian.
 

arbj2

Full Member level 3
Joined
Apr 10, 2012
Messages
166
Helped
10
Reputation
20
Reaction score
10
Trophy points
1,298
Activity points
2,697
what exactly do you expect to see during a collision ??

Its very likely the output data after collision is a mixture of the data from the two slave units...
 

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
what exactly do you expect to see during a collision ??

Its very likely the output data after collision is a mixture of the data from the two slave units...

Yes. That's what I want to see. I want to see rubbish. That means the signal had collide.
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
5,354
Helped
1,137
Reputation
2,286
Reaction score
1,154
Trophy points
1,393
Location
California, USA
Activity points
29,264
what exactly do you expect to see during a collision ??

Its very likely the output data after collision is a mixture of the data from the two slave units...

A MIXTURE? This is electronics, not cooking.

There seems to be a fundamental stubbornness or just a complete lack of understanding in this thread. If you have two outputs connected together, and they are trying to drive different voltages, the result will PROBABLY be some intermediate value dependent on the actual circuitry involved. The receiver MAY interpret this intermediate value as a logic 1 or logic 0. If the outputs are the same, then the receiver won't know how many drivers are active.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top