PDA

View Full Version : Working bootloader hex on 18f2550



f_lez
- 29th January 2008, 13:40
Ok I was looking on the web for working bootloaders for the 18f2550, I found lots of hex and tried them all until I found one that seems to do the required business....

I put it here for anyone who wants etc
(http://www.yorktraders.org/working2550.hex)

I stuffed it in with winpic800 and a willem, mounted pic on a homemade PCB board with leds on all ports, connected it, and rb0 / rb1 leds flash.....

First they flash together for a few seconds, then change to alternate flashing

like its waiting for something, or maybe thats all it does?

I connected it to the PC with a usb cable, and windows saw an unknown device, downloading the microchip 'pic184550 family drivers' it now shows up in device manager when I plug it into windows.

Once connected the leds flash all the time....(together then alternate)

So, where do I go from here to getting an 'hello world' or night rider LED demo into it ?

Maybe this hex is not a boot loader after all but a flashing led demo!

Seems I have my hardware problems all sorted, just dont know the next step

skimask
- 29th January 2008, 18:22
Ok I was looking on the web for working bootloaders for the 18f2550, I found lots of hex and tried them all until I found one that seems to do the required business....
I stuffed it in with winpic800 and a willem, mounted pic on a homemade PCB board with leds on all ports, connected it, and rb0 / rb1 leds flash.....
First they flash together for a few seconds, then change to alternate flashing
like its waiting for something, or maybe thats all it does?
I connected it to the PC with a usb cable, and windows saw an unknown device, downloading the microchip 'pic184550 family drivers' it now shows up in device manager when I plug it into windows.
Once connected the leds flash all the time....(together then alternate)
So, where do I go from here to getting an 'hello world' or night rider LED demo into it ?
Maybe this hex is not a boot loader after all but a flashing led demo!
Seems I have my hardware problems all sorted, just dont know the next step

Nothing to work with here... No backlink to the source site for the hex and any hints/descriptions of what the hex might do, no pictures of the schematics, LEDs, etc.
From what I read, it sounds like what you've got is exactly what you said...some pretty flashing/blinking lights.

f_lez
- 30th January 2008, 00:23
well as it shows up in windows as a 'pic18f4550 family'' i'd presume its the original or compatible microchip bootloader.

schemetic is simple, leds on every port.....


Problem is most diagrams I find for it are for the 4550, so where do I connect a switch to bootload,do I need a switch to bootload?

Why is everything bootloader for the 4550?

seems anyone wanting to play with 2550's are getting the short end of the stick.....

how do I generate basic that compatible with a bootloader etc.

All this and other questions answered on the next episode of.........

Bruce
- 6th February 2008, 16:53
I modified the Microchip C18 firmware for the USB loader a while back to work with the 18F2550. I have attached it here with a simple PBP code example.

Comments are in the PBP code for LED & switch connections. I know it works. I'm using it. If you have problems check your connections.

I won't have time to offer tech support on using the USB loader, re-compile it for another clock speed, USB PIC, etc, etc, so enjoy, and hopefully you won't have any problems.

You might want to download the docs for Microchips USB demo board. This explains a lot about the loader & circuits required, and how the C18 USB loader firmware works.

If anyone wants the modified C18 USB loader files let me know. Note you will need the C18 "C" compiler if you want to make changes.

f_lez
- 7th February 2008, 12:23
Thank you so very much for the time to post this, I'll get on it at the weekend 'real work' permitting!

Bruce
- 8th February 2008, 16:21
This is the latest version 1.3 USB framework with several bug fixes. I recommend you use
this one VS the 1st I posted.

TD26
- 25th February 2008, 17:25
Hi

Im using a pic18f2550 usb port to communicate with a mobile usb....
But im having some difficulties...
Does the usb of the pic need to be in "master mode" to communicate with useb of the mobile phone...Please need some guidance

skimask
- 25th February 2008, 18:06
Hi Does the usb of the pic need to be in "master mode" to communicate with useb of the mobile phone...Please need some guidance

PIC's are 'slaves' only, not hosts/masters....but there are other ways around that...

bcd
- 28th October 2008, 02:06
Bruce,

Would it be possible to get a copy of the C18 files for this firmware please. I have an application that has LEDs on a different port and just want to move them - shouldn't be that hard for me to muddle through.

With Thanks,
bill.

Bruce
- 28th October 2008, 13:25
Hi Bill,

The USB framework has gone through several changes since I posted the modified loader above. Grab the newest v2.3 C18 files here;

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537044

After you install it, Look in C:\Microchip Solutions\USB Device - Bootloaders\HID - Bootloader\HID Bootloader - Firmware for PIC18 Non-J Devices for io_cfg.h. That's the configuration header you'll need to modifiy to move your LEDs to another port.

If you get stuck let me know. I'll help you modify it.

bcd
- 29th October 2008, 00:17
Cool, thanks Bruce.

Downloading it now. I have an older version that I got when installing the PICDEM FS Usb board.

Interesting its the HID bootloader, but your version appears as a custom USB device that I can program with the PICDEM FS Demo application, rather than an HID device. Maybe this newer version is a built different.


bill.

bcd
- 29th October 2008, 03:20
Hi Bruce,

Having some issues - Sent you a Message - you might need to log into your User Panel to see it - can't see the Private Message option on the forum anymore..

Might be MPLAB crosseye-ness though !

bill

bcd
- 2nd November 2008, 21:35
I am a very happy chappie !

I managed to recompile the bootloader to use alternative LED pins. One thing to be aware of is that there are now two bootloader codebases that Microchip provide. One is the HID bootloader, the other is one that will work with the MPUSB application.

I tried the HID bootloader, but got some weird results, so instead modified the MPUSB bootloader which uses the custom Microchip driver. This allows me to continue to use the PICDEM FS Demo Board application to bootload my code.

All good ! Also learned more about MPLAB and C coding than I think I ever wanted to know...

bill.

mister_e
- 2nd November 2008, 21:51
Grrrrrrrrreat! It's always good to have another tool in the toolbox huh?

Out of curiosity... what kind of problem you got with HIDBootloader?

bcd
- 3rd November 2008, 02:25
Hi Steve,

I think it was more the PC application would have some issues resetting the PIC after uploading.

I'll have a try again when I get home as I also locked up the USB ports on my laptop by accidentally connecting the PicKit2 backwards on the ICSP header....

Luckily they came good after a reboot and I then reflashed the board with the MCPUSB bootloader and we were away !

I'd actually prefer to use the HID bootloader, so I will see if I can get it to work and let you all know.

Man, the more I play with this USB stuff the more I love it !!!

bill.

bcd
- 3rd November 2008, 02:54
Just doing a bit of digging in MPLAB at luchtime and I think I know why it was not working.

It seems the HID bootloader is a lot bigger than the MCHPUSB one. In MPLAB it uses 2040 bytes of program memory, compared with the 980 used by the MSCHUSB one.

In my PBP code I had this :
<code>
DEFINE RESET_ORG 800h
</code>
statement to jump over the end of the bootloader, but for the HID version I would need to make that RESET_ORG 1000h.

Like I said, I will try it when I get home as suddenly things make a lot more sense - I remember I was having issues with the program not working after I had bootloaded it, and then the bootloader failing - which I put down to me locking up the USB ports (which I also did).

Like I said, I love it, but it needs a lot of brain time !!

bill.

bcd
- 3rd November 2008, 10:45
Updating the PBP code with
<code>
DEFINE RESET_ORG 1000h ' For Microchip USB Bootloader
DEFINE INTERRUPT_ORG 1008h ' For Microchip USB Bootloader
</code>
Fixed the issue so I can now use the HID bootloader, which has the source for the Bootloader PC app.

With the second DEFINE I am not sure if I require it, but I have seen it mentioned in some posts and the Microchip docs actually mention that the Interrupt vectors are moved. It also says that the High and Low priority are on two separate locations, but my code seems to work and its late.

Tomorrow I will investigate further..

Till then Happy Pic'n !

bill

Bruce
- 3rd November 2008, 14:56
All you need to make the new HID loader work with PBP is DEFINE RESET_ORG 1000h.

If you're using both high-pri & low-pri interrupts, then just use the interrupt DEFINEs.

Example:

DEFINE INTHAND High-Pri
DEFINE INTLHAND Low-Pri

PBP will automatically take care of it for you with ORG RESET_ORG + 8 for the high priority
jump, and ORG RESET_ORG + 18h for the low priority jump.

At 0x1008 PBP inserts GOTO High-Pri, and at 0x1018 GOTO Low-Pri.

If you're not using interrupts all you need is the DEFINE RESET_ORG 1000h.

bcd
- 3rd November 2008, 19:37
Bruce,

I have DT_Int running, so will these commands still be needed ? Not sure if it adds these automagically.

bill.

Bruce
- 3rd November 2008, 20:03
Hi Bill,

All you need is the DEFINE RESET_ORG 1000h. If you look in the DT_INTS-18.bas file,
you'll see where it's already including the int handler DEFINEs for high & low int handlers.

So PBP will still place the correct int vector offsets in there automagically for you.

saochu
- 10th March 2010, 07:35
i reading and thanks to all some one !

f_lez
- 19th March 2010, 17:23
ok now i have the hex in the pic, and when i connect it to the PC I get a ding-dong, it says its a unknown device...

I guess the fuses were wrong for my xtal so in my programmer software i changed the divider from the old 20mhz crystal to the setting for my 4mhz one.


now when i connect it says there's a pic device blah blah, and the pic starts 2 leds flashing....

looks like a worker to that point...

so I have my own (from the USBCDCDEMO) program I want to put on the pic, obviously after the boot loader, so I have a define reset org1000h

But, when i compile and a get a lovely .hex file to program, how do i program it into the pic.....

I must need some utility on the pc to load and blow the .hex file...

And, do we have one that can work with microcode studio and take the .hex file as a command-line parameter and blow the hex, or is it going to have to be an awful standalone program etc that requires 768 mouse clicks....... (like the ql200 software seems to)

Looks like i am still were i was when i made the first post 2 years ago lol