USB bulk transfers between a PC and a PIC microcontroller for embedded
applications
Ruben Posada-Gomez, Jose Jorge Enriquez-Rodriguez, Giner Alor-Hernandez,
Albino Martinez-Sibaja
Instituto Tecnologico de Orizaba, Division of Research and Postgraduate Studies
Orizaba, Veracruz, Mexico
{rposada, jenriquez, galor, amartinez}@itorizaba.edu.mx
Abstract
The Universal Serial Bus (USB) has become the
most popular communication interface among personal
computers and embedded devices because of its ease of
use, low cost, data bandwidth and availability in most
computing systems. Microchip’s PIC 18Fx550
microcontroller has an embedded USB controller that
allows rapid development of USB enabled devices.
This paper presents a system for bidirectional
communication between a personal computer and an
embedded device using a PIC 18F2550
microcontroller in USB bulk transfer mode. A
comparison between three different drivers for host
application was done to determine the advantages of
each one. Finally, a case of study for a remote home
lighting control system is presented.
1. Introduction
For years, embedded application developers have
required to enable an interface for communicating their
devices with a personal computer, they have chosen
either a parallel port (originally designed as a printer
interface) or a serial port. However, as technology
evolves, the need for faster and better interfaces arises.
The Universal Serial Bus (USB) has been developed
to overcome disadvantages of previously available
communication interfaces; it is a fast, bi-directional,
isochronous, low-cost, dynamically attachable serial
interface that is consistent with the requirements of the
PC platform now and future [1].
The USB is versatile enough for a wide range of
peripheral devices [2], including input devices such as
mice [3], keyboards, disks, printers, audio and video
devices. It is also used for data acquisition devices [4,
5], control and monitoring systems [6, 7], multimedia
devices [8], and even security ones [9].
In this work, we present the development of an
embedded device that uses the USB port as the
interface to a personal computer, using a remote home
lighting system as a case study. On the hardware side,
the design is based on a Microchip PIC 18f2550 which
has an USB interface. We used USB communication in
bulk mode since this is the preferred mode for data
acquisition devices because of its fast data transmission
rate. This paper is structured as follows. In Section 2
we present the development of the hardware device,
including firmware design. We cover the development
of the low level software for the PC in Section 3. In
Section 4, we present the tests and results for the three
different interfaces under test. Using the hardware and
software previously designed, in Section 5 we present
the design of a remote home lighting control system as
a case study of the design of an USB enabled
embedded device. Section 6 summarizes some related
works and in Section 7 we present our conclusions and
point to future directions.
2. Hardware design
Firstly, we should clearly define what is being
designed before work was started, which is hardware-
capable of receiving commands from a PC through the
USB port, and then setting some digital outputs.
There are a lot of ways to transmit data from a PC
to external hardware, such as serial port, parallel port, a
general purpose input/output card and USB port. The
major disadvantage of serial port is the level of
voltages used (±12V) for communications; this
requires an IC to translate the signal levels to levels a
microprocessor can handle. Also, it has a data rate limit
of 115 kb/s, which is not enough for common data
acquisition devices required today. There have been
four standards for parallel port over the course of time,
and there are a variety of chipsets that operate the port
in different modes. General purpose input/output
Electronics, Robotics and Automotive Mechanics Conference 2008
978-0-7695-3320-9/08 $25.00 © 2008 IEEE
DOI 10.1109/CERMA.2008.21
559