View previous topic :: View next topic |
Author |
Message |
J_GROUP
Joined: 25 Aug 2015 Posts: 18
|
How to scan device on RS485 Network |
Posted: Wed Oct 14, 2015 10:59 pm |
|
|
Hi Friends,
I need your ideas about how to scan to list device on haft-duplex rs 485 network.
I have project to make device with serial number (8 digits).
Now I want list devices connected to network (device with random serial number) with single comman : "Scan" from Master.
Please give me your idea about solution in this case.
Thank you |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Thu Oct 15, 2015 12:41 am |
|
|
Depends totally on the _protocol_ you are going to use/design. RS485, is a signalling standard, not a protocol. You need to be using a protocol 'over' the 485 signalling.
Now the standard way to implement such a thing is totally dependant on the serial number. The master implements a 'Broadcast serial request', to the bus, and the slaves then respond to this at an interval that is dependant on their serial number, to avoid clashing. Do you really mean 8 digit, or 8 bit?. With an 8 bit serial, you respond after (say) serial*2mSec, so the master can find all the devices in just over half a second, with serial#0 responding immediately, serial #10, responding after 20mSec, and so on.
Once the master has a list of the numbers, a packet addressed to device#10, is responded to by just this device, ASAP. |
|
|
J_GROUP
Joined: 25 Aug 2015 Posts: 18
|
|
Posted: Thu Oct 15, 2015 8:10 am |
|
|
Thank for your reply,
I was tried solution as yours but have some problem.
I have 8 digits as resource for serial device.
That mean the biggest value of serial is 99999999
If following your solution,the longest delay time is 99999999*2ms
That impossible. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Thu Oct 15, 2015 8:17 am |
|
|
Totally. But why on earth have a hundred million serial numbers?. You are never going to use more than perhaps fifty on any practical RS485 network.
If you are determined to have such a huge number, then you need to design a hash function, that calculates a short time from the number, in such a way that the probability of two devices getting the same time value is very low. Then add an ability to handle two devices clashing at the same time. Getting a lot more complex... |
|
|
J_GROUP
Joined: 25 Aug 2015 Posts: 18
|
|
Posted: Fri Oct 16, 2015 11:16 am |
|
|
sir,
if you manuafactured and sell alot, you cannot control what serialnumber of devices on your customers network. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Fri Oct 16, 2015 11:25 am |
|
|
Which is why you then design an efficient hash. This is how ethernet serials are used to generate exactly this sort of delay, or the numbers in SMBUS devices are also used when you perform an automatic ID allocation on this. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Oct 16, 2015 12:28 pm |
|
|
'Old School' method
1) powerup Master
2) powerup a 'slave'
3) master sees this 'new' slave
3a) master assigns it an address and slave records it's address
4) repeat 2 and 3 as required...
When finished, master will have a list or table of all slaves in the network and all slaves will have unique addresses.
I did this 30 years ago when RS485 wasn't around. Each network consisted of a maximum of 32 slaves, propriatory protocol, hacker proof, network extended for about 15 miles.
Now while each slave can have an 8 digit address, RS485 is limited to less than 128 devices, usually less than 32 depending on the driver chip used.
Jay |
|
|
J_GROUP
Joined: 25 Aug 2015 Posts: 18
|
|
Posted: Sat Oct 17, 2015 9:06 am |
|
|
dear Sir,
Thank for your reply,
I working on OmniBus Lighting control of Leviton security and Automation. That lighting system reach 255 node. That mean 255 slave on single network. I check their hardware very carefully, They using RS485 half duplex (RS 485 chip using is VP485, VP486)
Their software can read devices connected to RS485 network any time by serial number. I still dont know how they can do it so exactly
Now I have project have same function as them.
I have little successful for this method, but I think this way still not reliable.
So I need collect ideas from user of this forum. So thank for your time for me and I hope receive your new ideas |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Sat Oct 17, 2015 11:03 am |
|
|
It uses a protocol called Z-wave.
It just requests a reply, from each number in turn. This is done by the FI command, It supports 232 devices (some numbers are reserved). This builds the table that the master holds to know what is on the network. You can restrict the search also to 'types' of devices.
Once the table is built, it can talk immediately to the devices it knows about.
Perfectly OK for a small number of devices, but not for millions....
It is the sheer number of your devices that creates the problem.
Consider if you could use something akin to DHCP?.
Use a local ID and serial together and have the slave device issue a request. It means you will have to potentially arrange the bus as multi-master, so the client can initiate the request. |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Sat Oct 17, 2015 2:02 pm |
|
|
J_GROUP wrote: | sir,
if you manuafactured and sell alot, you cannot control what serialnumber of devices on your customers network. |
Hi,
Well, this thread has fallen into total silliness.....
Being a skilled programmer is not just about coding, it's also about intelligent program design. In fact, a good case can be made that the latter is actually more important than the former....
If you are the manufacturer, why in heavens name even offer a 8 digit serial number? Clearly, nowhere near that many total nodes will ever exist on a network, so what's the point?
My company offers many different varieties of wired network connected sensors. In the days before flash memory, addresses were selected using DIP or rotary switches with a reasonable, finite address limit (32, 64, or 256 depending on the sensor type). Now, addresses are programmed and stored in non-volatile memory, but similar limits are coded into the firmware. _________________ John
If it's worth doing, it's worth doing in real hardware! |
|
|
|