Release Notes for MCHPFSUSB v1.3 – Microchip Full-Speed USB Solutions

January 4, 2008

Table of Contents

1. What's New/Updated in Release v1.3

2. Important Notes

3. What's in the Package

4. Known Limitations

5. USB Compliance Test ID (TID) Information

6. Alternative Software Solutions

7. Online Reference Documents

8. Customer Support

# 1. What's New/Updated in Release v1.3

· Microchip General Purpose USB Windows® Driver, mchpusb.sys v1.0.0.6, is updated to support Windows Vista™ and 64-bit Windows® Operating Systems. This version is WHQL certified.

· CDC RS-232 emulation INF file, mchpcdc.inf, updated for supporting Windows Vista™ 32-bit and 64-bit.

· Some bug fixes in USB library firmware (usb9.c).

## 1.1 What's New/Updated in Release v1.2

· Several bug fixes in USB library firmware.

· Updates to support a wider selection of PIC18 USB devices.

· Out of the box support for PICDEM™ FS USB Demonstration Board and PIC18F87J50 FS USB Plug-In Module.

· General Purpose INF file, mchpusb.inf, updated to show USB icon in the Windows® Device Manager (used to appear under “Other devices”).

· CDC RS-232 emulation INF file, mchpcdc.inf, updated for supporting Windows Vista™ 32-bit.

In order to provide out of box support for both the PICDEM FS USB Demo Board and the PIC18F87J50 FS USB Plug-In Module, the example firmware projects have added a few additional “#if defined” type of statements as needed to accommodate the minor differences between the hardware platforms. By default, all of the projects are preconfigured to work with the PICDEM FS USB Demo Board. To switch them over for use with the PIC18F87J50 FS USB Plug-In Module, follow the listed steps below. For additional details, see the comments at the top of the top of the main.c file used by the projects.

1. In MPLAB® IDE, click "Configure --> Select Device" and then select the PIC18F87J50

2. From the project window, change the linker script to the 18f87j50.lkr file

3. Open usbcfg.h and uncomment the line that reads, "//#define PIC18F87J50_FS_USB_PIM" and then comment the other choices

The project should now build, and when programmed onto the device, the programs should function essentially as they do with the PICDEM FS USB Demo Board. This procedure will work with the communications device class (CDC), human interface device (HID) class, and the custom device class “Demo” projects. The USB bootloader “Boot” is not currently supported with the PIC18F87J50 family devices.

# 2. Important Notes

## Notes about .INF files

Upon initially plugging in a USB device, in some cases Windows will prompt the user for a driver. Rather than having users manually copy .sys files (driver binary files) into important system directories (such as within the “\Windows\system32\” directory structure) and manually add registry entries, Windows automates the driver installation process through the use of .INF files. INF files are plain text (can be edited with notepad) installation instruction script files.

Some types of USB devices will not require .INF files or user provided drivers (for example, a HID class mouse). For these types of devices, the operating system makes use of drivers already built into/distributed with the operating system, so no user provided driver or .INF file is necessary.

For other types of devices, Windows will prompt the user for a driver. In these cases, point Windows to the .INF file relevant for the USB device. All of the example projects included in the MCHPFSUSB framework which need an INF file are provided with an example INF file. The INF file will need slight modification (most importantly to change the VID and PID) before commercial distribution.

## Notes about Vendor ID (VID) and Product ID (PID)

Every USB product line must have a unique combination of VID and PID. All firmware examples in the 'fw' directory use Microchip's VID (0x04d8) and a unique PID. Prior to manufacturing and marketing a new USB product, the VID and PID need to be changed. New VID and PID numbers can be obtained by purchasing a VID from the USB Implementers Forum:

http://www.usb.org/developers/vendor

Alternatively, Microchip has a free VID sublicensing program. An application form for obtaining a PID (for use with Microchip’s VID: 0x04d8) from Microchip can be obtained by clicking here for the direct link.

Once a new VID/PID combination is obtained, both the firmware and the .INF file (when applicable) will need to be updated.

To modify the VID/PID in one of the example USB firmware projects, open the usbdsc.c file (found in the ‘autofiles’ folder of the project). Search for the terms “Vendor ID” and “Product ID”. They should appear in the table used for the USB Device Descriptor. Change both values as needed.

To modify the VID/PID in the .INF file, open the relevant INF file and search for the “[DeviceList]” sections. There are two sections, one for 32-bit and one for 64-bit, both sections should be identical. In these sections, some text will appear with the form “USB\VID_xxxx&PID_yyyy”. Update the “xxxx” and “yyyy” sections with the new hexadecimal format VID/PID values.

## Notes about MPLAB® C18 C Compiler

The example firmware projects included in the distribution are based around the MPLAB C18 compiler. Either the commercial version, or the free student version can be used to build the example projects. The compiler may be obtained from http://www.microchip.com/c18

# 3. What's in the Package

## 3.1. Overview

After the installation of MCHPFSUSB setup file, the content can be found in the “C:\MCHPFSUSB” directory. There are three main sub-folders available, “Documents”, “fw” (firmware), and “Pc” (Personal Computer). The “Documents” folder contains the MCHPFSUSB Firmware User’s Guide and online links to other useful USB related documents. The firmware (fw) folder contains various example firmware projects for PIC18 USB microcontrollers. The Pc directory contains software products useful for developing and demonstrating USB applications on the personal computer. The most important directories are shown below. Details of their contents and purpose are described below.

.\MCHPFSUSB\

- Documents\

- fw\

- _factory_hex\

- Boot\

- Cdc\

- Demo\

- Demo02\

- Hid\

- Pc\

- MCHPUSB Driver\

- Mpusbapi\

- Pdfsusb\

## 3.2. MPLAB IDE Firmware Projects and HEX Files

Several USB example firmware projects and hex files are included in the MCHPFSUSB distribution:

### Factory Original HEX Files

See: “C:\MCHPFSUSB\fw\_factory_hex”

Currently (as this is written), Microchip provides two full-speed USB demo board hardware platforms:

The PICDEM FS USB Demo Board (www.microchipDIRECT.com part number DM163025) ships from the factory pre-programmed with the picdemfsusb.hex file. The firmware programmed on the PIC18F4550 can be restored to its original contents by reprogramming the picdemfsusb.hex file onto the device.

The PIC18F87J50 FS USB Plug-In Module demo board (www.microchipDIRECT.com part number MA180021) ships from the factory pre-programmed with the PIC18F87J50_FS_USB_PIM_MouseDemo_2007_08.hex file. To restore the demo board to its original state, simply reprogram the microcontroller with this hex file.

To use these hex files with standard Microchip development tools such as MPLAB IDE and the MPLAB ICD2 programmer, open MPLAB IDE, click “Configure à Select Device”, then choose PIC18F4550 for the PICDEM FS USB Demo Board, or PIC18F87J50 for the PIC18F87J50 FS USB Demo PIM. Make sure an appropriate programmer is connected and has been selected. Then click “File à Import” and import the .hex file to be used. Then use the “Programmer à Program” menu choice to restore the device.

### Custom Class: Boot, USB Bootloader Firmware

See: “C:\MCHPFSUSB\fw\Boot”

This project contains USB firmware which handles the USB chapter 9 requests needed for enumeration, and it also provides an implementation example of a custom device class USB bootloader. The chapter 9 enumeration firmware has been stripped down compared to the other USB projects, in an effort to make the bootloader as small as possible (~2kB of program memory). Not all “required” chapter 9 requests are handled, only functions necessary for enumeration and basic operation are implemented.

The bootloader is written to work with the PICDEM FS USB Demo Board. The PIC18F87J50 family of devices are not currently supported.

This project provides the necessary bootloader firmware needed to use the “PICDEM FS USB Demo Tool” (launched with PDFSUSB.exe) while in the bootload mode.

After a device has been programmed with this firmware, bootload mode is entered by holding RB4 low at device power up or reset. On the PICDEM FS USB Demo Board, this can be done by holding down switch S1 (MCLR) and S2 (RB4) simultaneously, and then releasing S1 while still holding S2.

When using this firmware, Windows should prompt the user for a driver when the device first enumerates in the bootload mode. Upon receiving this prompt, point Windows to the .INF file located in the “C:\MCHPFSUSB\Pc\MCHPUSB Driver\Release” directory.

### Communications Device Class (CDC): RS-232 Emulation Firmware

See: “C:\MCHPFSUSB\fw\Cdc”

This project contains USB firmware which handles the USB chapter 9 requests needed for device enumeration, and it also provides an implementation example of a CDC class device. The firmware is intended to be used to provide RS-232 emulation over the USB port. For example, if a USB microcontroller is programmed with this firmware, upon plugging into the host PC, it will enumerate and appear in the device manager as a new communications port, with a new COM number. Windows based applications can then interface with the embedded device by using standard function calls as would be used to interface with a standard RS-232 like communications port. This can be very advantageous when migrating legacy RS-232 serial port embedded devices over to USB, as it means very little code changes are required to the PC side application to communicate with the USB device. See application note AN956 “Migrating Applications to USB from RS-232 with Minimal Impact on PC Software,” for more details.

Upon initially plugging in the USB cable to a device programmed with this CDC firmware, Windows will prompt the user for a driver. Upon receiving this prompt, point Windows to the .INF file located under the “C:\MCHPFSUSB\fw\Cdc\inf\win2k_xp_vista32_64” directory.

The CDC based RS-232 emulation firmware makes use of standard drivers which distribute with Windows. The .INF file is the only PC side file that is needed with this firmware.

Note: HyperTerminal is no longer shipped with Windows in Vista. An alternative is to use TeraTerm which can be downloaded from: http://ttssh2.sourceforge.jp/

### Custom Class: Demo (for use with PDFSUSB.exe)

See: “C:\MCHPFSUSB\fw\Demo”

This project contains USB firmware which handles the USB chapter 9 requests needed for enumeration, and it also provides an implementation example of a custom or ‘vendor’ class device using Microchip’s USB general purpose driver.

This project serves as the basis for the firmware intended to be used with the “PICDEM FS USB Demo Tool” (launched with PDFSUSB.exe). The code provided in the “Demo” project provides the firmware needed for the various features (such as temperature, potentiometer position) used by PDFSUSB.exe.

When using this firmware, Windows should prompt the user for a driver when the USB cable is first connected. Upon receiving this prompt, point Windows to the .INF file located in the “C:\MCHPFSUSB\Pc\MCHPUSB Driver\Release” directory.

### Demo02

See: “C:\MCHPFSUSB\fw\Demo02”

Demo02 is not a USB project, but a simple skeleton project meant to show how to create an application that can be programmed by the USB bootloader. The USB bootloader contained in the “Boot” project occupies flash memory locations 0x000 thru 0x7FF. The bootloader “remaps” the reset, high priority interrupt, and low priority interrupt vectors to addresses 0x800, 0x808, and 0x818 respectively. An application meant to be programmed with the bootloader must be written such that it does not use 0x000 thru 0x7FF, and it should assume the reset, high priority interrupt, and low priority interrupt vectors are located at 0x800, 0x808, and 0x818 respectively.

### Human Interface Device Class (HID): Mouse in a Circle Demo Firmware

See: “C:\MCHPFSUSB\fw\Hid\Mouse”

This project contains USB firmware which handles the USB chapter 9 requests needed for device enumeration, and it also provides an implementation example of a HID class device. The firmware is intended to emulate a basic USB mouse device, although it is intended to be readily modified for developing other types of non-mouse HID class USB devices.

When using this firmware, Windows should not prompt the user for any kind of driver or .INF files. The HID driver is provided with the operating system, so no additional files are needed. Several different types of operating systems, including modern Macintosh and Linux® operating systems have built in HID drivers. Neither the USB hardware on the PIC® microcontroller, nor the firmware used is platform specific. The mouse in a circle demo may be used on these other platforms in addition to Windows.

This project serves as the basis for the PIC18F87J50_FS_USB_PIM_MouseDemo_2007_08.hex firmware which comes pre-programmed on the PIC18F87J50 FS USB Plug-In Module demo board.

Note: When using this firmware, the mouse cursor movement can be stopped by pressing the “S4” pushbutton on the PIC18F87J50 FS USB Plug-In Module. When the firmware is used with the PICDEM FS USB Demo Board, the mouse can be stopped by pressing pushbutton “S2”.

## 3.3. USB Tools/Code for the PC

### Microchip General Purpose (Custom Class) USB Driver

See: “C:\MCHPFSUSB\Pc\MCHPUSB Driver”

Microchip provides a general purpose Windows driver which can be used by Windows applications to interface with a custom class USB device. This driver will not be necessary in many USB applications, such as USB HID class devices, which would normally use built in HID class drivers which distribute with the OS.

For USB applications that do not readily fit within the constraints of these other device class options, Microchip’s general purpose driver may be used. Windows applications can access USB devices either by directly interfacing with the driver (mchpusb.sys), or they may indirectly use the driver through a pre-compiled library.

The custom class firmware examples (“Demo” and “Boot”) are intended to be used with the general purpose USB driver.

After installation, the release notes for the general purpose USB driver are located at: “C:\MCHPFSUSB\Pc\MCHPUSB Driver\MCHPUSB Driver Release Notes.htm”

### MPUSBAPI Library and DLL Source

See: “C:\MCHPFSUSB\Pc\Mpusbapi”

A custom class Windows application using the Microchip General Purpose USB driver may interface directly with the driver (mchpusb.sys). Doing so directly requires more effort and more time to learn than using a pre-compiled library that exposes a simple to use API including basic functions like open(), read(), write(), and close().

The MPUSBAPI.DLL file is a library which provides a number of functions including the basic ones needed for reading and writing to a USB device. A list of the functions available, and the calling conventions for those functions is currently documented in the form of inline comments in the source code for the DLL file. The DLL is compiled using Borland® C++ Builder™ 6 development environment, and the source code is provided in the “C:\MCHPFSUSB\Pc\Mpusbapi\Dll\Borland_C\Source” directory.

A load time linking and a run time linking example showing how to use the DLL are included in the “C:\MCHPFSUSB\Pc\Mpusbapi\Example Applications” directory.

##

### PICDEM FS USB Demo Tool “Pdfsusb”

See: “C:\MCHPFSUSB\Pc\Pdfsusb”

The firmware which comes pre-programmed on the PICDEM FS USB Demo Board (picdemfsusb.hex) demonstrates basic USB communication with a Windows GUI based application. The firmware is intended to be used in conjunction with the “PICDEM FS USB Demo Tool” which can be launched by executing the PDFSUSB.exe file. The features and use of this application are described in the PICDEM FS USB Demonstration Board User’s Guide (DS51526).

This application was originally intended to be used with the PICDEM FS USB Demo Board, but it can be used with the PIC18F87J50 FS USB Plug-In Module as well. The demo tool makes use of hardware features, such as a temperature sensor and potentiometer which are not found on the Plug-In Module. In order to use the demo tool with this device, the Plug-In Module should be used while it is plugged into the HPC Explorer board. The HPC Explorer board has the needed potentiometer, temperature sensor, and additional LEDs.

In order to use the PICDEM FS USB Demo Tool with the PIC18F87J50 FS USB Plug-In Module, the board will need to be programmed with the code generated by the “C:\MCHPFSUSB\fw\Demo” project when it is configured for the PIC18F87J50.

# 4. Known Limitations

## Operating System Issues

On some computers, you may need administrative access in order to install USB drivers on your PC.

# 5. USB Compliance Test ID (TID) Information

When getting a USB peripheral officially compliance tested, a peripheral checklist must be filled out and submitted to the USB-IF. These checklists are provided by the USB-IF. On the peripheral checklist, one of the requested items is the TID number associated with the USB silicon used in the device. Test ID numbers can be found at the USB Design Center:

http://www.microchip.com/usb

# 6. Alternative Software Solutions

There are many third party software solutions available in designing your USB application. A few examples are listed below:

SnoopyPro (software based USB traffic logger)

- http://sourceforge.net/projects/usbsnoop/

HIDmaker FS (example USB firmware/software generator)

- http://www.tracesystemsinc.com/usb_tools.ivnu

USB Software Solutions from Jungo® (assorted USB tools and driver generator)

- http://www.jungo.com/products_st.html

# 7. Online Reference Documents

Note: Links provided below point to the latest version of the documents to date. Please check www.microchip.com for the latest version.

## Demo Board User’s Guides

PICDEM™ FS USB Demonstration Board User’s Guide – 51526a

PIC18F87J50 FS USB Plug-In Module User’s Guide – 51678a

## Device Family Data Sheets

PIC18F87J50 Family Data Sheet – 39775b (or link to product page here)

PIC18F4450 Family Data Sheet – 39760c (or link to product page here)

PIC18F4550 Family Data Sheet – 39632d (or link to product page here)

PIC18F4553 Family Data Sheet – 39887b (or link to product page here)

## Application Notes

AN950 – Power Management for PIC18 USB Microcontrollers with nanoWatt Technology

AN956 – Migrating Applications to USB from RS-232 UART with Minimal Impact on PC Software

AN1003 – USB Mass Storage Device Using a PIC® MCU

## USB Design Center

http://www.microchip.com/usb

# 8. Customer Support

## The Microchip Web Site

Microchip provides online support via our web site at http://www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information:

- Product Support - Data sheets and errata, application notes and sample programs, design resources, user's guides and hardware support documents, latest software releases and archived software
- General Technical Support - Frequently Asked Questions (FAQs), technical support requests, online discussion groups/forums (http://forum.microchip.com), Microchip consultant program member listing
- Business of Microchip - Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of 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 will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest.

To register, access the Microchip web site at www.microchip.com, click on Customer Change Notification and follow the registration instructions.

## Additional Support

Users of Microchip products can receive assistance through several channels:

- Distributor or Representative
- Local Sales Office
- Field Application Engineer (FAE)
- Technical Support

Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is available on our website.

Technical support is available through the web site at: http://support.microchip.com

## Training

- Regional Training Centers: http://www.microchip.com/rtc
- MASTERs Conference: http://www.microchip.com/masters
- Webseminars: http://techtrain.microchip.com/webseminars/QuickList.aspx

## Trademarks:

The Microchip name and logo, the Microchip logo, MPLAB, and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

PICDEM is a trademark of Microchip Technology Incorporated in the U.S.A. and other countries.

Microsoft, Windows, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

Borland, and C++ Builder are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.