Publication date: 22 April 2008
USB flash drives have become one of the most pervasive forms of low to medium density storage media in use today, far surpassing the floppy disk which is fast becoming obsolete.
Advances in flash memory technology have seen a rapid increase in capacity of these drives, with 2GB and 4GB of storage readily available. Market forces continue to drive the price of this media lower and, in so doing, promoting its adoption even further.
Although this media has been readily available for a number of years, use of USB flash drives has, to date been restricted to platforms with adequate processing power such as PCs and 32-bit embedded systems. FTDI has now opened up the use of USB flash disks to microcontrollers with the introduction of their Vinculum series of intelligent USB host controllers.
The Vinculum VNC1L IC provides USB host interface and data transfer, and supports the most popular device classes; mass storage, printer and human interface device (HID). HID class devices typically include USB keyboards, joysticks and mice. When interfacing to flash drives, Vinculum manages the file allocation table (FAT) structure by using a straightforward command set.
The device has an 8-bit core together with a 32-bit co-processor, dual DMA controllers, 64k embedded flash and 4k internal SRAM memory. Vinculum features two USB 2.0 low and full speed, host and slave ports, universal asynchronous receiver transmitter (UART), serial peripheral interface (SPI) and parallel first in first out (FIFO) interfaces.
It also has two PS2 legacy ports for keyboard and mouse, and up to 28 general-purpose input output (GPIO) pins depending on configuration. The current Vinculum handles both low and full speed USB 2.0, which provides data link at up to 12Mbytes/s and will interface to all USB2.0 peripherals, as well as older USB1.1 devices.
This is more than sufficient for USB flash drive applications and is deliberately targeted to keep the size, cost and power down to a level that is acceptable for embedded applications. Power consumption is 25mA for the 3.3V core and the 5V-safe I/O interface.
Vinculum provides USB host capability to microcontroller-based products that previously did not have the hardware resources available. A wide range of consumer and industrial products, such as intelligent domestic appliances, meter readers and vending machines, can now incorporate USB peripheral connectivity. For product designers this is now greatly simplified by the availability of FTDI’s new VDRIVE2 module.
Packaged in a neat snap-in enclosure, VDRIVE2 consists of a Vinculum IC, USB “A” socket and a few support components. Only four signal lines plus a 5V supply and ground are required. By using the Vinculum Disk Interface Firmware Specification (DIFS) the I/O interface can be selected between the serial UART and SPI using the on-board jumper pins. A bi-colour led provides power and status indication.
Adding a PIC microcontroller and a few other components, the VDRIVE2 module can be turned into a flash disk based data logger. Fig 1 shows the schematic of a simple application. The AC signal input is connected to the 10-bit analogue to digital converter on board the Microchip PIC. The PIC code takes a pre-defined number of samples and then writes the corresponding ASCII values to a comma separated value (CSV) file on the USB flash disk attached to the VDRIVE2 module.
Vinculum’s DOS like ASCII commands simplify the task of file handling. An extended ASCII command set is designed for use with a terminal during test and development, whilst a shortened hexadecimal version is used with a microcontroller. Currently, Vinculum’s command set has five categories: Directory, File, Power management, Debug and Miscellaneous. Table 1, below, illustrates some example commands.
Extended ASCII command for terminal mode
Hexadecimal command for microprocessor mode
Command function
Directory examples
DIR
$01,$0D
Lists the current directory
MKD
$07,$20,,$0D
Make directory
CD
$02,$20,,$0D
Current directory is changed to the new directory
File examples
RDF
$0B,$20,size in hex(4 bytes),$0D
Reads the data of from the current open file
OPW
$09,$20,,$0D
Opens a file for writing with the command WRF
Power management examples
SUD
$15,$0D
Suspend the disk when not is use to conserve power
WKD
$16.$0D
Wake disk
FTDI’s VMUSIC2 module takes the USB flash disk application one step further by adding a VLSI VS1003 IC to provide audio playback capability. MP3 and other popular digital music file formats can then be played back directly from an attached USB flash disk. Extensions to the Vinculum DIFS command set allow you to play a selected file, adjust the volume and monitor the status of the file being played.
The small size, low power and cost effectiveness of the Vinculum platform opens up USB connectivity to a wide range of applications that were previously impractical. Being able to use low cost USB peripherals helps reduce the overall cost of the embedded system and opens up many more features to add value to the design.
All of this can now be done within existing cost and power budgets without having to spend large amounts of design time optimising the controller, and will bring USB connectivity to a whole new range of devices.