
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.armadeus.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=YvanR</id>
		<title>ArmadeusWiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.armadeus.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=YvanR"/>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=Special:Contributions/YvanR"/>
		<updated>2026-04-29T23:41:17Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=OV9655&amp;diff=12512</id>
		<title>OV9655</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=OV9655&amp;diff=12512"/>
				<updated>2014-02-07T11:35:18Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OV9655 is an Omnivision 1,3 Mpixels sensor that can be found in the following commercial camera modules:&lt;br /&gt;
* [http://radiospares-fr.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&amp;amp;R=0550439 OV09655-FSL]&lt;br /&gt;
* do you know others ?&lt;br /&gt;
* 2014-02: Maybe at http://www.uctronics.com/ov9655-fpc24-13mp-hd-cmos-camera-module-p-1443.html, but not tested!&lt;br /&gt;
&lt;br /&gt;
==Connecting the OV09655-FSL module to the APF27==&lt;br /&gt;
* Datasheet of the OV9655 module are available [http://radiospares-fr.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&amp;amp;R=0550439 here]. They only detail the hardware interface.&lt;br /&gt;
* Omnivision sensors are easily available but when it comes to obtain the datasheet of the sensor it becomes harder. Even if you find some datasheet, the informations inside must be read with caution: some are erronous. So [http://agate.msoe.edu/gf/project/wiicam/scmsvn/?action=browse&amp;amp;path=/trunk/docs/camera/ here is one of those]. '''For example RESET signal should be used the reverse way as indicated in the datasheets of the module.'''&lt;br /&gt;
* This modules needs this Molex connector to be plugged in: http://radiospares-fr.rs-online.com/web/5426700.html.&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
* CSI port (8 bits data + 4 bits control signals) is used to transmit images. (10 bits mode not usable on i.MX). These signals are available on the APF27Dev J9 connector (2,5V logic).&lt;br /&gt;
* I2C bus is used to configure the sensor. This bus is available on the APF27Dev J8 connector.&lt;br /&gt;
* Sensor core power supply (1,8V) is derived from 2,8V of J9.&lt;br /&gt;
&lt;br /&gt;
===Adaptation board===&lt;br /&gt;
* (Preliminary) Schematics and layouts (Eagle) of an APF27 adaptation board are available [http://www.trabucayre.com/ov9655.tgz here]. &lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;&amp;quot;&lt;br /&gt;
|---&lt;br /&gt;
[[Image:OV9655_adapt_plugged_on_APF27Dev.jpg|thumb|320px|APF27Dev with OV9655 and LCD]]&lt;br /&gt;
||&lt;br /&gt;
[[Image:OV9655_adapt_I2C.jpg|thumb|320px|OV9655_adapt montage (I2C cable: Blue on J8 pin 8 and Yellow on J8 pin 10)]]&lt;br /&gt;
|---&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* BOM:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center; width:50%;&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! bgcolor=lightgray scope=col | Components&lt;br /&gt;
! bgcolor=lightgray scope=col | Quantity&lt;br /&gt;
! bgcolor=lightgray scope=col | Ref.&lt;br /&gt;
|-&lt;br /&gt;
| Capacitor 100nF (package 805) CMS&lt;br /&gt;
| 4&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| MCP1700&lt;br /&gt;
| 1&lt;br /&gt;
| [http://fr.farnell.com/microchip/mcp1700t-1802e-tt/regulateur-ldo-1-8v-1700-sot-23/dp/1296591RL MCP1700T-1802E/TT]&lt;br /&gt;
|-&lt;br /&gt;
| pin header 1x2 male 2.54mm&lt;br /&gt;
| 3&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Molex connector (for j9)&lt;br /&gt;
| 1&lt;br /&gt;
| [http://radiospares-fr.rs-online.com/web/p/products/5426700/ 52437-2472]&lt;br /&gt;
|-&lt;br /&gt;
| pin header 2x10 female&lt;br /&gt;
| 1&lt;br /&gt;
| [http://search.digikey.com/scripts/DkSearch/dksus.dll?lang=fr&amp;amp;site=FR&amp;amp;KeyWords=S5524-ND&amp;amp;x=0&amp;amp;y=0  PPTC102LJBN-RC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
* Bring module out of powerdown by driving SSI3_TX (pin 30 of port C) as GPIO (through [[GPIOlib]]):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# echo 94 &amp;gt; /sys/class/gpio/export&lt;br /&gt;
# echo out &amp;gt; /sys/class/gpio/gpio94/direction&lt;br /&gt;
# echo 0 &amp;gt; /sys/class/gpio/gpio94/value; usleep 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Reset it by driving SSI3_CLK (pin 31 of port C) as GPIO (through [[GPIOlib]]):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# echo 95 &amp;gt; /sys/class/gpio/export&lt;br /&gt;
# echo out &amp;gt; /sys/class/gpio/gpio95/direction&lt;br /&gt;
# echo 1 &amp;gt; /sys/class/gpio/gpio95/value; usleep 100000&lt;br /&gt;
# echo 0 &amp;gt; /sys/class/gpio/gpio95/value; usleep 100000; echo 1 &amp;gt; /sys/class/gpio/gpio95/value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Load corresponding drivers:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# modprobe mx27_camera&lt;br /&gt;
&lt;br /&gt;
Linux video capture interface: v2.00&lt;br /&gt;
mx27-camera mx27-camera.0: initialising&lt;br /&gt;
mx27-camera mx27-camera.0: Camera clock frequency: 33250006&lt;br /&gt;
mx27-camera mx27-camera.0: Using EMMA&lt;br /&gt;
&lt;br /&gt;
# modprobe ov96xx&lt;br /&gt;
&lt;br /&gt;
OmniVision ov96xx sensor driver, at your service&lt;br /&gt;
camera 0-0: Camera driver attached to camera 0&lt;br /&gt;
mx27-camera mx27-camera.0: mclk_get_divisor not implemented. Running at max speed&lt;br /&gt;
camera 0-0: Detected an ov9657 sensor&lt;br /&gt;
camera 0-0: Camera driver detached from camera 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test===&lt;br /&gt;
* You can then use Armadeus &amp;quot;capture&amp;quot; demo tool to get images from the camera.&lt;br /&gt;
* First time you will have to set the camera module registers correctly (not done by the driver yet) by using a custom script ov9655_regs.sh available [ here]. Here is how to proceed:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# capture &amp;amp; usleep 400000 ; ./ov9655_regs.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://www.spinics.net/lists/linux-media/msg04285.html Somebody already tried to push an OV9655 SOC driver mainline]&lt;br /&gt;
* [http://www.ovt.com/products/app_table.php?id=4 Omnivision 9xxx sensors serie webpage]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27Dev/hardware/ APF27Dev schematics]&lt;br /&gt;
&lt;br /&gt;
[[Category:Vision]]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=OV3640&amp;diff=12511</id>
		<title>OV3640</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=OV3640&amp;diff=12511"/>
				<updated>2014-02-07T11:31:00Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OV3640 is an Omnivision 3 Mpixels sensor that can be found in the following commercial camera modules:&lt;br /&gt;
* http://framos.eu/4702.html?&amp;amp;L=3 '''but:''' this product has a limited order quantity of 500pcs&lt;br /&gt;
* ?? if someone knows one more affordable... tell us !!&lt;br /&gt;
* 2014-02: Maybe at http://www.uctronics.com/mega-pixel-camera-module-ov3640-hq-lens-p-1508.html, but not tested...&lt;br /&gt;
&lt;br /&gt;
Sensor seems pretty cool but, as always with Omnivision, datasheets are under NDA and init procedure looks like black magic.&lt;br /&gt;
&lt;br /&gt;
==Drivers==&lt;br /&gt;
* Freescale i.MX27/i.MX51 BSP have a driver for it (very customized one == only usable with Freescale BSP/boards)&lt;br /&gt;
* Somebody from OMAP community tried to push a driver some times ago:&lt;br /&gt;
** https://patchwork.kernel.org/patch/9753/&lt;br /&gt;
&lt;br /&gt;
Our actual driver is a mix between these twos.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# modprobe mx27_camera&lt;br /&gt;
# modprobe ov3640&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging==&lt;br /&gt;
* Access to sensor registers from userspace (here I2C 7 bit @ = 0x30):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ./v4l2-dbg -c 0x30 -g 0x3d&lt;br /&gt;
ioctl: VIDIOC_DBG_G_REGISTER&lt;br /&gt;
Register 0x0000003d = 99h (153d  10011001b)&lt;br /&gt;
&lt;br /&gt;
# ./v4l2-dbg -c 0x30 -s 0x3d 0&lt;br /&gt;
Register 0x0000003d set to 0x0&lt;br /&gt;
&lt;br /&gt;
# ./v4l2-dbg -c 0x30 -g 0x3d&lt;br /&gt;
ioctl: VIDIOC_DBG_G_REGISTER&lt;br /&gt;
Register 0x0000003d = 0h (0d  00000000b)&lt;br /&gt;
&lt;br /&gt;
# ./v4l2-dbg -c 0x30 -l&lt;br /&gt;
ioctl: VIDIOC_DBG_G_REGISTER&lt;br /&gt;
&lt;br /&gt;
          00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
00000000: 00 80 80 12 00 00 00 00 00 01 96 52 04 80 01 43&lt;br /&gt;
00000010: 40 00 10 8f 4a 00 04 1a ba 01 81 00 7f a2 10 00&lt;br /&gt;
...............&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://www.ovt.com/products/sensor.php?id=7&amp;amp;limit=25,24&lt;br /&gt;
&lt;br /&gt;
[[Category:Vision]]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=LinuxInstall&amp;diff=11484</id>
		<title>LinuxInstall</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=LinuxInstall&amp;diff=11484"/>
				<updated>2012-12-19T14:17:40Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Get Armadeus software */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&amp;lt;big&amp;gt;How-To install Armadeus Software Development Kit (SDK) on Linux systems. This SDK is currently based on the (excellent) [http://buildroot.net/ Buildroot].&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation was successfully tested on the following distributions:&lt;br /&gt;
* Debian Sarge (3.1), Etch (4.0), Lenny (5.0) &amp;amp; Squeeze&lt;br /&gt;
* X/KUbuntu Edgy Eft (6.10), Gutsy Gibbon (7.10), Hardy Heron (8.04) &amp;amp; Jaunty Jackalope (9.04)&lt;br /&gt;
* Ubuntu Dapper Drake (6.04), Hardy Heron (8.04),  Intrepid Ibex (8.10) &amp;amp; Lucid Lynx (10.04) (32 &amp;amp; 64bits)&lt;br /&gt;
* Mandriva 2006&lt;br /&gt;
* Fedora Core 3 &amp;amp; 4, Fedora 10, Laughlin (14)&lt;br /&gt;
* Red Hat Enterprise 5.2&lt;br /&gt;
* Gentoo 10.0 (32 &amp;amp; 64 bits)&lt;br /&gt;
* SuSE 10.1, OpenSUSE 11.3&lt;br /&gt;
&lt;br /&gt;
'''The installation may fail on:'''&lt;br /&gt;
* Ubuntu Karmic Koala (9.10): tslib fails to build&lt;br /&gt;
&lt;br /&gt;
'''APF28 requirements:'''&lt;br /&gt;
* APF28 board requires a linux distribution with (GNU) tar version 1.20 or later to compile the linux Kernel - Please update or upgrade your linux distribution. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Prerequisites for Linux installation==&lt;br /&gt;
{{Note|From here we assume that your Linux system has a ''make'' version '''greater or equal to''' 3.81. To check it: &lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make -v&lt;br /&gt;
GNU Make 3.81&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For armadeus up to 3.4, make should be '''strictly''' make-3.81 (make-3.82 is too strict). A Fedora (14 and 15) -specific solution can be found later; other recent distributions such as mageia1 also have make-3.82, and a generic solution, based on configure&amp;amp;&amp;amp; make&amp;amp;&amp;amp; sudo make install can be used to install make-3.81 (which can be retrieved from http://ftp.gnu.org/gnu/make/make-6.81.tar.gz) in /usr/local/bin (and , according to one's PATH, make 3-81 can be invoked directly or as /usr/local/bin/make). &lt;br /&gt;
 &lt;br /&gt;
Depending on your distribution, some additional packages are required:&lt;br /&gt;
&lt;br /&gt;
===Debian/Ubuntu based systems===&lt;br /&gt;
[[Ubuntu/Debian installation prerequisites]]&lt;br /&gt;
&lt;br /&gt;
===Mandriva based systems=== &lt;br /&gt;
[[Mandriva installation prerequisites]]&lt;br /&gt;
&lt;br /&gt;
===RPM-based systems (RedHat, Fedora, CentOS)===&lt;br /&gt;
[[RedHat/Fedora installation prerequisites]]&lt;br /&gt;
&lt;br /&gt;
===OpenSuse based systems===&lt;br /&gt;
[[OpenSuse installation prerequisites]]&lt;br /&gt;
&lt;br /&gt;
===Gentoo based systems===&lt;br /&gt;
[[Gentoo installation prerequisites]]&lt;br /&gt;
&lt;br /&gt;
==Get Armadeus software==&lt;br /&gt;
* '''If you are a &amp;quot;careful&amp;quot; user''', then download [https://sourceforge.net/projects/armadeus/files/ the latest stable installation tarball from SourceForge] and detar it wherever you want:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ tar xjvf armadeus-5.2.tar.bz2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''If you want the latest snapshot''', the whole development tree can be checked out from our [[GIT]] repository.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ git clone git://git.code.sf.net/p/armadeus/code armadeus&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* depending on your previous choice, a directory named ''armadeus/'' or ''armadeus-5.2/'' will be created on your hard-disk and will contain all the files you need.&lt;br /&gt;
&lt;br /&gt;
'''Remarks''':&lt;br /&gt;
* '''Do not use spaces''' in the directory name !&lt;br /&gt;
* '''Do not use a directory path beginning with /usr.''' It is a known bug of Buildroot (until BR2012.11, at 2012-12).&lt;br /&gt;
* GIT write/push  accesses are limited to the integrators ([[User:JulienB|JulienB]], [[User:Salocin68|Salocin68]], [[User:Jorasse|Jorasse]], [[User:FabienM|FabienM]])&lt;br /&gt;
&lt;br /&gt;
==Configure SDK options==&lt;br /&gt;
{{Note|If you are new to Armadeus and have troubles compiling armadeus-5.0 using the following instructions, you may find some hints here: [[Armadeus 5.0 Troubleshots]]}}&lt;br /&gt;
*Go to the directory where you put the Armadeus sources:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ cd armadeus/  (or armadeus-5.0/)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*The first time you compile an Armadeus distribution you have to specify the target (here the APF9328) to work with. &lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make apf9328_defconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This command reloads the default configuration to support your target and automatically start a Buildroot's configuration menu.&lt;br /&gt;
&lt;br /&gt;
* Current valid default configurations are:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
apf9328_defconfig  apf27_defconfig  pps_defconfig  apf28_defconfig  apf51_defconfig pps51_defconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For PPS, please see [[APF27_PPS]] or [[PPS51]] for details on their specific build.&lt;br /&gt;
&lt;br /&gt;
* After some downloads, you will get the Buildroot configuration interface:&lt;br /&gt;
&lt;br /&gt;
{{Note|If you ever made changes in the following steps, at any time you can reload the default configuration with the same command}}&lt;br /&gt;
&lt;br /&gt;
[[Image:Menuconfig3.png]]&amp;lt;br&amp;gt;&lt;br /&gt;
*If you are not familiar with Buildroot here are some tips:&lt;br /&gt;
*# you can move the highlighted item with the &amp;quot;up&amp;quot;/&amp;quot;down&amp;quot; arrow keys&lt;br /&gt;
*# with the &amp;quot;left&amp;quot;/&amp;quot;right&amp;quot; arrow keys you can choose between &amp;quot;Select&amp;quot;, &amp;quot;Exit&amp;quot; or &amp;quot;Help&amp;quot; buttons&lt;br /&gt;
*# &amp;quot;space&amp;quot;/&amp;quot;enter&amp;quot;:&lt;br /&gt;
*#* selects the currently highlighted item if you are on the &amp;quot;Select&amp;quot; button&lt;br /&gt;
*#* go back in previous menu if you are on &amp;quot;Exit&amp;quot; button&lt;br /&gt;
*#* show you some Help for current item if you are on &amp;quot;Help&amp;quot; button&lt;br /&gt;
*# for more Help about Buildroot commands, select &amp;quot;Help&amp;quot; in the main configuration screen&lt;br /&gt;
&lt;br /&gt;
*Update the memory configuration of your board:&lt;br /&gt;
&lt;br /&gt;
:In menu:&lt;br /&gt;
:&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;System configuration  ---&amp;gt;    [*] Armadeus Device Support  ---&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:you can check and change the quantity of RAM available on your Armadeus board:&lt;br /&gt;
:[[Image:Build_config_memory.png]]&lt;br /&gt;
:For [[APF9328]] the memory can be either 16 or 32MiB (be sure to select 1 RAM chip)&lt;br /&gt;
:For [[APF27]] it could be either 64MiB or 128MiB (2 x 64MiB) (in that case be sure to select 2 chips of 64MiB instead of 1 chip of 128MiB).&lt;br /&gt;
:For [[APF51]] it could be either 256MiB or 512MiB (2x256MiB) (in such case be sure to select 2 chips of 256MiB instead of 1 chip of 512).&lt;br /&gt;
:For [[APF28]] The memory can be 128, 256, 512 or 1024MiB (be sure to select 1 RAM chip)&lt;br /&gt;
&lt;br /&gt;
* You may decrease the compilation time by increasing the number of parallel jobs running simultaneously on your system (the result is not guaranteed). This option is located in&lt;br /&gt;
:&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;Build Options ---&amp;gt;    (1) Number of jobs to run simultaneously&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* During the toolchain/distribution automatic build, a lot of software archives are downloaded from Internet. The downloaded files are put by default in the ''armadeus/downloads/'' directory. '''If you have several views or plan to build the toolchain several times''', we advise you to put all the downloaded files in ''/local/downloads'' (for example). This is done by configuring Buildroot to use this directory for all your views. Nevertheless, buildroot will be downloaded separately for each build environment you set up.&lt;br /&gt;
:&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;Build options  ---&amp;gt;    (...) Download dir&amp;lt;/pre&amp;gt;&lt;br /&gt;
:[[Image:Build_config_menu_download.png]]&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
:[[Image:Build_config_download.png]]&lt;br /&gt;
'''Of course, ''/local/downloads'' should exists on your system and you should have writing rights on it !'''&lt;br /&gt;
&lt;br /&gt;
* After the build, we advise you too to copy all the files in ''downloads/'' on a removable medium, in case you want to install the development tools on several systems.&lt;br /&gt;
&lt;br /&gt;
* Now, Exit the configuration tool and save your configuration&lt;br /&gt;
&lt;br /&gt;
* You can come back to this configuration menu, by typing (your changes will be kept): &lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Launch build==&lt;br /&gt;
 $ make&lt;br /&gt;
The toolchain and the full distribution are automatically built. During this procedure, several files are downloaded from Internet. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Please wait for a while.... it takes at least one hour for the first run!'''&amp;lt;br&amp;gt;&lt;br /&gt;
By default, the downloaded files/tarball are put in the ''armadeus/downloads/'' directory. Please see the previous chapter to know how to optimize that if you plan to build several views or want to build faster.&lt;br /&gt;
&lt;br /&gt;
==Enjoy the result==&lt;br /&gt;
The generated binary files can be found in the subdirectory ''buildroot/output/images'':&lt;br /&gt;
*''apf9328-u-boot.brec'' (only on [[APF9328]]): BRecord image that can be used with the bootstrap, if U-Boot is not installed or not working (see [[BootLoader]] page)&lt;br /&gt;
*''XX-u-boot.bin'': U-Boot image file to be used with U-Boot itself, (see [[BootLoader#Update_U-Boot | updating U-Boot]])&lt;br /&gt;
*''XX-linux.bin'': Linux image to use with U-Boot, (see [[Target_Software_Installation#Linux_kernel_installation | updating Linux]])&lt;br /&gt;
*''XX-rootfs.jffs2'': JFFS2 filesystem/rootfs image to use with U-Boot, (see [[Target_Software_Installation#Linux_rootfs_installation | updating rootfs]])&lt;br /&gt;
*''XX-rootfs.ubi'' (not supported on [[APF9328]]): [[UBIFS|UBI]] filesystem/rootfs image to use with U-Boot, (see [[Target_Software_Installation#Linux_rootfs_installation | updating rootfs]])&lt;br /&gt;
*''apfXX-rootfs.tar'': for an NFS/MMC based rootfs, (see [[Network_Configuration#Boot_from_NFS | Booting from NFS]] &amp;amp; [[MultiMediaCard#Booting_from_MMC.2FSD | Booting from a MMC/SD]])&lt;br /&gt;
&lt;br /&gt;
'''Please note the new naming convention of binary files and directories (since Armadeus 4.0)'''&lt;br /&gt;
&lt;br /&gt;
*''buildroot/output/build'': contains all the build results for target filesystem, &amp;lt;b&amp;gt;linux&amp;lt;/b&amp;gt;, busybox and &amp;lt;b&amp;gt;u-boot&amp;lt;/b&amp;gt;...&lt;br /&gt;
*''buildroot/output/toolchain/'': cross compilation toolchain's build dir. Binaries usable for cross-compilation are in ''buildroot/output/host/usr/bin''.&lt;br /&gt;
*''buildroot/output/target/'': target filessytem before generating rootfs images&lt;br /&gt;
&lt;br /&gt;
More information is available in the  [http://buildroot.uclibc.org/buildroot.html Buildroot's documentation]&lt;br /&gt;
&lt;br /&gt;
* Note: Previous versions (3.x) of Armadeus SDK stored the generated binary files at a different place: '' ''buildroot/binaries/XX/'' (where XX was the name of your board).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You then copy the binary image to your server directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ cp buildroot/output/images/* /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==To keep your local copy/repository up-to-date with the armadeus GIT repository==&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ git pull&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will update your working directory to the latest release.&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;quot;git pull&amp;quot; fails because a directory or a file already exists, then do:&lt;br /&gt;
 $ rm -rf &amp;lt;this-directory/file&amp;gt;&lt;br /&gt;
 $ git pull&lt;br /&gt;
&lt;br /&gt;
You can do a:&lt;br /&gt;
 $ make apfXX_defconfig&lt;br /&gt;
to have the latest features automatically activated.&lt;br /&gt;
&lt;br /&gt;
You have to do a '''make''' to rebuild binary files and then upload the binary files to your target.&lt;br /&gt;
&lt;br /&gt;
Note: if definitively everything goes wrong while it worked before the last update.&lt;br /&gt;
You can apply the following procedure (all your modifications in buildroot will be lost):&lt;br /&gt;
 $ rm -rf buildroot/&lt;br /&gt;
 $ rm Makefile&lt;br /&gt;
 $ git pull&lt;br /&gt;
 $ make apfXX_defconfig&lt;br /&gt;
 $ make&lt;br /&gt;
 $ cp buildroot/output/images/* /tftpboot&lt;br /&gt;
&lt;br /&gt;
Enjoy!&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=GDB&amp;diff=9834</id>
		<title>GDB</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=GDB&amp;diff=9834"/>
				<updated>2011-07-05T09:51:58Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;On this page you will find all you need to debug your userspace applications running on your Armadeus board.&lt;br /&gt;
&lt;br /&gt;
{{Note|First of all, be sure to have [[Toolchain|installed the Toolchain on your Host]].}}&lt;br /&gt;
&lt;br /&gt;
==Compile your program with debug symbols==&lt;br /&gt;
* Use ''-g'' option of gcc:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make shell_env&lt;br /&gt;
 $ . armadeus_env.sh&lt;br /&gt;
 $ export PATH=$PATH:$ARMADEUS_TOOLCHAIN_PATH&lt;br /&gt;
&lt;br /&gt;
 $ arm-linux-gcc -g -o hello hello.c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* If you have a Makefile for your project, you probably have a CFLAGS variable, so add it -g. Ex:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
CFLAGS=-W -Wall -g&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging a program running on your APF remotely from your Host (through Ethernet)==&lt;br /&gt;
* On the target launch your program like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # gdbserver 192.168.0.2:2345 program [args]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
''192.168.0.2'' is the IP address of your Host and ''2345'' the port number to use (examples).&lt;br /&gt;
&lt;br /&gt;
* On your Host launch:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 []$ arm-linux-gdb program&lt;br /&gt;
 (gdb) set solib-absolute-prefix ./buildroot/output/build/staging_dir/&lt;br /&gt;
 (gdb) target remote 192.168.0.10:2345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
''192.168.0.10'' is the address of your target&lt;br /&gt;
&lt;br /&gt;
{{Note|Only ''continue / c'' can be used to start the program, because it is already running when you launch GDB on your host.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 (gdb) break main&lt;br /&gt;
 (gdb) continue&lt;br /&gt;
...&lt;br /&gt;
 (gdb) next&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the program is already running, gdbserver can attach itself to the process, if you give him its PID&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ps&lt;br /&gt;
... get process PID&lt;br /&gt;
 # gdbserver 192.168.0.2:2345 --attach PID&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|Core dump analysis doesn't seem to work in this use case (ie on the Host with arm-linux-gdb) !!}}&lt;br /&gt;
&lt;br /&gt;
==Debugging directly on your APF (may require more memory)==&lt;br /&gt;
* You have to build gdb for the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Toolchain  ---&amp;gt;&lt;br /&gt;
        *** Gdb Options ***&lt;br /&gt;
    [*] Build gdb debugger for the Target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can either reflash your rootfs, or copy ''$ARMADEUS_ROOTFS_DIR/bin/gdb'' to your board, to a SD or to a NFS export.&lt;br /&gt;
&lt;br /&gt;
* After installation, launch gdb on your APF:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # gdb your_prog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you need argument passing:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # gdb --args your_prog your_args&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To debug a Core dump:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # gdb your_prog -c your_core_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshots==&lt;br /&gt;
If you see that kind of error message when using gdb:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
dlopen failed on 'libthread_db.so.1' - File not found&lt;br /&gt;
GDB will not be able to debug pthreads.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Don't worry ! ;-)&amp;lt;br&amp;gt;&lt;br /&gt;
''libthread_db.so'' (db == debug) is a library that is needed when you want to debug programs using pthread. You will have to reconfigure the uClibc to get it build:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make uclibc-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
General Library Settings  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    [*] POSIX Threading Support&lt;br /&gt;
    [*]   Build pthreads debugging support&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Save your uClibc config and make it standard for next build:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ cp buildroot/toolchain_build_armv5te/uClibc-0.9.29/.config buildroot/target/device/armadeus/apf27/uClibc.config.arm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild all the toolchain ('''this will erase your local modifications !!''')&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ rm -rf buildroot/toolchain_build_armv5te&lt;br /&gt;
$ rm -rf buildroot/build_armv5te&lt;br /&gt;
$ rm -rf buildroot/project_build_armv5te&lt;br /&gt;
$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://sources.redhat.com/gdb/current/onlinedocs/gdb_5.html Debugging with GDB manual]&lt;br /&gt;
* http://www.kegel.com/linux/gdbserver.html&lt;br /&gt;
* [http://www.linux-france.org/article/memo/node119.html Déboguage avec gdb]&lt;br /&gt;
* [[DDD| DDD (GDB graphical front end)]]&lt;br /&gt;
* [[KGDB|KGDB (for kernel debugging)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Debug]]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=9302</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=9302"/>
				<updated>2011-01-06T10:30:06Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firmware, the ADC multiplexers and the [[ADC_max1027|Max1027 ADC]].&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firmware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers if they are enabled in the kernel configuration. But I have not explore this way.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establishes the connexions between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number.&lt;br /&gt;
*@12000002 0003: Firmware Version.&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal).&lt;br /&gt;
*@12000006 0000: Status Register.&lt;br /&gt;
*@12000008 0000: Command Register.&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB.&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB.&lt;br /&gt;
*@12000010 to @1200004E 0800: Servos Position Registers, default position.&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send commands to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver. Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explanations:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
The R/C servo 0 is enable:&lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7060</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7060"/>
				<updated>2009-07-10T16:56:05Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the Linux Kernel Servo Driver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers if they are enabled in the kernel configuration. But I have not explore this way.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establishes the connexions between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number.&lt;br /&gt;
*@12000002 0003: Firmware Version.&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal).&lt;br /&gt;
*@12000006 0000: Status Register.&lt;br /&gt;
*@12000008 0000: Command Register.&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB.&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB.&lt;br /&gt;
*@12000010 to @1200004E 0800: Servos Position Registers, default position.&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send commands to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver. Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explanations:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
The R/C servo 0 is enable:&lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7059</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7059"/>
				<updated>2009-07-10T16:11:55Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Linux Kernel Servo Driver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers if they are enabled in the kernel configuration. But I have not explore this way.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establishes the connexions between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number.&lt;br /&gt;
*@12000002 0003: Firmware Version.&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal).&lt;br /&gt;
*@12000006 0000: Status Register.&lt;br /&gt;
*@12000008 0000: Command Register.&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB.&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB.&lt;br /&gt;
*@12000010 to @1200004E 0800: Servos Position Registers, default position.&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=ArmadeusWiki:Current_events&amp;diff=7058</id>
		<title>ArmadeusWiki:Current events</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=ArmadeusWiki:Current_events&amp;diff=7058"/>
				<updated>2009-07-10T16:04:37Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Assembly General / LSN 2009 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Assembly General / LSN 2009==&lt;br /&gt;
* On Wednesday July 8 2009 occurred the General Assembly in Nantes (France)&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:GA2009-01.jpg|thumb|center|JulienB ]] || [[Image:GA2009-02.jpg|thumb|center| ]] ||  [[Image:GA2009-03.jpg|thumb|center| ]] || [[Image:GA2009-04.jpg|thumb|center| ]] ||  [[Image:GA2009-05.jpg|thumb|center| ]]&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:GA2009-07.jpg|thumb|center| ]] ||  [[Image:GA2009-08.jpg|thumb|center|L2R: GillesD, JeanFrancoisR ]] || [[Image:GA2009-09.jpg|thumb|center| ]] ||  [[Image:GA2009-10.jpg|thumb|center| ]] || [[Image:GA2009-11.jpg|thumb|center|L2R: ]] &lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:GA2009-12.jpg|thumb|center|L2R:YoannC, GillesD, JeanFrancoisR ]] ||  [[Image:GA2009-15.jpg|thumb|center| L2R:JulienB, YvanR (explaining its project)]] ||  [[Image:GA2009-17.jpg|thumb|center|L2R:JulienB, YvanR (explaining its project) ]] ||  [[Image:GA2009-21.jpg|thumb|center|L2R:JulienB, YvanR: 2008 contest price award ]] || [[Image:GA2009-22.jpg|thumb|center|L2R:JulienB, YvanR: 2008 contest price award ]]   &lt;br /&gt;
|----------------&lt;br /&gt;
|   [[Image:GA2009-23.jpg|thumb|center|L2R:JulienB, FabienM, NicolasC: at the hotel ]] &lt;br /&gt;
|----------------&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==LSN 2008==&lt;br /&gt;
* On 1st to 3rd July 2008 we attended the [http://2008.rmll.info/ RMLL at Mont de Marsan]:&lt;br /&gt;
** [http://free-electrons.com/pub/video/2008/rmll/rmll2008-julien-boibessot-nicolas-colombain-fabien-marteau-armadeus.ogg Video of Embedded systems conference]&lt;br /&gt;
** [http://2008.rmll.info/IMG/pdf/armadeus.pdf sides of the conference is available here]&lt;br /&gt;
&lt;br /&gt;
==General Assembly 2008==&lt;br /&gt;
* On Saturday Mar. 9th 2008 occurred the General Assembly in Mulhouse (France).&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:AG2008_01.jpg|thumb|center|L2R: Nicolas, Frédéric and Fabien]] || [[Image:AG2008_02.jpg|thumb|center|Nicolas and Frédéric]] || [[Image:AG2008_03.jpg|thumb|center|Julien, Michael and Fabrice]]&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:AG2008_04.jpg|thumb|center|L2R: Nicolas and Frédéric ]] || [[Image:AG2008_05.jpg|thumb|center| L2R: Fabrice and Eric]] || [[Image:AG2008_06.jpg|thumb|center| everyone ;-)]] ||&lt;br /&gt;
|----------------&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==General Assembly 2007==&lt;br /&gt;
* On Saturday Feb. 17th 2007 occured the annual meeting in Mulhouse (France).&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:ArmadeusAM07-1.JPG|thumb|center| L2R: Paola, Nicolas, Julien, Sébastien, Michael]] || [[Image:ArmadeusAM07-2.JPG|thumb|center|Paola, Michael]] || [[Image:ArmadeusAM07-3.JPG|thumb|center|Michael, Eric, Fabrice, Frédéric, Julien]]&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:ArmadeusAM07-4.JPG|thumb|center|GàD: Eric, Fabrice, Frédéric,Nicolas, Julien, Michael]] || [[Image:ArmadeusAM07-5.JPG|thumb|center|again ;-)]] || &lt;br /&gt;
|----------------&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=ArmadeusWiki:Current_events&amp;diff=7057</id>
		<title>ArmadeusWiki:Current events</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=ArmadeusWiki:Current_events&amp;diff=7057"/>
				<updated>2009-07-10T16:03:59Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Gebneral Assembly 2008 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Assembly General / LSN 2009==&lt;br /&gt;
* On Wednesday July 8 2009 occured the General Assembly in Nantes (France)&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:GA2009-01.jpg|thumb|center|JulienB ]] || [[Image:GA2009-02.jpg|thumb|center| ]] ||  [[Image:GA2009-03.jpg|thumb|center| ]] || [[Image:GA2009-04.jpg|thumb|center| ]] ||  [[Image:GA2009-05.jpg|thumb|center| ]]&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:GA2009-07.jpg|thumb|center| ]] ||  [[Image:GA2009-08.jpg|thumb|center|L2R: GillesD, JeanFrancoisR ]] || [[Image:GA2009-09.jpg|thumb|center| ]] ||  [[Image:GA2009-10.jpg|thumb|center| ]] || [[Image:GA2009-11.jpg|thumb|center|L2R: ]] &lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:GA2009-12.jpg|thumb|center|L2R:YoannC, GillesD, JeanFrancoisR ]] ||  [[Image:GA2009-15.jpg|thumb|center| L2R:JulienB, YvanR (explaining its project)]] ||  [[Image:GA2009-17.jpg|thumb|center|L2R:JulienB, YvanR (explaining its project) ]] ||  [[Image:GA2009-21.jpg|thumb|center|L2R:JulienB, YvanR: 2008 contest price award ]] || [[Image:GA2009-22.jpg|thumb|center|L2R:JulienB, YvanR: 2008 contest price award ]]   &lt;br /&gt;
|----------------&lt;br /&gt;
|   [[Image:GA2009-23.jpg|thumb|center|L2R:JulienB, FabienM, NicolasC: at the hotel ]] &lt;br /&gt;
|----------------&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==LSN 2008==&lt;br /&gt;
* On 1st to 3rd July 2008 we attended the [http://2008.rmll.info/ RMLL at Mont de Marsan]:&lt;br /&gt;
** [http://free-electrons.com/pub/video/2008/rmll/rmll2008-julien-boibessot-nicolas-colombain-fabien-marteau-armadeus.ogg Video of Embedded systems conference]&lt;br /&gt;
** [http://2008.rmll.info/IMG/pdf/armadeus.pdf sides of the conference is available here]&lt;br /&gt;
&lt;br /&gt;
==General Assembly 2008==&lt;br /&gt;
* On Saturday Mar. 9th 2008 occurred the General Assembly in Mulhouse (France).&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:AG2008_01.jpg|thumb|center|L2R: Nicolas, Frédéric and Fabien]] || [[Image:AG2008_02.jpg|thumb|center|Nicolas and Frédéric]] || [[Image:AG2008_03.jpg|thumb|center|Julien, Michael and Fabrice]]&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:AG2008_04.jpg|thumb|center|L2R: Nicolas and Frédéric ]] || [[Image:AG2008_05.jpg|thumb|center| L2R: Fabrice and Eric]] || [[Image:AG2008_06.jpg|thumb|center| everyone ;-)]] ||&lt;br /&gt;
|----------------&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==General Assembly 2007==&lt;br /&gt;
* On Saturday Feb. 17th 2007 occured the annual meeting in Mulhouse (France).&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:ArmadeusAM07-1.JPG|thumb|center| L2R: Paola, Nicolas, Julien, Sébastien, Michael]] || [[Image:ArmadeusAM07-2.JPG|thumb|center|Paola, Michael]] || [[Image:ArmadeusAM07-3.JPG|thumb|center|Michael, Eric, Fabrice, Frédéric, Julien]]&lt;br /&gt;
|----------------&lt;br /&gt;
|[[Image:ArmadeusAM07-4.JPG|thumb|center|GàD: Eric, Fabrice, Frédéric,Nicolas, Julien, Michael]] || [[Image:ArmadeusAM07-5.JPG|thumb|center|again ;-)]] || &lt;br /&gt;
|----------------&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7056</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7056"/>
				<updated>2009-07-10T15:53:09Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers if they are enabled in the kernel configuration. But I have not explore this way.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establishes the connexions between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number.&lt;br /&gt;
*@12000002 0003: Firmware Version.&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal).&lt;br /&gt;
*@12000006 0000: Status Register.&lt;br /&gt;
*@12000008 0000: Command Register.&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB.&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB.&lt;br /&gt;
*@12000010 to @1200004E 0800: Servos Position Registers, default position.&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7055</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7055"/>
				<updated>2009-07-10T15:33:07Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to connect the hardware interface board to the Armadeus APF9328DevLight board */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers if they are enabled in the kernel configuration. But I have not explore this way.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establishes the connexions between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7054</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7054"/>
				<updated>2009-07-10T15:31:00Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* R/C Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers if they are enabled in the kernel configuration. But I have not explore this way.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7053</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7053"/>
				<updated>2009-07-10T14:45:19Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* R/C Servo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous.&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming. With latest Linux kernel (after 2.6.16), it would be possible to implement short delays with high-resolution timers.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impossible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7051</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7051"/>
				<updated>2009-07-10T14:14:01Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7050</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7050"/>
				<updated>2009-07-10T14:13:31Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board:iii&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware:&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver:&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon:&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application:&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7049</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7049"/>
				<updated>2009-07-10T14:12:40Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board:&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout. The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;. The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle].&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware:&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver:&lt;br /&gt;
The Linux Kernel Driver is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ArmadeusServoDriver&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon:&lt;br /&gt;
The User Space Daemon is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
;User GUI Application:&lt;br /&gt;
The User GUI Application is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7048</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7048"/>
				<updated>2009-07-10T14:08:11Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon over the network connexion.&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7020</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7020"/>
				<updated>2009-07-08T00:08:39Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
The FPGA firmware is located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;fpgaFirmware&amp;lt;/font&amp;gt; directory&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7019</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7019"/>
				<updated>2009-07-08T00:05:19Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, there is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7018</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7018"/>
				<updated>2009-07-08T00:03:03Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Hardware-Interface-Board/Hardware-Interface-Board.sch&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7017</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7017"/>
				<updated>2009-07-08T00:02:13Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Project Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file Hardware-Interface-Board/Hardware-Interface-Board.sch&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7016</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7016"/>
				<updated>2009-07-07T18:02:20Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to buildthe User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to build the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7015</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7015"/>
				<updated>2009-07-07T18:01:03Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* User GUI Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7014</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7014"/>
				<updated>2009-07-07T18:00:43Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* User GUI Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x. User GUI Application is located in the ServoGui directory of the main archive file of the project (see above). The following files form the User GUI Application: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;main.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main application file.&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.cpp&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Application file.&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui.pro&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt project file.&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servogui.ui&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Qt form file.&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Batchfile.txt&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Example of batch file.&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rc/servo.PNG&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Icon file.&lt;br /&gt;
&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7013</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7013"/>
				<updated>2009-07-07T17:52:33Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to use the User GUI Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  XXX.XXX.XXX.XXX&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7012</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7012"/>
				<updated>2009-07-07T17:51:36Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to use the User GUI Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
The User Space Motion Daemon must be launched on the Armadeus target.&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
Connection to the Armadeus target:&lt;br /&gt;
Type the IP address or the host name of the Armadeus target in the field Remote Host. Then click on the Connect button. ServoGui says:&lt;br /&gt;
 state: MOTION_CLIENT_STATE_NOT_CONNECTED&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_NO_SIGNED&lt;br /&gt;
 Connexion Ok:  10.198.56.83&lt;br /&gt;
 Reply From Server: MOTION SERVER OK&lt;br /&gt;
 state: MOTION_CLIENT_STATE_CONNECTED_READY_TO_SEND&lt;br /&gt;
Now you can play with the graphical controls to move R/C servo...&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7011</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7011"/>
				<updated>2009-07-07T17:29:48Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;XXX.XXX.XXX.XXX&amp;lt;/font&amp;gt; is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command. Enable the R/C servo 0:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_ENABLE ( 0 , 1 )&lt;br /&gt;
Set the R/C servo 0 setpoint position to 250: &lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 SET_POSITION ( 0 , 250 )&lt;br /&gt;
Get the R/C servo 0 setpoint position:&lt;br /&gt;
 GET_POSITION ( 0 )&lt;br /&gt;
The Motion Daemon answers:&lt;br /&gt;
 250&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7010</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7010"/>
				<updated>2009-07-07T17:24:34Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* Motion Daemon Language */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo , status):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where XXX.XXX.XXX.XXX is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command:&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7009</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7009"/>
				<updated>2009-07-07T17:20:11Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
he User Space Motion Daemon is ready and waits for incoming client connexion. Be sure that the Armadeus target and your host development system can dialog over a TCP/IP connection. On your host type:&lt;br /&gt;
 telnet XXX.XXX.XXX.XXX 1972&lt;br /&gt;
Where XXX.XXX.XXX.XXX is the IP address of the Armadeus target. The Motion Daemon answers:&lt;br /&gt;
 MOTION SERVER OK&lt;br /&gt;
The connection between your host and the Motion Daemon is established. You can send command:&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7008</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7008"/>
				<updated>2009-07-07T17:12:57Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
 &lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7007</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7007"/>
				<updated>2009-07-07T17:12:40Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
Run the User Space Motion Daemon:&lt;br /&gt;
 ./MotionServer&lt;br /&gt;
After some default parameters settings, you get:&lt;br /&gt;
 Starting server&lt;br /&gt;
 Making socket&lt;br /&gt;
 Binding to port 1972opened socket as fd (4) on port (1972) for stream i/o&lt;br /&gt;
 Server&lt;br /&gt;
                  sin_family        = 2&lt;br /&gt;
                  sin_addr.s_addr   = 0&lt;br /&gt;
                  sin_port          = 1972&lt;br /&gt;
&lt;br /&gt;
 Making a listen queue of 0 elements&lt;br /&gt;
 Waiting for a connection&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7006</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7006"/>
				<updated>2009-07-07T17:09:22Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to buildthe User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7005</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7005"/>
				<updated>2009-07-07T17:08:53Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to buildthe User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServer directory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; ELF ARM file. Copy the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7004</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7004"/>
				<updated>2009-07-07T17:07:36Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to buildthe User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServerdirectory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
Before building the daemon, please adapt the path of the variables CC and STRIP to your environment.&lt;br /&gt;
&lt;br /&gt;
 cd MotionServer&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
You get a MotionServer ELF ARM file. Copy the file MotionServer and .MotionServerrc somewhere on the Armadeus target.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7003</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7003"/>
				<updated>2009-07-07T16:54:54Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* User Space Motion Daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is located in the MotionServerdirectory of the main archive file of the project (see above). The following files form the User Space Motion Daemon: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Daemon makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Configuration sample file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;rcfile.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the configuration file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Lex lexer file for the command language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Yacc BNF grammar file for the command language.&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7002</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7002"/>
				<updated>2009-07-07T16:24:26Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
Enable R/C servo 0:&lt;br /&gt;
 cd /sys/class/servo/servo0&lt;br /&gt;
 echo '1' &amp;gt; enable&lt;br /&gt;
The R/C servo takes mid position (default position).&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 enable status:&lt;br /&gt;
 cat enable&lt;br /&gt;
 &lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at mid position:&lt;br /&gt;
 2048&lt;br /&gt;
&lt;br /&gt;
Put the R/C servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 echo '0' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 0&lt;br /&gt;
Put the R/C servo 0 on the maximal clockwise position:&lt;br /&gt;
 echo '4095' &amp;gt; desired_position&lt;br /&gt;
Show R/C servo 0 setpoint position:&lt;br /&gt;
 cat desired_position&lt;br /&gt;
The R/C servo 0 is at the maximal counterclockwise position:&lt;br /&gt;
 4095&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7001</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7001"/>
				<updated>2009-07-07T15:58:11Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the Linux Kernel Servo Driver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
Explaination:&lt;br /&gt;
*current_position: Read Only, the current position of this R/C servo.&lt;br /&gt;
*desired_position: Read/Write, setpoint position (the position that you want for this R/C servo). &lt;br /&gt;
*enable: Read/Write, R/C servo enable status, 0 the R/C is freewheeling, 1 it is on.&lt;br /&gt;
*lower_boundary: Read/Write, the minimal position for this R/C servo.&lt;br /&gt;
*upper_boundary: Read/Write, the maximal position for this R/C servo.&lt;br /&gt;
*offset: Read/Write, the position offset for this R/C servo.&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7000</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=7000"/>
				<updated>2009-07-07T15:35:30Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the Linux Kernel Servo Driver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls -l /sys/class/servo_contoller/servo_contoller0/&lt;br /&gt;
&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Each R/C servo has a directory:&lt;br /&gt;
 servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
 servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
 servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
 servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
 ls -l /sys/class/servo/servo0/&lt;br /&gt;
&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:14 current_position&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 desired_position&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 device -&amp;gt; ../../../devices/platform/servo.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 enable&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 lower_boundary&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 offset&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 speed_step&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:14 subsystem -&amp;gt; ../../servo&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 uevent&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:14 upper_boundary&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6999</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6999"/>
				<updated>2009-07-07T15:31:32Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the Linux Kernel Servo Driver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system answers:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
Communications with the driver use the /sys filesystem:&lt;br /&gt;
 ls /sys/class/servo_contoller/*&lt;br /&gt;
Files relative to Servo Controller:&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 device -&amp;gt; ../../../devices/platform/servo_contoller.0&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 enable&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 firmware_version&lt;br /&gt;
 -r--r--r--    1 root     root         4096 Jan  1 01:11 nbr_servos&lt;br /&gt;
 --w-------    1 root     root         4096 Jan  1 01:11 reset&lt;br /&gt;
 lrwxrwxrwx    1 root     root            0 Jan  1 01:11 subsystem -&amp;gt; ../../servo_contoller&lt;br /&gt;
 -rw-r--r--    1 root     root         4096 Jan  1 01:11 uevent&lt;br /&gt;
&lt;br /&gt;
 ls /sys/class/servo&lt;br /&gt;
Files &lt;br /&gt;
servo0   servo12  servo16  servo2   servo23  servo27  servo30  servo6&lt;br /&gt;
servo1   servo13  servo17  servo20  servo24  servo28  servo31  servo7&lt;br /&gt;
servo10  servo14  servo18  servo21  servo25  servo29  servo4   servo8&lt;br /&gt;
servo11  servo15  servo19  servo22  servo26  servo3   servo5   servo9&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6998</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6998"/>
				<updated>2009-07-07T15:23:37Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the Linux Kernel Servo Driver */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
Load the Linux Kernel Servo Driver: Log on the Armadeus target and type:&lt;br /&gt;
  modprobe servo&lt;br /&gt;
The system says:&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Version 0.1&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Magic ID OK 0X7207&lt;br /&gt;
 Armadeus FPGA R/C servo driver: Firmware version 0X3&lt;br /&gt;
 Armadeus FPGA R/C servo driver: 32 R/C servo(s) managed by the FPGA firmware&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6996</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6996"/>
				<updated>2009-07-05T22:43:27Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
&lt;br /&gt;
At the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 md.w 12000000&lt;br /&gt;
Result:&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
Result: The R/C servos 0-15 &lt;br /&gt;
 md.w 12000000&lt;br /&gt;
&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6995</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6995"/>
				<updated>2009-07-05T22:30:34Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
*@12000000 7207: Firmware Magic Number&lt;br /&gt;
*@12000002 0003: Firmware Version&lt;br /&gt;
*@12000004 0020: Number of R/C servos managed (32 in decimal)&lt;br /&gt;
*@12000006 0000: Status Register&lt;br /&gt;
*@12000008 0000: Command Register&lt;br /&gt;
*@1200000A 0000: Enable Servo Register LSB&lt;br /&gt;
*@1200000C 0000: Enable Servo Register MSB&lt;br /&gt;
*@12000010 to *@1200004E 0800: Servos Position Registers, default position&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6994</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6994"/>
				<updated>2009-07-05T22:25:03Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
Explaination:&lt;br /&gt;
* @12000000 7207: Firmware Magic Number&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6993</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6993"/>
				<updated>2009-07-05T22:22:48Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: &amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;7207&amp;lt;/p&amp;gt; 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6992</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6992"/>
				<updated>2009-07-05T22:19:32Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6991</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6991"/>
				<updated>2009-07-05T22:18:32Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&amp;lt;colorize&amp;gt;Show the FPGA Memory Register:&amp;lt;/colorize&amp;gt;&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6990</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6990"/>
				<updated>2009-07-05T22:09:48Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal clockwise position:&lt;br /&gt;
 mw.w 12000010 0FFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0fff 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6989</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6989"/>
				<updated>2009-07-05T22:08:06Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the median position:&lt;br /&gt;
 mw.w 12000010 0800&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6988</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6988"/>
				<updated>2009-07-05T21:59:58Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Put the servo 0 on the maximal counterclockwise position:&lt;br /&gt;
 mw.w 12000010 0000&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt;  md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0000 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6987</id>
		<title>MotionSystem</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=MotionSystem&amp;diff=6987"/>
				<updated>2009-07-05T21:58:12Z</updated>
		
		<summary type="html">&lt;p&gt;YvanR: /* How to test the FPGA firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Description==&lt;br /&gt;
&lt;br /&gt;
The application field of this project is robotic.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to provide a R/C Servos Controller to manage R/C by different ways, and a motion measurement system via accelerometers.&lt;br /&gt;
&lt;br /&gt;
The project is composed by different componants:&lt;br /&gt;
* A hardware board on which are plugged R/C servos, accelerometers and ADC multiplexers.&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level (Already written, thanks to Sonzerro and Fabien Marteau).&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware, the ADC multiplexers and ADC Max1027.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
''Texte italique''&lt;br /&gt;
&lt;br /&gt;
==Participating Armadeus members==&lt;br /&gt;
* Yvan ROCH&lt;br /&gt;
&amp;lt;!--* [[User:YvanR]]* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project data==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Overall original objectives of the project have not been reached. The following functionality are not implemented:&lt;br /&gt;
* The accelerometers and ADC multiplexers are under development (hardware, driver and user application).&lt;br /&gt;
* The board is available in schematic form. No PCB layout.&lt;br /&gt;
&lt;br /&gt;
The following functionality are implemented:&lt;br /&gt;
* A FPGA firmware which manages R/C servo at low level.&lt;br /&gt;
* A Linux Kernel Driver which manages the FPGA Firware.&lt;br /&gt;
* A user space daemon which manages the driver and listen on TCP port to accept remote commands from the network.&lt;br /&gt;
* A user desktop application which sends commands to the daemon.&lt;br /&gt;
&lt;br /&gt;
===Project Files===&lt;br /&gt;
All the necessary files are available in an archive under the following URL:&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
;Hardware Interface Board&lt;br /&gt;
The board contains the logic and voltage level adaptation to drive the R/C servos. As already said, the is no PCB layout.&lt;br /&gt;
&lt;br /&gt;
The schematic is available in the file...&lt;br /&gt;
&lt;br /&gt;
The schematic was design with Eagle available at the following URL: [http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
;FPGA Firmware&lt;br /&gt;
&lt;br /&gt;
;Linux Kernel Driver&lt;br /&gt;
&lt;br /&gt;
;User Space Daemon&lt;br /&gt;
&lt;br /&gt;
;User GUI Application&lt;br /&gt;
&lt;br /&gt;
==How to use the project==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
The main goal of this project is to develop a system to manage motion on robotic platform. Finally only the subsystem that manages R/C servos is achieved. The MotionSystem can manage up to 32 R/C servos.&lt;br /&gt;
R/C servos are a good solution to the moving issue on a small robotic platform. Hobbyist robotic platform like Lynxmotion Robots ([http://www.lynxmotion.com http://www.lynxmotion.com]) use many R/C servos.&lt;br /&gt;
&lt;br /&gt;
====R/C Servo====&lt;br /&gt;
A description (in French) of such R/C servo can be found at [http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]. R/C servo needs a pulse-width modulated (PWM) signal to manage his angular position. This signal looks like this:&lt;br /&gt;
[[Image:Servos-signal.jpg|800px|center|R/C Servo PWM Signal]]&lt;br /&gt;
Basically, it is possible to generate this signal with a GPIO pin controlled by Linux kernel code. But this solution has three major drawbacks:&lt;br /&gt;
* The true concurrency is impossible, R/C servo signal are not synchronous&lt;br /&gt;
* The delays of PWM signal (between 0.5 ms and 2.5 ms) are mandatory implemented with busy waiting (udelay Linux kernel function) to give the necessary accuracy. It is very processor time consuming.&lt;br /&gt;
* Due to the intrinsic non real time characteristic of the Linux kernel, the accuracy of the delays are impassible on a heavy loaded system. This causes R/C servo jittering (When a R/C servo jitters, it seems to have Parkinson's disease... [http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
For these reasons, the subsystem that generates PWM signals is implemented in the FPGA. In a FPGA, true concurrency is feasible, no processor time is used and timings are very strict.&lt;br /&gt;
&lt;br /&gt;
====MotionSystem Architecture====&lt;br /&gt;
The MotionSystem architecture is describe in the following diagram:&lt;br /&gt;
[[Image:MotionSystem-Architecture.png|800px|center|MotionSystem Architecture]]&lt;br /&gt;
&lt;br /&gt;
===Hardware Interface Board===&lt;br /&gt;
The schematic diagram of the interface board is located in the hardwareInterfaceBoard directory of the main archive file of the project (see above).&lt;br /&gt;
The design is very simple for this version without R/C servo strength control and accelerometers. It is mainly composed of buffers between FPGA output and R/C servo input.&lt;br /&gt;
The following diagram is an export of the original Eagle file of the main archive:&lt;br /&gt;
[[Image:Hardware-Interface-Board.png|1024px|center|MotionSystem Schematic Diagram]]&lt;br /&gt;
====How to connect the hardware interface board to the Armadeus APF9328DevLight board====&lt;br /&gt;
The following table establish the connexion between the interface board and the Armadeus APF9328DevLight board. The pinout of the Armadeus APF9328DevLight board is available at [[APF9328DevLight]]. Please refer to the official documentation for other boards.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| Signal on the diagram || APF9328DevLight pin || Spartan 3 pin&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut00 || L24N_3 || P87&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut01 || L24P_3 || P86&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut02 || L23N_3 || P85&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut03 || L40P_2 || P92&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut04 || L40N_3 || P90&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut05 || L40P_3 || P89&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut06 || L24N_2 || P96&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut07 || L24P_2 || P95&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut08 || L40N_2 || P93&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut09 || L22P_2 || P99&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut10 || L23N_2 || P98&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut11 || L23P_2 || P97&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut12 || L21N_2 || P103&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut13 || L21P_2 || P102&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut14 || L22N_2 || P100&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut15 || L01P_2 || P107&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut16 || L20N_2 || P105&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut17 || L20P_2 || P104&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut18 || L32N_0 || P128&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut19 || L32P_0 || P127&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut20 || L01N_2 || P108&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut21 || L31P_0 || P129&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut22 || L31N_0 || P130&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut23 || L32N_1 || P125&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut24 || L30P_0 || P131&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut25 || L30N_0 || P132&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut26 || L27P_0 || P135&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut27 || L28N_1 || P119&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut28 || L28P_1 || P118&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut29 || IO1 || P116   &lt;br /&gt;
|-&lt;br /&gt;
| pwmOut30 || L01P_1 || P112&lt;br /&gt;
|-&lt;br /&gt;
| pwmOut31 || L01N_1 || P113&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===FPGA Firmware===&lt;br /&gt;
For basics about FPGA on Armadeus board, please consult [[FPGA]].&lt;br /&gt;
&lt;br /&gt;
The FPGA firmware is located in the fpgaFirmware directory of the main archive file of the project (see above). The following files form the FPGA firmware:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This is the main module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;COUNTER.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a 16 bits counter at 4 MHz used by all the PWM modules.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;RESET_MODULE.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module is a cold start reset generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;pwm_module.vhd&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: This module generates the PWM output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ucf&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Signals/pins mapping file.&lt;br /&gt;
&lt;br /&gt;
====How to build the FPGA Firmware:====&lt;br /&gt;
The Xilinx ISE® WebPACK™ design software is used to build the FPGA firmware.&lt;br /&gt;
&lt;br /&gt;
;1 - Create a new project for the Spartan 3:&lt;br /&gt;
* File-&amp;gt;New Project&lt;br /&gt;
* Select Top Level Source: HDL (Hardware Description Language)&lt;br /&gt;
* For the Armadeus FPGA choose:&lt;br /&gt;
::Family: Spartan3&lt;br /&gt;
::Device: XC3S200&lt;br /&gt;
::Package: TQ144&lt;br /&gt;
::Speed: -4&lt;br /&gt;
::Top Level Source: HDL&lt;br /&gt;
::Synthesis Tool: XST&lt;br /&gt;
::Simulator: ISE Simulator (VHDL/Verilog)&lt;br /&gt;
::Preferred Language: VHDL&lt;br /&gt;
&lt;br /&gt;
;2 - Import the source files in the project:&lt;br /&gt;
* Project-&amp;gt;Add Source&lt;br /&gt;
* Select files:&lt;br /&gt;
::SERVO_top.vhd&lt;br /&gt;
::COUNTER.vhd&lt;br /&gt;
::RESET_MODULE.vhd&lt;br /&gt;
::pwm_module.vhd&lt;br /&gt;
::servo.ucf&lt;br /&gt;
&lt;br /&gt;
;3 - Synthesize SERVO_top.bit firmware binary file:&lt;br /&gt;
* Generate Programming File-&amp;gt;right click-&amp;gt;Run&lt;br /&gt;
* You get a &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;SERVO_top.bit&amp;lt;/font&amp;gt; in the ISE project directory.&lt;br /&gt;
&lt;br /&gt;
====How to load SERVO_top.bit firmware binary file in the Spartan 3====&lt;br /&gt;
You need a connexion with the Armadeus board, RS323 or TFTP. For basics about communication with the Armadeus board, please consult [[Connection_with_U-Boot_on_Linux]]. The RS232 method is describe here but the TFTP transfer is possible and faster.&lt;br /&gt;
* Install and configure Kermit like describe in [[Kermit]].&lt;br /&gt;
* Launch Kermit.&lt;br /&gt;
* Power up the Armadeus board.&lt;br /&gt;
* Hit any key to stop auto boot and to obtain the command prompt:&lt;br /&gt;
 BIOS&amp;gt;&lt;br /&gt;
* Choose the upload memory address:&lt;br /&gt;
 loadb 08000000&lt;br /&gt;
* The Armadeus board is ready to receive file:&lt;br /&gt;
 ## Ready for binary (kermit) download to 0x08000000 at 115200 bps...&lt;br /&gt;
* Change to the Kermit command mode:&lt;br /&gt;
 Ctrl+Altgr+\+c&lt;br /&gt;
* File upload:&lt;br /&gt;
 send SERVO_top.bit&lt;br /&gt;
* Kermit upload the file. After uploading, Kermit says:&lt;br /&gt;
 Hit c to reconnect the terminal.&lt;br /&gt;
* Firmware Flashing:&lt;br /&gt;
 run flash_firmware&lt;br /&gt;
* Loading the firmware in the FPGA:&lt;br /&gt;
 fpga load 0 ${firmware_addr} ${firmware_len}&lt;br /&gt;
* For an automatic loading at boot:&lt;br /&gt;
 setenv firmware_autoload 1&lt;br /&gt;
 saveenv&lt;br /&gt;
* The firmware is now usable!!!&lt;br /&gt;
&lt;br /&gt;
====How to test the FPGA firmware====&lt;br /&gt;
The FPGA firmware is not design to be used with U-Boot command. In the final configuration, firmware is managed by the Servo Linux Kernel Driver. However, it is possible to send command to the firmware with U-Boot command and show the result. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the firmware. First, you must build hardware interface board as describe in section [[MotionSystem#Hardware_Interface_Board|Hardware Interface Board]] and connect R/C servos to the interface.&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
Show the FPGA Memory Register:&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 0000 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
Servos 0-15 enabling:&lt;br /&gt;
 mw.w 1200000A FFFF&lt;br /&gt;
&lt;br /&gt;
 BIOS&amp;gt; md.w 12000000&lt;br /&gt;
 12000000: 7207 0003 0020 0000 0000 ffff 0000 0000    .r.. ...........&lt;br /&gt;
 12000010: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000020: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000030: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000040: 0800 0800 0800 0800 0800 0800 0800 0800    ................&lt;br /&gt;
 12000050: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000060: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
 12000070: 0000 0000 0000 0000 0000 0000 0000 0000    ................&lt;br /&gt;
&lt;br /&gt;
===Linux Kernel Servo Driver===&lt;br /&gt;
The Linux kernel driver is located in the ArmadeusServoDriver directory of the main archive file of the project (see above). The following files form the Linux kernel driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.c&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Main file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.h&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Header file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Makefile&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel module makefile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;Kconfig&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;: Kernel configuration file.&lt;br /&gt;
&lt;br /&gt;
====How to build and install the Linux Kernel Servo Driver====&lt;br /&gt;
Before building the servo driver, be sure that the [[Toolchain]] and the Linux Kernel build system work fine on your host system. In the following, &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT&amp;lt;/font&amp;gt; will refer to the root directory of Armadeus SDK (for example: &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/usr/local/src/armadeus3-trunk&amp;lt;/font&amp;gt;)&lt;br /&gt;
 export ARMADEUS_ROOT=/usr/local/src/armadeus3-trunk&lt;br /&gt;
Create a symbolic link in the FPGA driver directory of the Armadeus SDK to the ArmadeusServoDriver directory:&lt;br /&gt;
 ln -s ~/ArmadeusServoDriver  $ARMADEUS_ROOT/target/linux/modules/fpga/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT/target/linux/modules/fpga/Makefile&amp;lt;/font&amp;gt; by replacing:&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/&lt;br /&gt;
by&lt;br /&gt;
 obj-$(CONFIG_ARMADEUS_FPGA_DRIVERS)     += dev_tools/ others/ POD/ wishbone_example/ ArmadeusServoDriver/&lt;br /&gt;
Reference the new directory in the file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;$ARMADEUS_ROOT//target/linux/modules/fpga/Kconfig&amp;lt;/font&amp;gt; by adding:&lt;br /&gt;
 source &amp;quot;drivers/armadeus/fpga/ArmadeusServoDriver/Kconfig&amp;quot;&lt;br /&gt;
Configure the Linux kernel to build the servo module:&lt;br /&gt;
 cd $ARMADEUS_ROOT&lt;br /&gt;
 make linux26-menuconfig&lt;br /&gt;
In  Device Drivers  ---&amp;gt;  Armadeus specific drivers  ---&amp;gt;  FPGA Drivers, select Armadeus Servo driver (NEW) as module.&lt;br /&gt;
Rebuild the new Linux kernel and modules:&lt;br /&gt;
 make clean&lt;br /&gt;
 make&lt;br /&gt;
The module &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo.ko&amp;lt;/font&amp;gt; is now in target root filesystem and in the ArmadeusServoDriver directory. Install your new Linux Kernel and your root filesystem as describe in [[Target_Software_Installation]]&lt;br /&gt;
&lt;br /&gt;
====How to test the Linux Kernel Servo Driver====&lt;br /&gt;
Linux Kernel Servo Driver is not design to be used with shell command. In the final configuration, the driver is managed by the User Space Daemon. However, it is possible to send command to the driver via writing in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;/sys&amp;lt;/font&amp;gt; filesystem. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the driver. First, you must build and load the Servo FPGA Firmware as describe in section [[MotionSystem#FPGA_Firmware|FPGA Firmware]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User Space Motion Daemon===&lt;br /&gt;
The User Space Motion Daemon is a user space Linux process that drives R/C servos via the Linux Kernel Servo Driver. At startup it loads the Linux Kernel Servo Driver if specified in his configuration file. It sets the R/C servos at their default values as specified in the configuration file. Next it listens at the TCP port 1972 and waits connexion from a client. When a client connects to him, they dialog using a specific language described in section [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. The daemon interprets and executes commands send using this language.&lt;br /&gt;
====Motion Daemon Language====&lt;br /&gt;
The communication between a client and the Motion Daemon is controlled by a little context-free language. It is build under Lex and Yacc. The BNF and the lexical can be found in files &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.y&amp;lt;/font&amp;gt; and &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;command.l&amp;lt;/font&amp;gt; respectively in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; directory. The commands available are the following:&lt;br /&gt;
*Set the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the position &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;position&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_POSITION ( servo , position )&lt;br /&gt;
*Enable the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;. If R/C servo is enable, it keeps its position else it is freewheeling. &lt;br /&gt;
 SET_ENABLE ( servo ):&lt;br /&gt;
*Set the position offset for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;offset&amp;lt;/font&amp;gt; (integer between -4095 and 4095):&lt;br /&gt;
 SET_OFFSET  ( servo , offset )&lt;br /&gt;
*Set the minimal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;min&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MIN ( servo , min )&lt;br /&gt;
*Set the maximal position for the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt; (integer between 0 and 31) at the value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;max&amp;lt;/font&amp;gt; (integer between 0 and 4095):&lt;br /&gt;
 SET_MAX ( servo , max )&lt;br /&gt;
*Return the position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_POSITION ( servo )&lt;br /&gt;
*Return the enable state of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_ENABLE ( servo )&lt;br /&gt;
*Return the position offset of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_OFFSET ( servo )&lt;br /&gt;
*Return the minimal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MIN ( servo )&lt;br /&gt;
*Return the maximal position of the R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;servo&amp;lt;/font&amp;gt;:&lt;br /&gt;
 GET_MAX ( servo )&lt;br /&gt;
*Write the current state (R/C servos position, position offset, minimum position, maximum position, enable state) in a file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;path&amp;lt;/font&amp;gt;on the local Armadeus board:&lt;br /&gt;
 WRITE_CONFIG_FILE ( path )&lt;br /&gt;
*Wait &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;seconds&amp;lt;/font&amp;gt; seconds before processing next command:&lt;br /&gt;
 SLEEP ( seconds )&lt;br /&gt;
&lt;br /&gt;
====Motion Daemon Configuration File====&lt;br /&gt;
The User Space Motion Daemon need a configuration file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; located in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;MotionServer&amp;lt;/font&amp;gt; binary file directory. The minimal file is:&lt;br /&gt;
 [Module]&lt;br /&gt;
 &lt;br /&gt;
 [Default]&lt;br /&gt;
&lt;br /&gt;
The configuration file is in two sections.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Module]&amp;lt;/font&amp;gt;: This section concerns the configuration of the Linux Kernel Servo Driver. Options are&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleFilePath /path/to/the/module&amp;lt;/font&amp;gt;: Set the path of the Linux Kernel Servo Driver module.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ModuleLoad [0|1]&amp;lt;/font&amp;gt;: Set the auto-loading of the Linux Kernel Servo Driver module at the daemon startup.&lt;br /&gt;
*&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;[Default]&amp;lt;/font&amp;gt;: This section concerns the default configuration of each R/C servo. However, all R/C servos and all parameters for each R/C servo are not mandatory. Only specified parameters are processed.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoPosition idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoOffset idServo value&amp;lt;/font&amp;gt;: Set the default position of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMin idServo value&amp;lt;/font&amp;gt;: Set the default lower position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoMax idServo value&amp;lt;/font&amp;gt;: Set the default upper position boundary of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
**&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoEnable idServo value&amp;lt;/font&amp;gt;: Set the default enable status of R/C servo &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;idServo&amp;lt;/font&amp;gt; at value &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;value&amp;lt;/font&amp;gt;.&lt;br /&gt;
Example of typical &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;.MotionServerrc&amp;lt;/font&amp;gt; file:&lt;br /&gt;
 [Module]&lt;br /&gt;
 ModuleFilePath /mnt/motion_system.ko&lt;br /&gt;
 ModuleLoad 1&lt;br /&gt;
 [Default]&lt;br /&gt;
 ServoPosition 0 1569&lt;br /&gt;
 ServoOffset 0 10&lt;br /&gt;
 ServoMin 0 300&lt;br /&gt;
 ServoMax 0 3500&lt;br /&gt;
 ServoEnable 0 1&lt;br /&gt;
 ServoPosition 10 3000&lt;br /&gt;
 ServoOffset 10 -20&lt;br /&gt;
 ServoMin 10 150&lt;br /&gt;
 ServoMax 10 3900&lt;br /&gt;
 ServoEnable 10 0&lt;br /&gt;
&lt;br /&gt;
====How to test the User Space Motion Daemon====&lt;br /&gt;
The User Space Motion Daemon is not design to be used with shell command. In the final configuration, the daemon is managed by the client application (the User GUI Application provided or yours). However, it is possible to send command to the daemon via opening a socket to daemon and writing Motion Daemon Language command on it. It is not very &amp;quot;Pretty User&amp;quot;, but it is enough to validate the good working order of the daemon. First, you must build and load the Linux Kernel Servo Driver as describe in section [[MotionSystem#Linux_Kernel_Servo_Driver|Linux Kernel Servo Driver]].&lt;br /&gt;
{{Warning|A completer !!!}}&lt;br /&gt;
&lt;br /&gt;
===User GUI Application===&lt;br /&gt;
The User GUI Application is an client example of the Servo User Space Daemon. This application is based on [http://www.qtsoftware.com/ Qt] version 4.3.x, 4.4.x, or 4.5.x&lt;br /&gt;
====How to build the User GUI Application====&lt;br /&gt;
Before building the User GUI Application, be sure that the Qt development environment is correctly installed. On a Debian system the following packages must be installed:&lt;br /&gt;
&amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;&lt;br /&gt;
:libqt4-assistant  &lt;br /&gt;
:libqt4-core       &lt;br /&gt;
:libqt4-dbus       &lt;br /&gt;
:libqt4-designer   &lt;br /&gt;
:libqt4-dev        &lt;br /&gt;
:libqt4-gui        &lt;br /&gt;
:libqt4-help       &lt;br /&gt;
:libqt4-network    &lt;br /&gt;
:libqt4-opengl     &lt;br /&gt;
:libqt4-opengl-dev &lt;br /&gt;
:libqt4-qt3support &lt;br /&gt;
:libqt4-script     &lt;br /&gt;
:libqt4-scripttools&lt;br /&gt;
:libqt4-sql        &lt;br /&gt;
:libqt4-sql-mysql  &lt;br /&gt;
:libqt4-sql-sqlite &lt;br /&gt;
:libqt4-svg        &lt;br /&gt;
:libqt4-test       &lt;br /&gt;
:libqt4-webkit     &lt;br /&gt;
:libqt4-xml        &lt;br /&gt;
:libqt4-xmlpatterns&lt;br /&gt;
:qt4-demos         &lt;br /&gt;
:qt4-designer      &lt;br /&gt;
:qt4-dev-tools     &lt;br /&gt;
:qt4-doc           &lt;br /&gt;
:qt4-doc-html      &lt;br /&gt;
:qt4-qmake         &lt;br /&gt;
:qt4-qtconfig      &lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
Prepare the Qt project for building:&lt;br /&gt;
 qmake-qt4&lt;br /&gt;
Build the User GUI Application:&lt;br /&gt;
 make&lt;br /&gt;
Now, the ELF binary file &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is available in the &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt;directory.&lt;br /&gt;
&lt;br /&gt;
====How to use the User GUI Application====&lt;br /&gt;
To launch the User GUI Application, in the build directory, type:&lt;br /&gt;
 ./ServoGui&lt;br /&gt;
You get the following screen:&lt;br /&gt;
[[Image:ServoGui-0.png|center|ServoGui Home Screen]]&lt;br /&gt;
The application is mainly composed of four tabs. The three first tabs are similar and dedicated to R/C servos management. Each of these tabs can manages eight R/C servos. The field Remote Host is the host name or IP address of the remote Armadeus board on which run the Motion Daemon and are connected R/C servos. The &amp;quot;Connect&amp;quot; button establish the TCP connection to the remote Armadeus board. The &amp;quot;Quit&amp;quot; button close the application after closing the TCP socket. The &amp;quot;Bank 1&amp;quot; tab manages R/C Servo 0 to 7, the &amp;quot;Bank 2&amp;quot; tab manages R/C Servo 8 to 15, and the &amp;quot;Bank 3&amp;quot; tab manages R/C Servo 16 to 23. The application manages only 24 R/C servos, even if the MotionSystem is 32 R/C servos capable. If you need to manage more than 24 R/C servos, duplicate and modify the tab source code.&lt;br /&gt;
&lt;br /&gt;
Each R/C servo on the tab had six controls:&lt;br /&gt;
*A position slider that puts the R/C to the desired position.&lt;br /&gt;
*A position spinbox that does the same than the slider but more finely.&lt;br /&gt;
*An offset spinbox that sets the R/C servo offset position (real position = position + offset).&lt;br /&gt;
*A minimum spinbox that sets the lower position boundary.&lt;br /&gt;
*A maximum spinbox that sets the upper position boundary.&lt;br /&gt;
*A enable checkbox that enables R/C servo. If it is unchecked, the R/C servo is freewheeling.&lt;br /&gt;
&lt;br /&gt;
The fourth tab looks like:&lt;br /&gt;
[[Image:ServoGui-1.png|center|ServoGui Advanced Controls]]&lt;br /&gt;
The &amp;quot;Send Batch File&amp;quot; button sends a file of which path is specified in text field on the right. This path is relative to the host filesystem on which &amp;lt;font face=&amp;quot;Courier&amp;quot;&amp;gt;ServoGui&amp;lt;/font&amp;gt; is running. This file contains command that are syntactically correct in the [[MotionSystem#Motion_Daemon_Language|Motion Daemon Language]]. Each line contains only one command. An example of batch file:&lt;br /&gt;
 SET_POSITION (0 ,1000 )&lt;br /&gt;
 SET_POSITION (1 ,3000 )&lt;br /&gt;
 SLEEP (1)&lt;br /&gt;
 SET_POSITION (1 ,1000 )&lt;br /&gt;
The &amp;quot;Save Config&amp;quot; button saves the actual state in a file on the remote Armadeus system. The file path is specified in text field on the right. This path is relative to remote Armadeus system on which Motion Daemon is running.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[http://yvan.roch.free.fr/armadeus/MotionSystem-00.00.00.tgz Project Files]&lt;br /&gt;
&lt;br /&gt;
[http://www.cadsoft.de Eagle]&lt;br /&gt;
&lt;br /&gt;
[http://www.lynxmotion.com http://www.lynxmotion.com]&lt;br /&gt;
&lt;br /&gt;
[http://fribotte.free.fr/bdtech/pic/pic_et_servo.html http://fribotte.free.fr]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Jitter Jitter]&lt;br /&gt;
&lt;br /&gt;
[http://www.qtsoftware.com/ Qt]&lt;/div&gt;</summary>
		<author><name>YvanR</name></author>	</entry>

	</feed>