PIC18F4455 USB Bootloader
November 29, 2008
This week I’ve put the USB Bootloader on my PIC experimental board. A bootloader allows you to program the PIC uC without a programmer. More info about using the bootloader can be found on this site. A first trial resulted in all the leds flashing periodically (no leds should light up during startup). After some digging around I added these configuration variables in my header file:
#pragma config PLLDIV = 5
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2
#pragma config FOSC = HSPLL_HS
When these were set Windows already gave a notice that an unkown USB device had been attached. Well I certainly prefer an unknown device over no device at all
. After some more digging I just copied all the pragma variables from this project from Elektor: usb aquisitioncard. I don’t know which of the many variables did the trick, but it worked and I was able to succesfully install the driver!
When starting the programmer tool, you have to select the device in a combo list. I got an error saying “error 997 Overlapping I/O operation”. If you get this error go to the configuration screen > devices > PIC18F4455 Family Device and uncheck “computer may disable this device to save energy”.

A good start to use the bootloader is the demo02 project that is included with the driver and the bootloader. Open it with MPLAB and execute make all. It is designed for a 18F4550 but it also worked on my 18F4455. In a next step I created my own project, therefore I changed the linkerfile of the 18F4455 like this:
CODEPAGE NAME=boot START=0×0 END=0×7FF PROTECTED
CODEPAGE NAME=vectors START=0×800 END=0×0x829 PROTECTED
CODEPAGE NAME=page START=0×82A END=0×67FF
so we reserve a part for the booting and we shift the remaining part. I did get the following warning while loading the hex file of my project in the bootloader program:

You better click No when you get this warning, because bad things happen otherwise (which resulting in having to reprogram the PIC). The warning popped up because certain pragma vars in the code were conflicting. After removing them I didn’t get the error anymore.
To end this post just a before and after photo of my development environment :p
before… |
after.. |
[ my own testproject to program with the bootloader ] 25kB
[ the pragma vars to include in the Microchip bootloader project ] 2kB
[ my hex file that got the bootloader working (for a PIC 18F4455) ] 67kB
[ site of Welek, the friendly creators of my experimental board ]
[ The bootloader files of Microchip ]
Entry Filed under: Electronics. Tags: bootloader, microchip, PIC, PIC18F, PIC18F4455, usb.
2 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1. PIC servocontroller (in C) « Kr3l’s Turf | May 2, 2009 at 4:38 pm
[...] if you like. Note that this project assumes to be loaded onto the PIC with an USB bootloader (see this article for [...]
2. Distance scanner using servomotor and distance sensor « Kr3l’s Turf | May 9, 2009 at 6:10 pm
[...] if you like. Note that this project assumes to be loaded onto the PIC with an USB bootloader (see this article for [...]