USB programmer principle

 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:

  1. PIC18F2550 - its USB interface (+few necessary components to run PIC uP)
  2. piece of SW in PIC18Fx55x called USB bootloader
  3. PC, NB or similar HW with USB interface
  4. programming SW for PC
  5. (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

Scheme is based on several articles. Not every connection found on the internet worked. Scheme working for me:

 PIC18F2550 USB programmer scheme

Figure 2: PIC18F2550 USB programmer scheme

USB programmer scheme comments:

  1. R1, LED1
    They are used to indicate if USB programmer is powered. \\They are not mandatory, you can omit them.
  2. 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).
  3. R4
    Prevents from unpredictable USB bootloader activation.
  4. 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
  5. 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”.
  6. C4, C5
    You can see several articles discussing other values. Values according to PIC18F2455 / 2550 / 4455 / 4550 Data sheet are working.
  7. 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.
  8. 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
 USB connectors pinouts  USB cable colours 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.

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:

  1. 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.
  2. 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 of PIC18 USB Bootloaders ).
    All needed you could find packed in 1 archive at the bottom of this article.

Let’s look how to use it:

  1. USB HID bootloader FW has to be in your PIC18F2550.
  2. Run Microchip USB HID Bootloader v2.6a:  Microchip USB HID Bootloader v2.6a – no device detected

    Figure 5: Microchip USB HID Bootloader v2.6a – no device detected

    Nothing detected now.

  3. Shorten JP bootloader.
  4. Connect programming HW.
  5. Windows detects new HW and starts to install drivers  Installing HID USB Bootloader drivers

    Figure 6: Installing HID USB Bootloader drivers

  6. In device manager we can see new hardware.  Device manager: HID-compliant vendor-defined device

    Figure 7: Device manager: HID-compliant vendor-defined device

  7. In hardware properties we can see PIC's Vendor ID 0x04D8 and Device ID 0x003C.  HID-compliant vendor-defined device details - Hardware ID

    Figure 8: HID-compliant vendor-defined device details - Hardware ID

  8. Device is ready to program  Microchip USB HID Bootloader v2.6a - device attached

    Figure 9: Microchip USB HID Bootloader v2.6a - device attached

  9. Open Hex File you would like to load into PIC.
    This will enable Program and Verify buttons.  Microchip USB HID Bootloader v2.6a - program/verify active

    Figure 10: Microchip USB HID Bootloader v2.6a - program/verify active

  10. Program/Verify your file into PIC.
  11. Microchip USB HID Bootloader v2.6a - erasing This will enable Program and Verify buttons.  Microchip USB HID Bootloader v2.6a - erasing PIC

    Figure 11: Microchip USB HID Bootloader v2.6a - erasing PIC

  12. Microchip USB HID Bootloader v2.6a - programming
  13. Microchip USB HID Bootloader v2.6a - verifying This will enable Program and Verify buttons.  Microchip USB HID Bootloader v2.6a - veryfing PIC

    Figure 12: Microchip USB HID Bootloader v2.6a - veryfing PIC

  14. Microchip USB HID Bootloader v2.6a - Erase/Program/Verify Completed Successfully This will enable Program and Verify buttons.  Microchip USB HID Bootloader v2.6a - done successfully

    Figure 13: Microchip USB HID Bootloader v2.6a - done successfully

Archive USB HID programmer package.zip contains:

  1. USB HID bootloader HEX file for PIC18F2550 (PIC18F2455, PIC18F4455, PIC18F4550) from MicroChip,
  2. USB HID programming SW for Windows v.2.6a,
  3. USB HID programmer schematics in PDF.

For more information about few FWs for testing with USB HID bootloader see section PIC test programs.

  1. This article just shows what worked for me, it does not mean there is not another way to achieve same result.
  2. 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:
  3. You can find many other programming SWs (that are designed for particular bootloader).
  4. 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.
  5. 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.
  6. If you want to work with PICs professionally, see some commercial products with debugging capability.
  7. If you found these information useful, please consider to:
    in EUR
    in USD

(Article created 11.12.2013)

  • hw_projects/pic_projects/pic18f2550/pic_programmers/usb_pic_programmer.txt
  • Last modified: 06.01.2024 20:19
  • by Radoslav Kastiel