| View previous topic :: View next topic |
| Author |
Message |
kbb
Joined: 01 Jun 2007 Posts: 180
|
Posted: Sun Jul 15, 2007 10:44 pm Post subject: Checking if an I2C device is an OpenServo |
|
|
My current strategy to determine if a device on the I2C bus really is an OpenServo and not something else is to read the first 4 registers in turn and check them for values appropriate to an OpenServo. I guess this could be extended to include other tests, such as checking the ADC timer register changes over some short interval.
It occurs to me it would be cool if a register was assigned that simply returned the next byte, in turn from the following sequence, each time it is read: returning to the start of the sequence after the last byte is sent.
0x4F, 0x70, 0x65, 0x6E, 0x53, 0x65, 0x72, 0x76, 0x6F
Yes, this would mean the code interrogating the device aught to check the sequence from any start position, but that is straightforward and doesn’t sacrifice registers in the OpenServo.
Kevin. |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Sun Jul 15, 2007 11:20 pm Post subject: |
|
|
Hi Kevin,
Interesting idea, and certainly a worthy discussion point
I normally use the first bytes to determine if it is an OpenServo, as I can put any value in there, and be fairly certain it is an OpenServo. I also use the subdevice registers to tag the different OpenServo versions I have on the bus, so each gets treated differently by the host.
The way you propose is also quite bus expensive, but not so much a problem at discovery stage.
I can only think of one way to be absolutely certain... using a broadcast packet. broadcast 1 byte on general call 0x00 with a key. Then get the OpenServo to change its device ID to the broadcast value. You can then read all devices on the bus and check for the broadcast key. You can repeat this a couple of times to be sure.
I already have OpenServo broadcast support coded up, so it shouldn't be difficult to integrate that feature.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
kbb
Joined: 01 Jun 2007 Posts: 180
|
Posted: Mon Jul 16, 2007 12:06 am Post subject: |
|
|
| ginge wrote: | | The way you propose is also quite bus expensive, but not so much a problem at discovery stage. |
Hi Barry,
Yes, I am proposing it only needs to be done once, when “the system” (whatever that may be) starts up! Being a readonly strategy means that there is less chance of some other device being upset by a “write”.
On initialisation, “the system’s” code would call “OSI_RescanForServos()” or “OSI_AddServo(...)” depending on the user's needs. That's where any checks will be: in this scenario I can't imagine the bandwidth used matters that much? And if “OSI_RescanForServos()” is being called again, it is probably in a test scenario.
The code I currently have can read all the registers in the OpenServo (via the Diolan) over 100 times a second, so I am not too worried at the moment about the one off start-up probe!
| ginge wrote: | | I can only think of one way to be absolutely certain... using a broadcast packet. broadcast 1 byte on general call 0x00 with a key. Then get the OpenServo to change its device ID to the broadcast value. You can then read all devices on the bus and check for the broadcast key. You can repeat this a couple of times to be sure. |
What happens when there is more than one OpenServo connected or if some other device has a reaction to that call?
Kevin. |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Wed Jul 18, 2007 6:38 pm Post subject: |
|
|
Hi Kevin,
| Quote: | | What happens when there is more than one OpenServo connected... |
Not a problem. The general call just updates a Readable register. The more OpenServos the better.
1) Send the broadcast x to all devices
2) Do a bus scan
3) Interrogate devices at register y for broadcast value x
| Quote: | | ...or if some other device has a reaction to that call? |
Hmm... good point. Well that kind of blows my plan. Well... keep up the good work
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
ella
Joined: 11 Feb 2009 Posts: 8
|
Posted: Wed Feb 11, 2009 7:46 am Post subject: |
|
|
| Hi Just to let you know that Dimax (manufacturer of widely used here U2C board) has released a new much more powerfull device SUB-20. SUB-20 is backward compatible with U2C but is much more powerfull and flexible. It has very nice features like LCD, push buttons and RS232/RS485 option. Look for SUB-20 in google. |
|
| Back to top |
|
 |
|
|
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
|