PHOTO 2. A rolling Digilent Robotic Starter Kit variant can
be assembled using the base plate, support post, wheels,
dual motor mount bracket, and the pair of motor/
gearboxes shown here. There are also a couple of
expansion plates in this shot that you can bolt on.
robotic as quickly as possible with the least amount of
effort. I decided to keep things visually simple by not
installing the bulk of the wires and cables.
In last month’s Digilent Cerebot discussion, I
demonstrated via C source code how to turn the motor/
gearbox shafts using the Cerebot 32MX4 electronics. I also
have an updated version of the factory firmware that I will
post on the SERVO ftp site for you. The Starter Kit factory
firmware provides various 32-bit PIC32MX motor/gearbox
routines that you can use to model your own firmware
motor/gearbox drive train. In addition to core motor/
gearbox code, the Digilent motor driver firmware also
contains routines that operate against the motor/gearbox
rotational sensors. Now that we’ve accomplished the
hardware assembly task, let’s pull some more stuff out of
the box. I’ve got my eye on that joystick Pmod.
Writing A PmodJSTK Driver
I had so many Digilent goodies to play with that I failed
to take the time to completely read through the PmodJSTK
datasheet. Take a look at Photo 4. What you don’t see in
the shot is an AVR ATtiny24 microcontroller that is
monitoring the position of the X and Y axis potentiometers
and sensing the states of a trio of pushbutton switches.
The PmodJSTK’s little AVR microcontroller also supports a
pair of user-accessible LEDs.
The ATtiny24 is just that — tiny. So, my first thoughts
were that its SPI Slave node implementation was done
using a software bit bang algorithm. To my surprise, the
ATtiny24 contains what Atmel calls a Universal Serial
PHOTO 3. As a SERVO reader and robotic enthusiast, this is
very simple for you. However, keep in mind that this is a
“STARTER” kit. With that thought, the engineers at Digilent
provide a step-by-step assembly description in the Starter
Kit Reference Manual, which is available free from the
Interface which is capable of what Atmel describes as
three-wire mode. As it turns out, Atmel’s three-wire mode is
actually SPI to everyone else.
The SPI (Serial Peripheral Interface) protocol is a
Motorola invention. A Master SPI portal consists of an
input, an output, a clock output, and an optional slave
select output. Slave SPI portals are also fitted with an input
and an output. However, the Slave’s clock signal originates
at the Master node and the Slave Select is an input used by
PHOTO 4. I didn’t have to do any fancy coding to get
this PmodJSTK to talk to me. The Microchip PIC32MX
C compiler’s SPI API library routines took all of the
complexity out of SPI driver firmware. I also wrote a
PmodJSTK driver that does not use the API which is
embedded in this month’s text.
SERVO 01.2010 47