LPCOpen Virtual COM / CDC Example
Using the USB Drivers that are Built Into the LPC ROM
LPCOpen includes an interface to the USB drivers that are built into the
LPC1800 hardware itself. This excellent hardware feature allows you
to make use of pre-tested and pre-integrated USB drivers without even needing
to allocate any valuable Flash memory space to their implementation.
The instructions on this page describe how to import and use LPCOpen's
usbd_rom_cdc_vcom project to show how easy it is to create a USB virtual COM / CDC
port on an LPC1800 microcontroller. It is assumed that all preceding steps
have already been completed, so the
necessary tools have already been installed,
and the chip support and board support library projects have already been imported.
video on the introductory page shows the Virtual COM / CDC driver being used
to provide input and output to the
command line interface (commercial licenses for FreeRTOS+CLI are
provided for free to users of LPC17xx and LPC18xx microcontrollers).
The LPC1800 chip support and LPC1800 Xplorder board support
projects should have
already been imported into the LPCXpresso
workspace. Open the LPCOpen zip file in the LPCXpresso Eclipse
import window again, and this time select and import the
Importing the virtual COM / CDC port project that uses the
hardware USB drivers
The workspace should now include three projects. Right click
on the usbd_rom_cdc_vcom project, then select 'Build Project'
from the pop up menu. The LPC1800 chip and board support packages
are dependencies of the usbd_rom_cdc_vcom project, so all three
projects will get built.
Building the usbd_rom_cdc_vcom project
Ensure that ...
usbd_rom_cdc_vcom is highlighted in the Eclipse project
The LPC18xx Xplorer microcontroller evaluation
board is connected to your host computer though an
appropriate debug adaptor (for example an
The LPC18xx Xplorer microcontroller evaluation board
is powered using the USB connector that is at the
opposite end of the board to the Ethernet
... then click the 'Debug usbd_rom_cdc_vcom' button visible
in the 'Start Here' window (see the image below). The
microcontroller's flash memory will be programmed and the
debugger will break at the start of the main() function.
The 'Debug usbd_rom_cdc_vcom' button in the Start Here window
Select 'Resume' from LPCXpresso's 'Run' menu to run the
application. The host computer will detect the connection of a
new USB device and attempt to install a virtual COM port USB
driver. A link to an
appropriate driver is provided on the same LPCOpen web page from
which the LPCOpen .zip file was downloaded - search for "USB Drivers"
on the appropriate download page
to locate the link.
A quick inspection of the source code shows that the example sends
"Hello World!!" to the USB port when it first connects, then
simply echos back any characters that are received. To test this,
open a dumb terminal program such as Hyperterminal or Tera Term,
selecting to connect to which ever COM port has enumerated as
"LPC USB VCom Port (COMx)", then start to type text into the
Selecting the virtual COM port in Tera Term
Typing text into a Tera Term window that is connected
to the virtual COM/CDC port