THE DESIGN CYCLE
■ BY FRED EADY
ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
TAMING THE DUALSHOCK 3 BEAST
The PlayStation
DualShock 3 was initially
designed as a user
interface for the
PlayStation gaming
system. Fortunately for us,
Sony decided to design
the DualShock 3 around
the USB HID specification.
HID devices do not
normally require any
specialized operating
system-dependent drivers.
Using the HID
specification potentially
allows the DualShock 3 to
connect to most any USB
host device. This works to
our advantage. The
Microchip USB stack
supports standard HID
protocols hosted by
PIC32MX microcontrollers.
All we have to do is
determine what the
DualShock 3 wants to
hear, and get the
messages through via a
HID-based USB link.
SNAKES AND
PENGUINS
Despite the snake problem we
are now enduring in the Florida
Everglades, uttering the word Python
is not all bad. The “bad” pythons are
quickly gobbling up our four-legged
critters (alligators included). The
“good” pythons aren’t really snakes
at all. These “Pythons” that don’t coil
and swallow deer whole represent a
programming language.
Unlike leopard seals, sharks, and
killer whales, Python (the
programming language) does not
prey on penguins. The penguin
described here doesn’t slide on ice
and eat cold fish. The penguin
represents the operating system we
call Linux.
In that our “animals” are really
units of logic, we could logically state
that, in this case, the snake talks to
the penguin. We could also look at it
from the reverse perspective and
state that the penguin eats the snake.
(Let’s not go there.) To give us some
clues as to how to code our
PIC32MX USB host, we must listen to
the snake too. For instance, this
hissing will come in handy later:
const unsigned char
enable_SIXAXIS[] =
{0x03,0xF4,0x42,0x0C,0x00,0x00}
;
As we work our way through the
PIC32MX PlayStation DualShock 3
client driver code, we will depend
heavily on the snakes in the grass.
We’ll also use all of the hardware
technology and applications available
to us to fill in the bits and bytes of
information that the snakes and
penguins won’t share with us. The
Ellisys USB Explorer 200 and
MotioninJoy Gamepad Tool will be
very busy.
■ SCREENSHOT 1. It is very important to know the device address that gets
assigned to the PlayStation DualShock 3. The Microchip USB stack takes
care of the device addressing task automagically.
54
June 2013