Hi Sean,

>Hey all.

>I've been messing with the registers and so forth on the robostix to try and
>figure out how it all works.  I'm making progress, but the going is slow.  I
>wanted to know why the robostix has specifically marked out 6 pins (well I
>guess 18 if you count all the motor and grounds) specifically for for PWM.
>Are there special functions involved here that I can utilize to specify
>things like frequency and duty cycle?  I can write shell scripts that

Well that is exactly what Dave Hylands is kindly sharing with all of us, take a look here:
http://websvn.gumstix.com/filedetails.php?repname=Buildroot&path=%2Fbranches%2Fprojects%2Frobostix%2Fgumstix%2Fi2c-io%2Fservo&rev=0&sc=0
That is a script that uses i2c-io to set the timers 3 and 1 and set the servos initial position at center and then control them, its a pain free script, on the other hand it did not worked for me from the begining, and i did modified the script to work for me, all the setting values were divided by 12 (12=6*2 the 2 is a 2 in the PWM frequency calculation, and the 6 is a bad hypotesis i made about digital servos, and did worked just fine for me, again, dont ask me why, still trying to find out why loading 3333 instead of 40000 works just fine!)
If you take a moment at reading PWM generation on the Atmega128 datasheet (it takes sometime to understand, at least for me, but is very RICH, believe me ) youll see that the script is loading the mode of operation on the first two registers, then it loads the TOP value (in the script is the 40000) and then initializes the center value for the servos (3000), then asigns the pins as out (i guess that is what is doing there after the 3000s) and then it loads the new servo position.
Grafically youll undestand better from the datasheet, but 40000 sets the signal period, and the other values the 3000 or the new position sets the "clear" of the out so it generates the PWM as you want (again take a look at the graphics in the datasheet, im bad explaining)

I would recommend you do a: svn co http://svn.gumstix.com/gumstix-buildroot/branches/projects/robostix
doing that to a known directory (youll need to modify Makefiles in order to suit your buildroot ubication)
after the download youll have all the necessary files for using the i2c-io api, if you are into ADC as i am, take a look in the i2c-adc.c file, there youll find the process of opening the device (0x0b robostix) and setting it in slave mode prior of use of IO_Get_ADC, which finally do the ADC conversion in single ended mode (beware to put filters in the entrance of pins as per the datasheet to try cancel noise)
Have in mind that Vref is set to 5V, and a hack would be needed to use other refenrece for the ADC as the 2.5V named in the datasheet, thats why Dave did not touched them in their code (i mean the registers that set the Vref voltage source)

>utilize i2c-io commands to produce square waves on any of the pins I want
>(ports A-G), but it's temperamental (i.e. the frequency shifts somewhat
>sporadically).  I imagine this has to do with the fact that it has to go
>from the gumstix to the robostix through the hirose and then eventually to
>the pins as opposed to running on the ATMega128 itself.

mmhhh... the servos goes in a crazy way until the top??? and goes forwards and backwards?
in my case as i said before i loaded 3333 ( 40000/(6*2) ) instead of 40000 and 250 instead of 3000 (modify the input range dividing by 12 too so it should give you 42-125-208, but after doing some test and fault i encountered safe and matching numbers with my receiver the range in 69-95-121 which gives you 1.112ms - 1.528ms  -  1.94ms pulses width, verified by digital oscylloscope) I also encountered that the period dont need to match the 20ms, and what really matters are the witdh of the pulses.

>Ultimately, I want the gumstix to be able to control motor rotation and be
>able to read rotation rates and direction information from the robostix in a
>closed loop fashion, but I'm not there yet.

You mean like hacking the potentiometer in the servo and sampling using an ADC?...
Maybe you should take a look here: http://openservo.com/ these guys are in the dreamed servos way from cheap ones imho.
You get all what you want ready i guess, i2c control, and feedback of the position, THAT ROCKS!!

>Thanks,

>Sean


Hope this helps in some way
best regards
Rodrigo

ps: at the end i realized you read the mega128 datasheet, "messing with the registers" phrase, sorry for the boring text