USB Library
Device - Boot Loader - HID

Supported Demo Boards 

The matrix of which demos are supported on a specific board can be found in the Release Notes demo board support section. Verify that the board you wish to use will work with this demo. This table also describes some of the limitations that the board might have while running this demo. 

Demo Operation 

Included with the MCHPFSUSB HID Bootloader firmware is a simple PC-side host application. This application implements a basic set of commands, allowing a user to invoke the bootloader on an appropriately-programmed PIC microcontroller and program new application code. The bootloader host application interface looks as shown in figure below: 

 

Using the application is straightforward. After launching the host application, connect the hardware containing a PIC microcontroller with the bootloader already programmed to the host PC with a USB cable. The host responds by enumerating the hardware as a HID class device; the host application responds with the message ‘Device Attached’ and enabling several options. 

NOTE: The host application, like the rest of the HID bootloader, is an example application; it should be thought of as a framework for development. Users may want to consider modifying the interface or its functions to suit their own purpose. 

The host application supports the following functions: 

• Import Firmware Image: selects a HEX image file on the PC to be loaded onto the microcontroller, using the standard Windows File Open dialog. The file is stored in the host’s internal buffer. 

• Erase/Program/Verify Device: This is a 3-step operation. 

1) It first erases the Flash program memory on the target microcontroller. If “Allow Configuration Word Programming” is selected, the configuration bits or flash configuration words (depending on the device) will also be erased. 

2) It then programs the target microcontroller with the recently selected HEX file. 

3) Finally it compares the program image on the target to a HEX file image stored in the host’s buffer to complete verify operation. 

• Reset Device: issues a RESET instruction to the target microcontroller. This is typically done following successful erase/program/verify operation, so that the application can begin executing the newly reprogrammed firmware image. 

The “Program” file menu option has a “Settings…” which contains checkboxes allowing the user to select what type of program memory regions should be programmed on the erase/program/verify operation. This allows for deselecting EEPROM from being programmed for example. This also allows for enabling/disabling reprogramming of the configuration bits (and therefore last page of flash memory on PIC18FxxJxx devices).

NOTE: The SD Card PICtail™ Daughter Board (Microchip Direct: AC164122) uses the RB4 I/O pin for the card detect (CD) signal when used with the PIC18F87J50 FS USB Demo Board (PIM), and is actively driven by the PICtail. The active drive overpowers the pull up resistor on the RB4 pushbutton (on the PIC18F87J50 FS USB Demo Board). As a result, if the PIC18F87J50 is programmed with the HID bootloader, and an SD Card is installed in the socket when the microcontroller comes out of reset, the firmware will immediately enter the bootloader (irrespective of the RB4 pushbutton state). To exit the bootloader firmware, remove the SD Card from the SD Card socket, and tap the MCLR button. When the SD Card is not plugged in, the PICtail will drive the card detect signal (which is connected to RB4) logic high, which will enable the bootloader to exit to the main application after coming out of reset. Once the main application firmware is operating, the SD Card can be plugged in. The SD Card is “hot-swappable” and should be recognized by the host upon insertion. To avoid this inconvenience when using the bootloader with the PICtail, it is suggested to modify the bootloader firmware to use some other I/O pin for bootloader entry, such as RB0 (which has a pushbutton on it on the HPC Explorer board). 
Topics
Name 
Description 
This section covers various topics that should be considered when implementing a boot loader. It also discusses possible changes in behavior from the default behavior that a user might want to implement in their boot loading solution. 
This section discusses the lower level details of the boot loader and how it was implemented. 
MLA - USB Library Help Version : 2.16
http://www.microchip.com/mla