|
Instructions to easily add a USB keyboard or mouse to
Propeller
|
This is a short tutorial on how to connect a USB
keyboard or mouse to a Propeller chip using a serial connection.
The VNC2 also offers SPI and FIFO connections, but serial is easiest.
|
|
You'll need this hardware (in addition to a Propeller
setup with PC):
|
V2DIP2-32 (Digikey part# 768-1055-ND).
|
|
|
This board has the VNC2 chip installed in a DIP
format. |
|
There are actually many other versions you can
use, but I like this one the best for simplicity. |
|
|
VNC2 Debug Module (Digikey part# 768-1052-ND).
|
|
|
This is needed to program the VNC2 chip.
It also allows debugging. |
|
|
|
The first step is to install the
VNC2 Toolchain. This is the development environment that
allows you to customize code and program the VNC2 chip. |
|
Next, we'll open the USB keyboard example project.
|
Start the "Vinculum II IDE" and click on the round
button in the top left corner and then pick "Open"->"Project" from
the menu:
|
|
Browse to where samples are located and open the
example project "USBHostHIDKbd.vproj":
|
|
Now, connect the debugger to the V2DIP2-32 module
and connect your PC to the debugger with a USB cable. Click on
the "Debug" tab to see programming options.
|
|
The "Debugger Interface" pane should show the
debugger module connected to the VNC2-32 pin device when properly
connected. |
|
Click the "Flash" button in the "Program" pane to
build and program the device. |
|
Click on the "Start" button in the "Debug" pane to
make the program start. |
|
Now that we have that running, we need to connect
the Propeller to the VNC2 so we can see it working. To start
with, you just need to run 2 wires: GND to GND and TX from
VNC2 to the Prop. Here's how I connected P6 on a Propeller
Demo board to the TX pin of the V2DIP2-32 module and also the VSS
pin to GND:
(click to enlarge) |
|
Finally, run
this propeller program "SerialMonitorVNC2" on the Propeller and
then run the Propeller Serial Terminal on your PC and set it to the
com port of the Propellers serial connection. What
SerialMonitor does is run 2 instances of fullduplexserial. One
instance reads data from the VNC2 and the other outputs that same
data to the PC. This allows you to quickly see what the VNC2
is outputting. |
|
That's it! If everything is working
correctly, you should see "Waiting for enumeration" on the Serial
Terminal while waiting for the USB keyboard to be plugged in.
Once the keyboard is connected you should see "Enumeration
complete". Then, when you hit a key on the keyboard you should
see a "report" which tells you info on the keyboard state.
|
|
Note: The keyboard's LEDs do not light by
themselves. You need to modify the VNC2 source code to do
that. |
|
Final Note: If you have trouble getting the
"reports" after seeing "Enumeration complete", try connecting the
VNC2's RX pin to Vdd with a 10k pullup resistor and also CTS
directly to GND. FTDI swears you don't need to do this, but I
found that I had to in order to get it to work every time.
|
|
|
|
|
|
|