In the previous article I described the development board for the pic18f27j53 that I designed and built. In this article I describe how to modify the Microchip HID bootloader  for the board.

First of all what you need : 

  1. A board with the pic18f27j53 as mine. You can build one or…   I have some of this and if you want one please contact me or check my ebay
  2. MPLAB v 8.83             from Microchip
  3. Microchip Solutions v2011-12-05 from Microchip


Install the Microchip Solutions v2011-12-05 in a proper directory, I assume that it is installed in :

C:\Microchip Solutions v2011-12-05

Make a copy of the directory

C:\Microchip Solutions v2011-12-05\USB\Device – Bootloaders\HID\Firmware – PIC18F47J53 Family


Now open the project  HID Bootloader PIC18F47J53 Family.mcp  with MPLAB (The project is in the directory

C:\Microchip Solutions v2011-12-05\USB\Device – Bootloaders\HID\Firmware – PIC18F47J53 Family)

You need to modify a little this project because it is for the pic18f47J53 and the microchip PIM board .

Select the PIC18F27J53 from the menu Configure ->Select Device.. then click OK

From the project window open the file main.c,and Comment the following lines :

void BlinkUSBStatus(void);   (line 167)

BlinkUSBStatus();                    (line 264)

Find the line  containing          (line 304)  

#if defined(__18F26J53)||defined(__18F26J53)|| \


and change to  ( probably an error in this release)

#if defined(__18F26J53)||defined(__18F27J53)|| \



comment the line

mInitAllLEDs();                         (line 376)

remove from the file ( I used #if 0 #endif ) the void BlinkUSBStatus(void) function.

Save the file and close it.


Now open the Boot47J53Family.c file form the project

Find the “void BlinkUSBStatus(void);” and comment the line

Save the file and close it.


Open the usbdrv.c from the project find the string “//Configure I/O pins for lowest power.  This will be application specific.”

And comment the lines

LEDSave = mLED_1 | mLED_2;




now find the string “//Now restore states of I/O pins if desired/if it was changed prior to entering sleep”

and comment the lines

mLED_1 = LEDSave;

mLED_2 = LEDSave;

Save the file and close it.


Now remove the file BootModified.rm18f47j53_g.lkr from the project and add the  BootModified.rm18f27j53_g.lkr

Save the project and build it.


Probably you will receive an error due to wrong path for the include and library file. Set the proper directories using the menu

Project->BuildOptions … ->Project

Rebuild the project and 

Enjoy with the bootloader

Burn it into the pic and use the program HIDBootloader (Windows).exe to flash the new hex file.

When I burned the pic using PicKit3 I receive the message :


Device ID Revision = 00000001 


The following memory regions failed to program correctly: Configuration Memory Address: 0001fff9 

Expected Value: 000000ff Received Value: 000000f7 Programming failed 


According to the datasheet the upper nibble of the 0001fff9 (CONFIG1H) needs to be always program to 1, 

while the low nible 

— CP0 CPDIV1 CPDIV0  has the third bit (-)  without specification 

I checked the errata but there isn't this problem 

It seems there is an error in the programmer …….  Not in the bootloader that works very fine 


We have some board already soldered at low cost on ebay goto


Stay tuned for howto modify the simplecdc and cdc demo projects for the pic18f27j53

Copyright 2012 Armando Volpe & Stefano D’Andrea