Version: 1
Status: Under development
License: BSD
Download: /files/project_builds/busservo.zip
This is a reposting of my "Servo Driver Fragment" from XMOSLinkers.
Basically this is just a really simple single-thread code for driving RC servos. I'm sure there's a smarter way to do some of these steps (the for-loop over signal pins is a bit of a busy wait). This should be relatively high-performing though, and it's easy to fit to any port size. I'm sure it wouldn't be hard to go from here to using a multiplexed output, but I only need a few channels.
This should work on just about anything you can hook it up to, but the demo code is set up to use ports on the XC-1. Note: The timing accuracy is improved quite a bit by compiling on the "Release" profile in the XMOS tools. This should give just over ~1.2 us resolution on each servo pin (assuming an 8-bit port). The error is quite a bit higher (thought possibly still within the error of most servos) if compiled using the "Debug" profile.
Video:
Simple Servo Control
-
- Experienced Member
- Posts: 126
- Joined: Fri Feb 12, 2010 10:31 pm
-
- Experienced Member
- Posts: 126
- Joined: Fri Feb 12, 2010 10:31 pm
I haven't been using this much lately, so no updates since the XMOSLinkers post. This should work just fine on any of the boards with a port reassignment.
I use a 5V octal buffer to protect the pins on the XMOS chip, just in case the servo melts down.
I use a 5V octal buffer to protect the pins on the XMOS chip, just in case the servo melts down.
-
- Respected Member
- Posts: 395
- Joined: Tue May 18, 2010 12:25 am
This should be helpful for my helicopter project! Let me know if i can help.
-
- Experienced Member
- Posts: 126
- Joined: Fri Feb 12, 2010 10:31 pm
Sure, feel free to take a look and let me know if there are any issues with it. It should work mostly out of the box, and it's designed to use one thread and one multi-bit port, but handle everything else automatically. It should be fast enough to do simultaneous movements in robotics, etc. without any trouble. I've tested it no problem.
The 3.3V signals work fine in my testing, but to be safe I would suggest boosting them to 5V with a buffer of some kind (e.g. 74HC244) so you don't risk frying the XMOS chip if you melt a servo and drive 6V or 7.2V back into the I/O bus. Also that should make the comparator in the servo happier.
The 3.3V signals work fine in my testing, but to be safe I would suggest boosting them to 5V with a buffer of some kind (e.g. 74HC244) so you don't risk frying the XMOS chip if you melt a servo and drive 6V or 7.2V back into the I/O bus. Also that should make the comparator in the servo happier.
-
- Active Member
- Posts: 37
- Joined: Tue Jul 06, 2010 2:26 pm
I'd quite like to follow your progress - this could actually save me some R & D with my project. Good luck with it.
-
- Experienced Member
- Posts: 126
- Joined: Fri Feb 12, 2010 10:31 pm
No major updates, but I just wanted to point out that this works great out of the box with the XMOS breakout board for bluetooth and servo headers; just set the output port to the right 8-bit port, and you have 8 servo channels. Takes about 5 minutes to make it work on the XK-1 (changing which core things are on, etc.).
-
- Active Member
- Posts: 55
- Joined: Fri Oct 15, 2010 12:14 am
Hi bsmithyman,
Tell me more about the XMOS breakout board. I have not come accross this in roaming the XMOS sites.
Cheers, Roger...
Tell me more about the XMOS breakout board. I have not come accross this in roaming the XMOS sites.
Cheers, Roger...
-
- Experienced Member
- Posts: 126
- Joined: Fri Feb 12, 2010 10:31 pm
Hi Roger,
My understanding is that XMOS made a few for internal use and the like. It's not for sale, but they included one with an XK-1 board in the Pass-the-Parcel contest, which I won. The development documents are available on the XMOS website under the XK-1 section. This includes a Roving Networks RN-41 bluetooth adapter and a bank of servo pins connected to the 8-bit port. The servo high line isn't connected to the XMOS board, so you can drive 5V, 6V, 7.2V, etc. to the motors.
My understanding is that XMOS made a few for internal use and the like. It's not for sale, but they included one with an XK-1 board in the Pass-the-Parcel contest, which I won. The development documents are available on the XMOS website under the XK-1 section. This includes a Roving Networks RN-41 bluetooth adapter and a bank of servo pins connected to the 8-bit port. The servo high line isn't connected to the XMOS board, so you can drive 5V, 6V, 7.2V, etc. to the motors.
-
- Active Member
- Posts: 55
- Joined: Fri Oct 15, 2010 12:14 am
Hi,
Thanks, I see that they are still putting this combination out in the parcels. Maybe I will win one.. here's hoping.
Regards, Roger...
Thanks, I see that they are still putting this combination out in the parcels. Maybe I will win one.. here's hoping.
Regards, Roger...
-
- Experienced Member
- Posts: 126
- Joined: Fri Feb 12, 2010 10:31 pm
After some discussions in the forums, I've got a few ideas for ways to improve this project, and will be trying to find some time to implement them soon. If you're looking at this and I haven't released a new version in December, feel free to bug me about it.