Simple HID bootloader based USB port programmer
1. Overview
USB programmer principle
Figure 1: USB programmer principle
Best and the easiest way is (I hope same also for you) to use USB programmer – USB interface is available on every computer today. Easiest way is to use PIC18F2550’s USB interface available on the chip. There is needed:
- PIC18F2550 - its USB interface (+few necessary components to run PIC uP)
- piece of SW in PIC18Fx55x called USB bootloader
- PC, NB or similar HW with USB interface
- programming SW for PC
- (optional +5V power supply)
Sounds easy yeah? It has also one big advantage - you will use same hardware for
- programming and
- normal operation
of PIC18F2550 with PC, too. It really kills two birds with one stone.
There is only 1 big problem. Your chip bought in shop is virgin without any software inside – it is empty. That means it’s without USB bootloader software inside! Unfortunately you need another type of programmer to get USB bootloader into your virgin PIC18F2550. To overcome this problem see other 2 available programmers (COM, LPT) on this web site.
Another disadvantage of this simple USB programmer is that there cannot be used any FW downloaded from internet in your PIC (that is not compiled for USB bootloader). That’s because bootloader occupies part of PIC’s memory and user FW is placed by bootloader behind area used by bootloader.
Here are briefly summarized positives and negatives of USB HID programmer:
| +/- | What | Why |
|---|---|---|
| + | free | HW & bootloader & programming SW are available for free |
| + | fastest | fast USB bus used |
| + | easiest | 1) just plug to USB 2) run FW update from PC |
| + | cheap | just few components needed |
| + | savvy | same wiring used for programming and regular operation – money saving |
| + | no Windows driver needed | because it uses standard Windows HID driver |
| - | not for virgin PIC’s | virgin (empty) PIC18F2550 does not have USB bootloader |
| - | not for corrupt bootloader | if bootloader become somehow corrupt, it is not possible to re-program it through USB programmer |
| - | user FW & bootloader compatibility | user FW must be tailored to specific bootloader (there must be different startpoint address for user FW), any FW found on internet flashed to PIC will not work |
2. HW
Scheme is based on several articles. Not every connection found on the internet worked. Scheme working for me:
Figure 2: PIC18F2550 USB programmer scheme
USB programmer scheme comments:
- R1, LED1
They are used to indicate if USB programmer is powered. \\They are not mandatory, you can omit them. - R3
PGM pin may activate ISP programming mode when LVP configuration bit is enabled. It’s better to connect it down to ground to enable run.
Symptom may be that your computer does not detect USB HID bootloader and device looks like not connected (because PIC does not start bootloader). - R4
Prevents from unpredictable USB bootloader activation. - R5
RB4 pin may configured for output in user SW (started after bootloader starts it), shorting it to directly to GND may in such case overload and destroy this pin - C3
There are several schemes that are not using this capacitor.
Omitting this capacitor may lead to PIC instability on my experiences. USB bootloader behaves strange – symptom is that USB device in Windows is still disconnecting and reconnecting.
You will save your time on problems like this:
Microchip forum - 18f2550 problem
Microchip forum - HID USB Bootloader not connecting to PC (PIC18F2550)
On my experiences, using external power (not USB +5V) will not help to omit this capacitor. I had two PIC18F2550 and one was working OK, other one was still “detaching in Windows”. - C4, C5
You can see several articles discussing other values. Values according to PIC18F2455 / 2550 / 4455 / 4550 Data sheet are working. - C6
May cause PIC’s instability. Some schemes are using 220nF value, but several forums are discussing higher values, somewhere I saw recommended 470nF. Unfortunately I do not have had such a capacitor, so I have used 2,2uF capacitor from my inventories. - USB connector
It is easier and cheaper to destroy USB extension cable to get 2 USB A connectors (male & female) with cable than creating one.
Here is cabling detail for USB:
| connector | cable | pin | name | cable color |
|---|---|---|---|---|
| | 1 | VCC +5V | |
| 2 | Data- | |||
| 3 | Data+ | |||
| 4 | GND |
Figure 3: USB cable details
Here you can see it on my experiment solderless breadboard:
Figure 4: PIC18F2550 USB programmer on experiment solderless breadboard
As you can see I have used simple wire as JP bootloader jumper.
3. SW
I have decided to use Microchip’s USB HID bootloader which is for free. There is USB HID FW update tool for Windows available. Because bootloader uses USB HID standard, there is no need to use special USB driver. Windows uses its generic HID driver, what is beneficial. There are only signed drivers allowed in Windows 8 standard boot mode. So it’s easy to use.
Inside installable Microchip Libraries for Applications v2013-06-15 Windows you could find:
- USB HID bootloader FW here:
microchip_solutions_v2013-06-15\USB\Device - Bootloaders\HID\USB Device - HID - HID Bootloader - C18 - PIC18F4550.hex
It uses LED on D port which is not available on 18F2550, but this does not limit to use it for PIC18F2550. - USB HID programming SW for Windows:
microchip_solutions_v2013-06-15\USB\Device - Bootloaders\HID\Software Windows Executable\
There you can find version 2.9j, but I like version 2.6a more (like another users ofPIC18 USB Bootloaders).
All needed you could find packed in 1 archive at the bottom of this article.
Let’s look how to use it:
- USB HID bootloader FW has to be in your PIC18F2550.
- Run Microchip USB HID Bootloader v2.6a:
Figure 5: Microchip USB HID Bootloader v2.6a – no device detected
Nothing detected now.
- Shorten JP bootloader.
- Connect programming HW.
- Windows detects new HW and starts to install drivers
Figure 6: Installing HID USB Bootloader drivers
- In device manager we can see new hardware.
Figure 7: Device manager: HID-compliant vendor-defined device
- In hardware properties we can see PIC's Vendor ID 0x04D8 and Device ID 0x003C.

Figure 8: HID-compliant vendor-defined device details - Hardware ID
- Device is ready to program
Figure 9: Microchip USB HID Bootloader v2.6a - device attached
- Open Hex File you would like to load into PIC.
This will enable Program and Verify buttons.
Figure 10: Microchip USB HID Bootloader v2.6a - program/verify active
- Program/Verify your file into PIC.
- Microchip USB HID Bootloader v2.6a - erasing This will enable Program and Verify buttons.
Figure 11: Microchip USB HID Bootloader v2.6a - erasing PIC
- Microchip USB HID Bootloader v2.6a - programming
- Microchip USB HID Bootloader v2.6a - verifying This will enable Program and Verify buttons.
Figure 12: Microchip USB HID Bootloader v2.6a - veryfing PIC
- Microchip USB HID Bootloader v2.6a - Erase/Program/Verify Completed Successfully This will enable Program and Verify buttons.
Figure 13: Microchip USB HID Bootloader v2.6a - done successfully
4. Downloads
Archive USB HID programmer package.zip contains:
- USB HID bootloader HEX file for PIC18F2550 (PIC18F2455, PIC18F4455, PIC18F4550) from MicroChip,
- USB HID programming SW for Windows v.2.6a,
- USB HID programmer schematics in PDF.
For more information about few FWs for testing with USB HID bootloader see section PIC test programs.
5. Final remarks
- This article just shows what worked for me, it does not mean there is not another way to achieve same result.
- You can find many bootloaders (not only for USB), some of them are for free, some are not, here you can find some more info here:
- You can find many other programming SWs (that are designed for particular bootloader).
- Programmer has to work with PIC18F2455 which has 24kB FLASH comparing to PIC18F2550’s 32kB FLASH. So this is Simple HID bootloader based USB port programmer for PIC18F2550 or PIC18F2455.
- Don’t forget, everything you do is at your own risk. You have to know what you are doing. I am not responsible for any damages caused by using any information from these web pages.
- If you want to work with PICs professionally, see some commercial products with debugging capability.
- If you found these information useful, please consider to:
in EUR
in USD
(Article created 11.12.2013)