OpenServo.com Forum Index OpenServo.com
Discussion of the OpenServo project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

active notification

 
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software
View previous topic :: View next topic  
Author Message
clcheung



Joined: 14 Apr 2008
Posts: 27

PostPosted: Tue Apr 22, 2008 2:59 am    Post subject: active notification Reply with quote

Hi,

Is there a way for the openservo to notify the twi master when an event occur (say when the motion finish, pwm turn to zero, velocity turn to zero) ?

It seems current it relies on the master to poll and read these status regularly ?
Back to top
View user's profile Send private message
stefanengelke



Joined: 03 Jan 2006
Posts: 59
Location: Stuttgart, Germany

PostPosted: Tue Apr 22, 2008 1:07 pm    Post subject: Reply with quote

Hi,

at the moment the TWI is implemented as slave only. You would need a multi-master implementation. The avr is capable of the needed arbitration and synchronization but you need to implement this feature for the OpenServo and your current master. When using multi-master mode with many OpenServos there may be a problem that the main controller (your current master) don't get the master role for a while. A solution could be that each OpenServo only transmit one byte with it's address so the main controller knows that this servo needs attention. The scenario would looks like this:
* main controller is the master most of the time
* if it has nothing to say it releases the bus
* if an OpenServo needs attention it tries to get the master role, send it's address to the main controller and releases the bus again
* main controller polls the needed information from the OpenServo

-stefan
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
clcheung



Joined: 14 Apr 2008
Posts: 27

PostPosted: Tue Apr 22, 2008 1:54 pm    Post subject: Reply with quote

Hi Stefan

Thank you for the information. I will look into this direction.
Back to top
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Tue Apr 22, 2008 4:30 pm    Post subject: Reply with quote

There are another options, but not implemented in software, and have many pitfalls.

Option: Interrupt line
The OpenServo connector has a spare pin while in I2C mode called int. (pin 4)

as seen on the Pinout page

It would be trivial to make a patch to toggle this pin based on an event to notify the master.

pitfalls:

* You would have to write code to check for other device events.
* You don't know which device pulled interrupt (unless you encode it) so you need to poll anyway.
* It is yet another line on I2C

Option: Alerts

The OpenServo v3-dev branch has support for alerts based on events. We could add support for alert events based on pretty much any option (pwm is 0 etc) You would still need to poll the servos, but polling one register from each device is much more efficient.

This could additionally be combined with option above to register an alert, and then have the master read the alert code.

Pitfalls:
* Still not an instant notification.
* Can be slow with lots of devices

The last option is to implement another protocol in place of I2C. A 2 line serial protocol would probably work well.

The best method would be to use multi-master mode, but the AVR implementation is pretty terrible and there are many corner cases that have to be carefully coded around. There are extensive threads on www.avrfreaks.net about these issues.

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
clcheung



Joined: 14 Apr 2008
Posts: 27

PostPosted: Wed Apr 23, 2008 11:29 am    Post subject: Reply with quote

Hi Barry

Thank you for showing me the options. Looks like a simple way is to have the TWI master polling the openservo at appropriate intervals. I will take a look on how complicated is the multi-master mode.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software All times are GMT
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