Choosing a Device Controller
A mass-storage device can use just about any full- or high-speed device controller chip. Low-speed chips aren’t an option because they aren’t allowed to do bulk transfers. Some device controllers are designed specifically for use in mass-storage devices. These controllers provide dedicated interfaces and other support for accessing popular media types, including flash memory and hard drives.
Controllers with Support for Flash Memory
Standard Microsystems Corporation (SMSC) has the USB2228 flash media controller with support for communicating with MultiMediaCards, SD Cards, CompactFlash, and other flash-memory card types. The chip can also access raw flash-memory chips via a generic memory and I/O interface. The chip includes an 8051-compatible microcontroller and 15 general-purpose I/O pins. The USB interface supports the control endpoint and two bulk endpoints required for a mass-storage device. Internal FETs can switch power to memory cards. There is hardware support for ECC error correction and SD-Card security commands.
The microcontroller can run code from ROM or from external memory. If running code from ROM, an external EEPROM can provide product-specific and chip-specific information such as a serial number and configuration data.
Prolific Technology is another source for USB controllers with support for flash memory.
Controllers with support for ATA/ATAPI
For controlling hard drives and CD/DVDs, SMSC has the USB97C202 ATA/ATAPI controller. Like the USB2228, the chip contains an 8051
microcontroller, but with support for ATA/ATAPI instead of flash memory.
The chip includes support for accessing hard drives that use the Compact- Flash II form factor.
These device controllers also have ATA/ATAPI interfaces:
Cypress Semiconductor CY7C68300B EZUSB AT2LP high-speed USB-to-ATA/ATAPI bridge.
Philips Semiconductor ISP1583 Hi-Speed Universal Serial Bus peripheral controller.
Texas Instruments TUSB6250 USB 2.0 to ATA/TAPI Bridge Controller.
Additional sources offer USB mass-storage firmware for use with a variety of embedded-system architectures and operating systems.
Accelerated Technology has the Nucleus real-time operating system with optional USB “middleware” that supports mass storage.
Jungo Ltd. has a USB device stack that consists of a device-controller driver, USB core driver, and class drivers, including a mass-storage driver.
The device stack is compatible with a variety of embedded-system operating systems and CPU architectures.
MCCI’s USB DataPump firmware package supports mass storage, several real-time operating systems, and many device controllers.
Micro Digital’s smxUSBD USB device stack supports device controllers from Philips and has a class emulator for mass storage.
An embedded Linux system with a USB device controller can use the file-backed USB storage gadget (FSG) driver.
When attached to a USB host, the system enumerates as a mass-storage device.
The FSG driver is in Linux/drivers/usb/gadget/file_storage.c.
Microchip Technology’s PICmicro® microcontrollers are popular because of their low cost, wide availability, speed, capabilities, and low power consumption. The PIC18F4550 is a PICmicro microcontroller with an embedded USB device controller that can communicate at low and full speeds.
The chip doesn’t have specific support for mass storage but is suitable for mass-storage applications that need to store and transfer moderate quantities
of data at moderate speeds. The example firmware in this book is written for the PIC18F4550 and Microchip’s C18 C compiler.
The PIC18F4550 is a member of Microchip’s high-performance, low-cost PIC18 series. Program memory is flash memory. The chip also has 256 bytes of EEPROM. A bootloader routine can upgrade firmware via the USB port.
The chip has 34 I/O pins that include a 10-bit analog-to-digital converter, a USART, a synchronous serial port that can be configured to use the I2C bus or SPI, enhanced PWM capabilities, and two analog comparators.
The USB module and CPU can use separate clock sources, enabling the CPU to use a slower, power-saving clock even when using the USB port.
Microchip provides USB Firmware Framework code for the Microchip compiler and example applications for USB communications. The Framework code is structured to make it as easy as possible to develop firmware for devices in different classes and vendor-specific devices. This book includes excerpts from Microchip’s mass-storage firmware, which uses the Framework.