Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and t he lik e is provided only for your convenience
and may be su perseded by upda t es . It is y our responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life supp ort and/or safety ap plications is entir ely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless M icrochip from any and all dama ges, claims,
suits, or expenses re sulting from such use. No licens es are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K
EELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, rfPIC, SmartShunt and UNI/O are registered
trademarks of Microchip Tec hnology Incorporated in the
U.S.A. and other countries.
FilterLab, Linear Active Thermistor, MXDEV, MXLAB,
SEEVAL, SmartSensor and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, In-Circuit Serial
Programmin g , IC SP, ICE P I C , M in d i , MiWi, MPASM, MPLAB
Certified logo, MPLIB, MPLINK, mTouch, nanoWatt XLP,
PICkit, PICDEM, PICDEM.net, PICtail , PIC
32
logo, PowerCal,
PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select
Mode, Total Endurance, TSHARC, WiperLock and ZENA are
trademarks of Microchip Tec hnology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
All documentation becomes dated and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the p age number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu and then Topics to open a list of available online help files.
®
IDE online help.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
PIC18F46J50 Full-Speed USB Demonstration Board. Items in this chapter include:
• D ocum ent Lay out
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Doc um ent Rev isio n History
DOCUMENT LAYOUT
This document describes how to use the PIC18F46J50 Full-Speed USB Demonstration
Board as a development tool to emulate and debug firmware on a target board. The
manual layout is as follows:
• Chapter 1. “Introduction” – The board package’s contents and the USB
capabilities of the PIC18F46J50 family of devices
• Ch apt er 2. “Board Hardware” – The board’s hardware elements and additional
capabilities available by connecting the board to a PIC18 Explorer Board or
PICDEM™ HPC Explorer Board
• Chapter 3. “Preprogrammed Firmware” – The board’s preloaded demonstrations, and other demonstrations and projects available in the MCHPFSUSB
Framework
• Appendix A. “Troubleshooting Tips” – Solutions for common issues
• Appendix B. “Board Schematics” – Schematic diagrams
PIC18F46J50 Full-Speed USB Demonstration Board User’s Guide
PIC18F46J50 Full-Speed USB Demonstration Board User’s Guide
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly.
Sending in the Warranty Registration Card entitles users to receive new product
updates.
Interim software releases are available at the Microchip web site.
RECOMMENDED READING
This user’s guide describes how to use the PIC18F46J50 Full-Speed USB Demonstration Board. The following Microchip documents are recommended as supplemental
references:
• “PIC18F46J50 Family Data Sheet” (DS39931)
• MCHPFSUSB Framework’s release notes and other documentation
Microchip provides a variety of USB related application notes, firmware, drivers, PC
application source code and other resources to assist application developers. Many of
the USB related firmware files, and PC application source code projects and documentation are in the earlier referenced MCHPFSUSB Framework on the CD-ROM disc that
comes with the board. The latest version of this package and the other resources can
be downloaded at the Microchip USB design center:
http://www.microchip.com/usb/
Schematics and other support materials for the PIC18 Explorer Demonstration Board
can be obtained at:
http://www.microchip.com/pic18explorer
Schematics and other support materials for the HPC Explorer Demonstration Board
can be obtained at:
http://www.microchip.com/HPCExplorer
The official USB 2.0 specifications also could be helpful. These materials can be
obtained from the USB Implementer’s Forum:
http://www.usb.org
Chapters 5, 8 and 9 of the USB 2.0 specifications are particularly important for application developers making USB peripheral devices. These chapters discuss important
USB protocol fundamentals and the necessary device requests that must be supported
to enable successful USB enume ra tio n.
If considering use of the PIC18F46J50 Full-Speed USB Demonstration Board with one
of the boards discussed in Chapter 2. “Board Hardware”, the following Microchip
documents are recommended:
• PICDEM™ PIC18 Explorer Demonstration Board User’s Guide (DS51721)
Microchip provides online support via the web site at www.microchip.com. The site
makes files and information easily available to customers, including the following:
• Product Support – Data sheets and errata, application notes, sample programs,
design resources, user’s guides, hardware support documents, and the latest
software releases and archiv ed softwar e
• General Technical Support – Frequently Asked Questions (FAQs), links for technical support requests and online discussion groups, and a listing of the Microchip
consultant program’s members
• Business of Microchip – Product selector and ordering guides, the latest
Microchip press releases, and listings of seminars, events, and Microchip sales
offices, distributors and factory representatives
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip
products. Subscribers receive email notification whenever there are changes, updates,
revisions or errata related to a specified product family or development tool.
To register, access the Microchip web site at www.microchip.com
Change Notification and follow the registration instructions.
The Development Systems product group categories are:
• Compilers – The latest information on Microchip C compilers and other language
tools.
The tools include the MPLAB
MPLAB ASM30 assemblers, MPLINK™ and MPLAB LINK30 object linkers, and
MPLIB™ and MPLAB LIB30 object libraries.
• Emulators – The latest information on Microchip in-circuit emulators.
Among the emulators are the REAL ICE™ 2000 and REAL ICE 4000.
• In-Circuit Debuggers – The latest information on the Microchip in-circuit
debuggers: PICkit™ 2, MPLAB ICD 2, MPLAB ICD 3 and REAL ICE.
• MPLAB
Integrated Development Environment for development systems tools.
This list is focused on the MPLAB IDE, MPLAB SIM simulator, MPLAB IDE project
manager, and general editing and debugging features.
• Programmers – The latest information on Microchip programmers.
The programmers include the MPLAB PM3 and PRO MATE II device
programmers and the PICSTART
programmers.
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
The PIC18F46J50 Full-Speed USB Demonstration Board is designed as an
easy-to-use evaluation platform for Microchip’s full-speed, USB PIC18F46J50 family of
microcontrollers.
The board can be operated as a stand-alone device. Alternately, for additional
demonstration functionality, the board can be used in conjunction with the PIC18
Explorer Board (www.
(www.
microchipDIRECT.com).
All members of the PIC18F46J50 family of microcontrollers fully support USB 2.0
full-speed and low-speed serial communications at signaling speeds of 12 Mbps or
1.5 Mbps.
The demonstration board package provides all of the hardware and software needed
to develop USB compliant communication solutions.
This chapter discusses:
• Demonstration Board Package Contents
• PIC18F46J50 Family USB Capabilities
PIC18F46J50 FULL-SPEED USB
DEMONSTRATION BOARD
USER’S GUIDE
Chapter 1. Introduction
microchipDIRECT.com) or PICDE M™ HPC Explorer Board
1.2DEMONSTRATION BOARD PACKAGE CONTENTS
The demonstration board package contains:
• The PIC18F46J50 Full-Speed USB Demonstration Board, preprogrammed with
composite USB Human Interface Device (HID ) and Mass Storage Device (MSD)
class demonstration firmware
• A standard USB A to mini-B cable for power and communication
• A six-pin, in-line ICSP™ to RJ-11 programming adapter board
• The PICDEM™ Starter Kit CD-ROM, containing USB firmware projects, PC application source code, USB drivers and USB specific documentation, such as this
user’s guide
1.3PIC18F46J50 FAMILY USB CAPABILITIES
The PIC18F46J50 microcontroller is the “superset” device of the PIC18F46J50 family.
The PIC18F46J50 has the largest memory and highest pin count in the family, but
otherwise shares a nearly identical feature set with the other family devices. The only
exclusionary exceptions are features that require pins not present on the family’s
28-pin devices.
The PIC18F46J50 Full-Speed USB Demonstration Board can be used as a
stand-alone device or — for additional functionality — plugged into either the PIC18
Explorer Board (www.
(www.
microchipDIRECT.com).
When used alone, the board contains all of the hardware necessary to make a USB
compliant, full-speed peripheral device. The board also has additional hardware
elements for providing basic demonstration and development capability.
The additional elements include the following, with the element’s number indicating its
location on the board in Figure 2-1:
1. Two miniature SMT red LEDs – Connected to the RE0 and RE1 I/O pins
2. 5V to 3.3V LDO low quiescent current regulator (TC1108-3.3VDB) – Enables
device to obtain power from USB port
3. 12 MHz SMT crystal – Can be used with the internal PLL to run the
microcontroller and USB module at frequencies of up to 48 MHz
4. MCP9701A analog output temperature sensor – Component U1, connected to
RE2 I/O pin
5. General purpose push button S2 – Connected to the RB2 I/O pin with a pull-up
resistor
6. MCLR
7. Six-pin, right-angle In-Circuit Serial Programming™ (ICSP™)
8. Jumpers for current measurement (JP3) and configuration (JP2)
9. A mini-B USB connector for power and communication
push button – For easy Reset of the microcontroller
FIGURE 2-1:PIC18F46J50 FULL-SPEED USB DEMONSTRATION BOARD
Full schematics of the PIC18F46J50 Full-Speed USB Demonstration Board are in
Appendix B. “Board Schematics”.
2.1POWER MANAGEMENT
The USB interface provides +5V (nominal) power at up to 500 mA for use by USB
peripheral devices. In order to take advantage of this bus provided power, a 3.3V, low
dropout, low quiescent current linear regulator (TC1108-3.3VDB) has been included on
the board. This enables the board to operate fully from USB bus power.
All USB compliant, bus-powered devices should implement a low-power, USB
Suspend mode. This is because the USB host may , at its own discretion, halt all USB
traffic – including Start-of-Frame packets – to a USB peripheral device for more than
3 ms. When a peripheral device detects this condition, it should drop to a low-power
suspend state, so it draws no more than 2.5 mA from the +5V V
Two USB interrupts: IDLEIF (UIR<4>) and ACTVIF (UIR<2>) are useful in detecting
when the low-power suspend condition should begin and when it actually ends.
PIC18F46J50 Full-Speed USB Demonstration Board User’s Guide
In order to meet this USB suspend current requirement, a USB peripheral should be
designed so that it does not place large quiescent loads directly on the +5V V
supply line from the USB port. If large loads will be supplied from the USB port, it is
suggested that they be connected in a way that they can be turned off when the USB
port is placed in the low-power suspend state.
The PIC18F46J50 Full-Speed USB Demonstration Board has been designed with
these and other power management considerations in mind.
2.2LEDs
Two high-efficiency, red LEDs have been included on the PIC18F46J50 Full-Speed
USB Demonstration Board. The LEDs are connected to I/O pins, RE0 and RE1, and
can be used for general purpose indication. The LEDs are connected so that they
illuminate when the I/O pin controlling them is driven high.
2.3PUSH BUTTONS
The board has two miniature push buttons. Push button, S4, connects to Master Clear
Reset (MCLR
Push button, S2, provides a simple user interface for interacting with demonstration
firmware projects. Default factory firmware is installed on the board and other USB
firmware projects are available in the MCHPFSUSB Framework. (See
Section 3.1 “Overview”.)
The push button is connected to pin RB2 on the PIC18F46J50 microcontroller which is
pulled up to V
ground.
) which resets the microcontroller.
DD through a 15-kΩ resistor. Pressing the button pulls the RB2 line to
BUS
2.4JUMPERS
2.4.1JP2 Jumper
JP2 is a three-pin header with the labels, “I”, “R” and “U”.
• “I” – Abbreviation referring to the ICE female header pin for the RC2 signal
• “R” – Abbreviation referring to microcontroller pin, RC2
• “U” – Abbreviation for the USB_ATTACH signal (see the schematics in
Appendix B. “Board Schematics”.)
When the jumper is in the “R” to “I” position, the RC2 pin connects only to the ICE
female header pin, just like most of the other general purpose I/O pins. When the
jumper is in the “R” to “U” position, RC2 can be used to sense when the USB cable has
been attached to the host and when the host is actively providing power to the +5V
V
BUS line.
According to the USB 2.0 specifications, no device should ever pull the D+ or D- lines
high (such as with the D+ or D- pull-up resistor) until the host actively powers the +5V
V
BUS line. This is intended to prevent self-powered peripherals from ever sourcing
even small amounts of power to the host when the host is not powered. Small amounts
of current could potentially prevent the host (and possibly other USB peripherals
connected to that host) from fully becoming depowered, which could cause problems
during power-up and initialization.
Self-powered peripherals should periodically monitor the +5V V
when it is driven high. Only when it is powered should user firmware enable the USB
module and turn on the D+ (for full speed) or D- (for low speed) pull-up resistor,
signaling the device attach to the host.
The JP2 jumper allows the microcontroller firmware to monitor the USB_ATTACH signal
when the jumper cap is in the position, R - U.
The resistors, R15 and R17 of the schematics (see Appendix B. “Board Schematics”),
serve multiple purposes. They level shift the +5V signal, provide a weak pull-down function
on the V
off/low state) and improve the ESD robustness of the circuit.
Peripherals that are purely bus-powered obtain all of their power directly from the +5V
V
is powered as the peripheral will not be able to source current on the D+, D- or V
lines when the host is not powered.
2.4.2JP3 Jumper
If the PIC18F46J50 Full-Speed USB Demonstration Board is used as a stand-alone
device, it obtains its power from the USB cable. This requires jumper cap, JP3, to be
installed, since the jumper is in series with the power supply from the +5V V
from the USB connector.
If the jumper cap is removed from JP3, a current meter can be connected across the
header to measure the current consumption from the USB cable. This enables
measurement of the total USB +5V V
developing USB devices to meet USB compliance specifications.
The current consumption measured at the JP3 header will include the quiescent current of the linear regulator, Q1, temperature sensor, U1, and the microcontroller, as well
as any leakage due to other circuitry on the board.
BUS line (to oppose any leakage that would interfere with measuring VBUS in the
BUS line itself. For these types of devices, it is unnecessary to monitor when the VBUS
BUS
BUS pin
BUS current consumption, which is useful in
2.5PROGRAMMING THE MICROCONTROLLER
The PIC18F46J50 Full-Speed USB Demonstration Board is too small to have the
full-sized RJ-11 jack normally used to connect to Microchip In-Circuit Serial Programming™ (ICSP™) programmers. Instead, the board has a six-pin ICSP header (J4) that
can be used as the connection for reprogramming the microcontroller.
The PICkit™ 2 ICSP programmer can be connected directly to the J4 header.
Alternately, the six-pin, ICSP to RJ-11 adapter board, included with the board, can be
used to reprogram the microcontroller with other RJ-11 based programmers. Examples
of ICSP programmers that are supported (at the time this document’s publication)
include the MPLAB
REAL ICE™.
When connecting to the six-pin header, ensure that the polarity and alignment are
correct. For reference, the board’s silk screen denotes pin 1 of the header (MCLR
an arrow and has a square surrounding the pin.
The RJ-11 to ICSP adapter board also provides a reference on its silk screen with a
square around the MCLR
demonstration board, the two square markings are aligned with each other.
If the PIC18F46J50 Full-Speed USB Demonstration Board is being used with the
PIC18 Explorer Board or PICDEM HPC Explorer Board, the board’s RJ-11 jack can
also be used to reprogram or debug the PIC18F46J50.
®
In-Circuit Debugger, ICD 2 and ICD 3, and the In-Circuit Emulator,
pin. When the adapter board connects correctly to the
PIC18F46J50 Full-Speed USB Demonstration Board User’s Guide
2.6OPERATION WITH THE PIC18 EXPLORER OR
PICDEM™ HPC EXPLORER BOARDS
The basic hardware capabilities of the PIC18F46J50 Full-Speed USB Demonstration
Board can be supplemented by plugging it into the PIC18 Explorer Board or PICDEM
HPC Explorer Board. These boards have additional hardware features, such as:
• A UART level translator
• An RS-232 connector
• Eight general purpose indicator LEDs
• A potentiometer – Facilitates some of the USB demonstrations that read the
voltage output by the potentiator
• A full-size RJ-11-style programming/debugging jack
• A PICtail™ daughter board connector – Enables easy probing of I/O pins or
connection to other expansion boards (such as the SD/MMC PICtail™ daughter
board, www.microchipDIRECT.com
Before connecting the PIC18F46J50 Full-Speed USB Demonstration Board to the
PICDEM HPC Explorer Board or the PIC18 Explorer Board, ensure that the board’s
PIC/ICE slider switch is in the “ICE” position. If the explorer board’s switch is in the
wrong position, pin P5 on the PIC18F46J50 Full-Speed USB Demonstration Board is
designed to physically interfere with the switch.
When the explorer board’s slider switch is in the ICE position, the MCLR
board’s PIC18F8722 microcontroller is held in Reset. This prevents I/O pin contention,
even though the PIC18F8722 and PIC18F46J50 microcontrollers electrically share I/O
pins when the two boards are connected.
Microchip provides a wide variety of USB related example firmware projects, PC
application projects, drivers, and other related resources for developing complete USB
peripheral and host devices. These resources are included in the MCHPFSUSB
Framework distribution package.
The free package is on the CD-ROM disc that comes with the board. It can also be
downloaded from the Microchip USB Design Center:
Many of the USB device demonstrations and projects in the MCHPFSUSB Framework
are specifically intended for the PIC18F46J50 Full-Speed USB Demonstration Board,
so they require no hardware or other modifications.
Some example USB firmware is preprogrammed on the PIC18F46J50 Full-Speed USB
Demonstration Board. The microcontroller contains both demo firmware and a USB
bootloader that is independent of the demo firmware. The bootloader can be used to
program a new application’s firmware *.hex files into the microcontroller’s Flash
memory, eliminating the need for a dedicated In-Circuit Serial Programming™
(ICSP™) programmer.
To enter the Bootloader mode, hold down the S2 push button and momentarily press
and release the MCLR
pin state once after coming out of Reset. (For more information on the USB bootloader,
see Section 3.3 “Using the HID Bootloader Firmware”.)
The microcontroller firmware will enter the demo mode if the RB2 push button is not
pressed during power-up or Reset. If the microcontroller is not in the Bootloader mode,
it is in Demo mode. (For more information on the composite HID+MSD demo firmware,
see Section 3.2 “Using the Composite HID+MSD Class Demo Firmware”.)
When a Demo mode device is plugged into a host PC, the device should automatically
enumerate as a USB “composite” HID (Human Interface Device) and MSD (mass
storage device). Common operating systems (including Windows
Linux) ship with built-in HID and MSD class USB drivers. Additional drivers should not
be needed to use the default demo firmware program med on the PIC18F46 J5 0
microcontroller.
With successful enumer ati on in Demo mode, unde r the Windo ws o perat ing sys tem ,
additional entries should appear in the Windows Device Manager dialog box.
Figure 3-1 shows how the dialog box appears in the Windows XP
with arrows indicating the new entries listed for the board. (The dialog box’s
appearance may vary in other versions of the Windows operating systems, such as
Windows Vista
PIC18F46J50 FULL-SPEED USB
http://www.microchip.com/usb
push button. The microcontroller firmware checks the RB2 I/O
PIC18F46J50 Full-Speed USB Demonstration Board User’s Guide
3.2USING THE COMPOSITE HID+MSD CLASS DEMO FIRMWARE
3.2.1MSD Interface
The MSD (Mass Storage Device) interface displays the PIC18F46J50 Full-Speed USB
Demonstration Board in My Computer as a new drive volume, similar to a USB “thumb
drive” Flash memory device. Upon successful enumeration in Demo mode, the new
drive volume will display
microcontroller‘s Flash memory.
For additional information, read the text file.
If the device enumerates correctly in Demo mode and appears normal in the Device
Manager, but fails to appear as a new drive volume, see Appendix A. “Troubles hooting
Tips”.
3.2.2HID Interface
The HID (Human Interface Device) interface enables generic USB data transfer to and
from an attached device. Although the HID class normally is used for interface
products, such as keyboards and mice, the HID interface alternatively can be used for
other data transfer purposes.
The HID interface on the PIC18F46J50 Full-Speed USB Demonstration Board’s default
firmware is meant to be used with the PC application project, HID PnP Demo Composite HID+MSD Demo only (PID=0x0054).exe, provided in the
MCHPFSUSB Framework. The MCHPFSUSB Framework can be installed from the
CD-ROM disc that comes with the board. The latest version of the package is also
available from the Microchip USB Design Center:
www.microchip.com/usb
Readme.txt, a writable text file stored in the
If the MCHPFSUSB Framework Version 2.4 is installed in the default directory
(C:\Microchip Solutions), the HID PnP Demo Composite HID+MSD Demo
only (PID=0x0054).exe executable file is in the directory:
The demo PC application is intended to be run under Windows and was written in
Microsoft
review the PC’s Control Panel – Add or Remove Programs list to ensure that the .NET
Framework Version 2.0 (or later) redistributable package has been installed.
The .NET redistributable package is on the CD-ROM disc that comes with the
board or it can be downloaded from Microsoft. (For additional details, see issue 3 in
Appendix A. “Troubleshooting Tips”.)
If the USB device has been plugged in and has successfully enumerated, the device
should be detected automatically by the demo PC application. Figure 3-2 gives an
example of how the PC application appears in Windows XP.
®
Visual C++® 2005 Express Edition. If the executable fails to launch correctly,
The demo PC application provides a simple graphical user interface for sending and
receiving small amounts of example data to and from the HID interface on the USB
device. Full source code for both this PC application and the demo firmware are
included in the MCHPFSUSB Framework. Assuming the MCHPFSUSB Framework
has been installed in the default location, the source code for both the firmware and PC
application are found in the following directory:
The demo PC application can be used to toggle the LEDs on the demo board,
determine the RB2 push button state and measure the analog voltage on the microcontroller’s RA0 I/O pin. The analog voltage on RA0 is measured by the ADC of the
microcontroller and graphically displayed by the “ANx/POT Voltage” bar, as shown in
Figure 3-2.
If the PIC18F46J50 Full-Speed USB Demonstration Board is used as a stand-alone
device, it is recommended that an adjustable external power supply (between 0V and
3.3V) be attached to the RA0 pin to provide a more interesting demo experience. If the
board is used in conjunction with the PIC18 Explorer Board or the PICDEM HPC
Explorer Board, the analog potentiometer on those boards, tied to RA0, can be
adjusted to alter the HID demo’s voltage display bar.
3.3USING THE HID BOOTLOADER FIRMWARE
The PIC18F46J50 Full-Speed USB Demonstration Board is preprogrammed with HID
class USB bootloader firmware as well as the USB composite HID+MSD demo firmware.
The HID bootlo ad er is i ndep en de nt of th e co mp osi te HI D+ MS D de mo firmware.
The bootloader firmware can be used to update the Flash memory contents of the
PIC18F46J50 microcontroller, similar to using a dedicated ICSP based programmer.
When the bootloader is used, a new
sending it directly over the USB cable to the PIC18F46J50.
The HID bootloader firmware uses self-programming operations to update the Flash
memory contents of the microcontroller.
To use the HID bootloader:
1. Launch the HID bootloader application by selecting:
Start>Programs>Microchip>MCHPFSUSB v2.4>USB HID Bootloader
The dialog box, shown in Figure 3-3, appears. (This dialog box appears whenever the USB device is not yet attached or the firmware is not in Bootloader
mode.)
PIC18F46J50 Full-Speed USB Demonstration Board User’s Guide
FIGURE 3-3:USB HID BOOTLOADER APPLICATION – NO DEVICE
2. Plug the PIC18F46J50 Full-Speed USB Demonstration Board into a free USB port.
3. Place the board in the Bootloader mode by pressing and holding down the S2
push button (RB2 I/O pin). While still holding down the S2 push button, momentarily press and release the MCLR
the S2 button depressed until after the device has come out of Reset.
The bootloader firmware performs a quick check of the RB2 I/O pin after coming
out of Reset to determine if the device should enter Bootloader or normal Demo
mode.
As a result:
• The device re-enumerates as a generic HID class device (instead of a composite
HID+MSD device)
• The “USB HID Bootloader” PC application automatically detects the PIC18F46J50
Full-Speed USB Demonstration Board
• The dialog box, shown in Figure 3-4, appears
push button (S4) to reset the device, keeping
FIGURE 3-4:USB HID BOOTLOADER APPLICATION – DEVICE FOUND
Once the PC application has found the USB device, the application can be used to
open the Intel
®
HEX 32-bit formatted *.hex firmware images and program them using
MPLAB IDE can be used to create these firmware image files by:
1. Building a firmware project and using a modified linker script necessary for the
bootloader.
2. Selecting File>Ex por t
By default, the precompiled demo .hex files included in the MCHPFSUSB Framework
distribution can be programmed using the USB bootloader application. The demo’s
firmware projects were created using the appropriately modified linker script, so the
demos should work directly with the bootloader.
Programming a new firmware image using the bootloader does not erase or overwrite
the bootloader firmware inside the microcontroller. To execute newly programmed firmware with the bootloader application, reset the microcontroller by pressing the MCLR
push button.
For more details on using the HID USB bootloader, see the getting started guide for the
bootloader in the MCHPFSUSB Framework documentation directory. If the default
installation was used, that document is in the following directory:
C:\Microchip Solutions\Microchip\Usb\Documentation\Getting Started
The USB device enumerates correctly in Demo mode (and appears normal in the
Device Manager), but a new drive volume does not appear for the MSD interface.
Resolution:
See if the target system has a drive letter conflict.
Common oper ating systems typically assign USB mass storage volumes (such as
Flash memory devices and detachable CD-ROM or floppy drives) to the next available
drive letter (often “E:”). If, however, the automatically assigned drive letter has already
been assigned to some other device (such as a mapped network drive), a conflict can
occur with some Windows operating systems.
See Microsoft Knowledge Base article 297694 at the following link:
http://support.microsoft.com/kb/297694
To resolve this issue, do one of the following:
• Obtain the hotfix available from Microsoft
• Manually reassign the conflicting drive volume (such as a mapped network drive)
with a drive letter that is later in the alphabet (such as Z:)
Problem 2:
The USB device does not enumerate or appear in the Device Manager.
Resolution:
Verify the following:
• The microcontroller is powered
• Jumper cap, JP3, is installed so that the demonstration board is obtaining power
from the USB cable
• The microcontroller was programmed with the correct firmware
The factory default firmware can be restored onto the microcontroller any time by using
the ICSP programming header and programming the microcontroller with the file,
PIC18F46J50 FS USB Demo Board Factory Hex 23 Jan 2009.hex. T o do this:
1. Launch the MPLAB IDE application and select the ICSP programmer and the
correct device (PIC18F46J 50).
2. Select File>Im por t
3. Select the file, PIC18F46J50 FS USB Demo Board Factory Hex 23 Jan
2009.hex.
4. Attach the programmer and select Programmer>Program
When a PC application, such as the HID bootloader and HID PnP Demo Composite
HID+MSD Demo only (PID=0x0054).exe are launched, an error message
appears and the application does not open correctly.
Resolution:
The HID bootloader and HID PnP demo applications were developed in the Microsoft
Visual C++ 2005 Express Edition development environment and will not run without the
PC having the .NET Framework 2.0 (or higher) redistributable package installed. If the
.NET package has not been installed, do so.
The .NET Framework redistributable package is available in the MCHPFSUSB
Framework on the CD-ROM disc that comes with the PIC18F46J50 Full-Speed USB
Demonstration Board. Alternately, the .NET package can be downloaded from the
Microsoft web site:
Go to the Microsoft Download Center
and use the key words, “.NET Framework”.
The Windows Vista and Windows 7 operating systems already have support built-in
for .NET Framework 2.0 or later, so installation of the .NET package is unnecessary.
Earlier Windows operating systems, however, will require the package installation.
Figure B-1 through Figure B-3 show the schematics for the PIC18F46J50 Full-Speed
USB Demonstration Board.
When designing the PIC18F46J50 Full-Speed USB Demonstration Board, special care
was taken to make the board USB 2.0, full-speed compliant. It is suggested that those
designing new USB applications review section 7.2 of the official USB 2.0 specifications. That section includes important information related to power management (such
as board inrush current) specifications necessary to pass USB compliance tests.
Note 1:In order to be USB compliant, a USB device that is not purely bus-powered (such as containing a battery or having a
wall cube) should monitor the +5 V
BUS pin from the USB connector. If the host is not powered or the cable is not
attached, the USB device should not enable the USB module or the D+ (for full speed) or D- (for low speed) bus
pull-up resistor (~1.5 kΩ). The USB_ATTACH signal can be connected to the microcontroller pin, RC2, through the JP2
jumper header. This signal can be used to monitor V
BUS.
2:When laying out a new PCB, providing for ESD protection components (such as U4 and C11) is recommended,
although they may not be necessary in all applications. The microcontroller has some built-in ESD protection, but it
may not be sufficient for all applications depending on board layout and other system level considerations. Having
provisions (solder pads) on the PCB for these extra components adds flexibility for later in the development process.
ESD protection components will likely provide the best performance if they are located as close to the high-voltage
entry point as possible (for example, next to the USB connector). When considering ESD components, it is recommended that selected components add little to no extra resistance in series with the D+ and D- pins, and no more than
a few tens of pF of parasitic capacitance.
3:Certain pins (RA1, RA5, RB1, RD7 and RB5) perform “double duty”, being connected to more than one pin on the
female headers (ICE module). This is done so that the PIC18F46J50 family device can interface with more of the
pre-existing PICtail™ Daughter Boards and other hardware features on the PIC18 Explorer Board and the
PICDEM™ HPC Explorer board.
FIGURE B-1:PIC18F46J50 FULL-SPEED USB DEMONSTRATION BOARD – PINS
Note 1:Components, R3 and J1, are used to “program” the adjustable linear regulator output voltage to 3.3V when the
PIC18F46J50 Full-Speed USB Demonstration Board is plugged into either the PIC18 Explorer Board or the
PICDEM™ HPC Explorer Board.
2:The ICE module consists of the female header pins on the bottom of the board. Most pins on the microcontroller are
directly routed to their respective signal names on the ICE module. Exceptions to this are the signals coming from the
following microcontroller pins: RA1, RA5, RA6, RA7, RB1, RB5, RC2 and RD7.
FIGURE B-3:PIC18F46J50 FULL-SPEED USB DEMONSTRATION BOARD – ICE MODULE
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technic al Support:
http://support.microchip.com
Web Address:
www.microchip.com
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088