PDA

View Full Version : Where is the bootloader ?



Bonxy
- 17th September 2011, 21:24
Hi All

Stupid noob-type question for you...

I've never used a bootloader before and I now need to use the microchip usb bootloader with a 18f14k50, but Im damned if I can find it lol ???
Colour me stupid, but Ive searched the net and the microchip site and cant find the firmware that goes into the pic, can anyone tell me where to download the usb bootloader firmware ?.

HenrikOlsson
- 18th September 2011, 10:32
Hi,
I've never used it but I think it's in the Microchip USB framework (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537044), take a look.

/Henrik.

Bonxy
- 18th September 2011, 15:55
Hi Henrik

That link is dead, whats a usb framework ?, I just need the bootloader firmware ?.

ScaleRobotics
- 18th September 2011, 16:18
It is sort of weird, but Microchip has you download the whole application libraries to get it. http://ww1.microchip.com/downloads/en/DeviceDoc/microchip-application-libraries-v2011-06-02-windows-installer.exe

HenrikOlsson
- 18th September 2011, 16:20
What do you mean dead? It works fine here, I just cliicked it to get the following quote:


The USB Frameworkis a distribution package containing a variety of USB related PIC18, PIC24F, PIC32 firmware projects, along with other USB related drivers and resources intended for use on the PC. All release notes are included in the .zip file bundle.

Demos include Device CDC demo, Printer demo, bar code scanner demo, CDC serial emulator, device composite HID and mass storage, generic driver demo, HID mouse demo, HID keyboard demo, SD card reader, SD data logger, thumb drive data logger (host) and much more

My guess is you'll find Microchips USB Bootloader somewhere among those files. If it's not the Microchip USB bootloader you're looking for then obviously you won't find it there but then it would be good if you told us which one you're looking for.

/Henrik.

mister_e
- 18th September 2011, 16:21
Nah the link is working... things just changed a little bit.

MicroChip USB Framework is a HUGE collection of ready to go and compile code example.... and an excellent source of knowledge. EVERYBODY should have it somewhere in their computer. Sure enough it's a massive package.

Now the latest USB Framework is merged with other Microchip ressources in a single package called Microchip Application Library (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en547784).

Originally, the USB Bootloader have been made for the PICDEM USB board (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en021940&part=DM163025).

You may also need to download their C18 (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010014) compiler in case the .HEX file for your specific PIC is not included in the USB Framework.

Bonxy
- 19th September 2011, 10:23
Henrik, the link only works for me if I right-click and select open in new window ?, very strange.

mister_e, ok thanks for that, I would never have found this package if you hadn't told me about it, the microchip website has nothing that indicates to me where to find the bootloader, anyways, I have downloaded the package and found the bootloader for my device already as a hex and I've made some progress.
I have programmed the bootloader into my device and it is recognised by the PC bootloader program and I can use it to put my main program into the device.

Next problem, I dont know how to switch between bootloader mode and running my main program ?.

I have this line in my main program:-

Define RESET_ORG 0x800 'To use this device with the Microchip USB Bootloader

I noticed that it puts the bootloader portion at the beginning of memory rather than end (which I expected)

Any ideas

Bonxy
- 19th September 2011, 13:05
Ok, I made a bit more progress, I changed "Define RESET_ORG 0x800" to "Define RESET_ORG 0x1000" and it now runs my program 'sometimes', its pretty random, after a reset sometimes it comes back up in bootloader mode and sometimes runs my program, I guess I have to find out what switches it between the two ?.

Bruce
- 19th September 2011, 13:43
The Microchip USB loaders are configured to run on Microchip USB dev boards and they use SW2 to determine if it jumps to the loader or user code at POR. In the USB loader version I have, io_cfg.h has SW2 defined as the switch used to toggle between loader & user mode.

#define sw2 PORTAbits.RA3 // this means RA3 is the switch input pin

In main.c they sample this switch at power up to determine the mode;


//Check Bootload Mode Entry Condition
if(sw2 == 1) // use sw2 to determine if the device should enter the bootloader, or main app code
{
ADCON1 = 0x07; // Restore "reset value" of the ADCON1 register
_asm
goto 0x1000 // If not bootloader, go straight to the main application remapped "reset" vector.
_endasm
}

So if RA3 = 1 at power up it jumps to your code. If RA3 = 0 it enters boot-loader mode. If RA3 is floating on your board that would explain why it's a hit & miss at POR since the input may be read as either high or low when floating.

Note the goto 0x1000. This is where your code should start. Older versions started at 0x800.