ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
■ BY FRED EADY
SLAVING AWAY FROM USB HOST
Many of today’s USB devices began life as RS-232 serial devices. Thanks to
FTDI, one of the easiest ways to convert a legacy RS-232 device to a USB device
is to replace the RS-232 circuitry with an FTDI USB-to-UART bridge IC. One
immediate drawback of converting to USB is that the open nature of the RS-232
device to microcontrollers is lost. In the majority of cases, a USB slave device
will require the services of a USB host device in the form of a personal computer.
Today, microcontrollers that were once restricted to the USB slave role can assume the responsibilities of a
USB host device. In this edition of Design Cycle, we’re
going to host a USB device that was intended to interface
to a PC USB portal with a USB-enabled microcontroller.
The Arduino-styled Vinco shown in Photo 1 is FTDI’s
latest Vinculum-II development platform. The Vinco can
be programmed with the new Vinco API libraries or with
the traditional Vinculum-II API tool set. Note that the
Vinco takes on that classic Arduino shape. That’s no
happenstance as the Vinco mechanical pinout is design to
support Arduino shields. The idea is to port the shield
hardware and application to run under the control of a
Vinculum-II. To ease the porting process, the FTDI folks
provide the Vinculum-II IDE, the Vinculum-II compiler, and
a multitude of FTDI utilities and drivers at no cost.
The Vinco’s Mini-B USB connector is normally used as
a USB slave portal, while the larger Type A connector
supports host-mode applications. The Vinco is built around
the 64-pin Vinculum-II programmable host controller. The
only supporting IC is a Microchip MCP3008 10-bit analog-to-digital converter which is accessed via a Vinculum-II SPI
portal. All of the other Vinco circuitry is dedicated to power
supply duty, I/O interfacing, and a programming/debugging
portal. There is no onboard programming circuitry. Thus,
the Vinco requires a VNC2 debugger/programmer module
like the one you see in Photo 2. Schematic 1 is a
graphical overview of the Vinco’s Vinculum-II core.
Look back at Photo 1 and locate the LEDs that are
positioned on either side of the Type A USB connector. The
pair of LEDs lies just to the right of the silkscreen labels
USB1 and USB2. Once you’ve located the LEDs in Photo 1,
note their electrical attachment in Schematic 1. According
to Schematic 1, all we have to do is drop their cathodes to
a logically low level to illuminate them, right? Well, there
are a couple of ways to do that. Here’s the Vinco API way:
pinMode(39,OUTPUT); //make pin 39 an output pin
digitalWrite(39,LOW);//write a logical LOW to
Trouble is, the Vinco API way won’t work. Pin 39 is not
defined in the Vinco GPIO (General-Purpose I/O) libraries and
neither is pin 40 which drives LED2. However, there are 30 I/O
pins and eight analog pins that are defined in the Vinco API.
No worries with the absence of pins 39 and 40
definitions in the Vinco API. We can always fall back on
the Vinculum-II API. The first order of business is to
configure the Vinculum-II’s I/O multiplexer:
// Configure IOMUX
// GPIO Port A 0 to pin 39 as Output.
IOMUX_OUT_GPIO_PORT_A_0); // LED1#
// GPIO Port A 1 to pin 40 as Output.
■ PHOTO 1. For beginners, the Vinco can be programmed
using an Arduino-like API library. In that the Vinco is based
on the Vinculum-II, the advanced programmer can also apply
the standard Vinculum-II API calls to a Vinco application.