USB Bootloader.


Closed Thread
Results 1 to 23 of 23

Thread: USB Bootloader.

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521

    Default USB Bootloader.

    Hi guys,
    I'm trying to get an USB bootloader going on a 18F4550 on my EasyPIC4 board. As many others starting with this USB-thing I ran into problems.

    I downloaded the bootloader .hex file for 20Mhz crystal from the USB Bitwacker project site, this .hex is supposed to work with '4550 (and I believe it does but more on that later). Then I downloaded the Microchip USB framework 1.3 (MCHPFSUSB_Setup_v1.3.exe)and installed it on my PC. Finally I flashed the PIC with bootloader .hex file using the programmer on board the EasyPIC4 and it's associated software.

    Finally I connected the board to the PC....ding dong.....new device found and it magically installed the driver - really, can it be this easy??

    To get the device into bootload mode you're supposed to pull RC2 low when the device boots, I did that and could then select the board in the PICDEM(TM) FS USB Demo tool application - so far so good. The two status LED's connected to RC0 and RC1 also started to flash sequentially. I wipped up a quick PBP program, compiled it, loaded the .hex file into the PICDEM application and hit Program Device - success! This is why I think that bootlader .hex and chip is (or atleast was) working.

    My program, however, didn't run. I quickly figured out it might be because I forgot to add the DEFINE RESET_ORG 800h and I may have accidently overwritten the bootloader.....and therefor also the config word with the oscillator settings etc.


    Finally to the point. Since that mistake I can NOT get the PC to properly connect to the board. I've reflashed the bootloader several time, I've uninstalled and reinstalled the Microchip drivers and application but every time I connect the USB cable (no matter to which USB port) it does recognise it as a Custom Microchip USB device but it doesn't work. Sometimes I get a message"balloon" saying something like This device does not function properly and it shows there's something wrong with the device in the device manager. The two status LEDs on the board also now blinks together instead of sequentially.

    I've added 0.22uF extra decoupling on VUsb but that didn't help either.

    Is there anybody out there that might have an idea of what's going on here?

    Thanks a lot!
    /Henrik.

    By the way, if I do a search on 'USB' the search engine returns a bunch of threads located in the sub-forum [i]USB[/u] but if I navigate to the USB subforum from there's only three threads showing. What am I missing?

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    The only part I might be able to help with is the sub form part. At the bottom on the page there is a box that has from the beginning in it. Make sure that is selected.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521

    Default

    Thanks Dave,
    I thought it was weird with only three threads there, never noticed that selection at the bottom before....

    Still messing around with the USB stuff.... I got the 'other' USB bootloader from Microchip working (I believe it is the HID bootloader), well kind of.... I have a simple blink-a-led program that when flashed directly to the PIC works fine but when downloaded thru the bootloader it either doesn't "get there" or it never executes or there's something else going wrong.

    Just ordered my 2.6 upgrade from Mecanique, I hear the USB stuff is easier with 2.6 - although that probably won't help with the bootloader issues. I'll keep playing...

    Thanks!
    /Henrik.

  4. #4
    Join Date
    Oct 2004
    Posts
    448

    Default

    Quote Originally Posted by HenrikOlsson View Post
    Thanks Dave,
    I got the 'other' USB bootloader from Microchip working (I believe it is the HID bootloader), well kind of.... I have a simple blink-a-led program that when flashed directly to the PIC works fine but when downloaded thru the bootloader it either doesn't "get there" or it never executes or there's something else going wrong.

    Thanks!
    /Henrik.
    Absolutely the same problem here, Henrik. Did you make any progress?

    Moreover, I find that all the USB bootloaders at Microchip, by default use a setting of HS Oscillator, PLL enabled, HS used by USB; with this I always get a USB Device Not Recognized; I have to change it to HS Oscillator, HS used by USB to get the pic (18F4455 in my case) to be recognised by the PC. But beyond this point, the loader fails to 'burn' the program in the pic; I have used the DEFINE LOADER_USED 1 and DEFINE RESET_ORG 1000h.

    Wonder what I am doing wrong?

    Incidentally, the test program works despite the 2 defines if I program it directly using a Pickit2. Didnt really expect that to happen?

    Regards,

    Anand

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521

    Default

    Hi,
    Sorry, no progress, I gave up on it for the time being. Still interested if you or anyone else has or finds a USB bootloader that "just works! though.

    /Henrik.

  6. #6
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default

    Did you guys see this thread:
    http://www.picbasic.co.uk/forum/show...usb+bootloader

    It talks about skipping over the bootloader code using:
    Code:
    DEFINE LOADER_USED 1
    DEFINE RESET_ORG 1000h ' For Microchip USB Bootloader
    Just wondering if that improves anything? Have yet to try the USB bootloader here though.

  7. #7
    Join Date
    Dec 2011
    Posts
    2

    Default Re: USB Bootloader.

    Yes, yes, this is an old thread but it is not an old topic. I have spun my mouse so much trying to get a HID bootloader working that I have worn my desktop. I have banged my head on things such as trying to refresh my copy of the 4550 firmware in the MCHPUSB BOOTLOADER\BOOTLOADER-Firmware for Pic18f4550 because my current firmware is screwed up from earlier editing. I have other concerns also such as dealing with interrupt addresses, changing the clock to agree with what I am using. Tired.

    Three feathers and a glass of milk to you folks who were successful with this dog. I might come back to this later....maybe! In place of this bootloader where it appears I will spend many more hours trying to get the thing to run, I just emptied two bucks from my wallet and placed an order on Ebay for a USB-RS232 adapter. Will it work? For two bucks I think it is worth a try.

    But getting back to this thread, I seriously compliment those who cracked this thing, I have a great deal more learning to do, just not enough time or desire to do it. But got to keep the faith..........in Microchip!

    Foggy

  8. #8
    Join Date
    Dec 2012
    Posts
    2

    Default Re: USB Bootloader.

    Hii every one ,i want quick reply please help me, i am performing a project where i connect VDIP1 with PIC 18F458 ,on PIC 18F458 i also connect LCD and keypad. I only like to read file from usb and want to display it on LCD.Any one give me an efficient code to full fill my requirement

  9. #9
    Join Date
    Oct 2011
    Posts
    54

    Default Re: USB Bootloader.

    Hi Foggy
    If you still want a USB bootloader that works with PBP then try this one.
    If I can get it to work then you should also. Get it here:-

    http://digital-diy.com/pic-micrcontr...otloaders.html

    Example program - **** DO NOT INCLUDE the line 'DEFINE LOADER USED 1' ****


    DEFINE OSC 48
    DEFINE RESET_ORG 0F00h 'Load code at 0F00h

    RED_LED VAR PORTC.0
    YELLOW_LED VAR PORTC.1
    GREEN_LED VAR PORTC.2

    START:
    HIGH RED_LED
    PAUSE 500
    LOW RED_LED
    HIGH YELLOW_LED
    PAUSE 500
    LOW YELLOW_LED
    HIGH GREEN_LED
    PAUSE 500
    LOW GREEN_LED
    GOTO START:


    Compile and then load the hex file produced into the PIC with the bootloader.
    Reset the PIC by taking MCLR pin low and the LEDs should blink
    Reset the PIC again by taking MCLR low and you should be back in bootloader mode. No need to hold PORTB.4 low as with the Microchip bootloader. Don't forget pull-up on MCLR.

    A few conclusions reached mainly by trial and error.
    1 - DEFINE LOADER_USED 1
    This is not required. As far as I can tell all it does is tell the compiler to load the hex file using Microcode Loader when "Compile/Program" is clicked and puts a jump to where the Microcode loader is in the PIC memory which we do not want.
    2 - DEFINE RESET_ORG 0F00h
    This IS required as it sets the memory address where the program will be loaded.
    3 - The bootloader software is best flashed to a BLANK PIC. It may take 2 or 3 erase cycles before the PIC is blank.
    4 - When flashing the PIC with PICKit programmer, click on "Tools" then "Enable code protect". This seems (so far) to prevent the bootloader from being accidentally over written.
    5 - Tested with Windows XP, PBP 2.6, PIC 18F2550 20mHz Xtal
    I have no other suitable PICs to test at the moment.

    I have tried it with a few short programs and so far it has worked 100%

    Phil

  10. #10
    Join Date
    Dec 2011
    Posts
    2

    Default Re: USB Bootloader.

    Quote Originally Posted by Sherbrook View Post
    Hi Foggy
    If you still want a USB bootloader that works with PBP then try this one.
    If I can get it to work then you should also. Get it here:-

    http://digital-diy.com/pic-micrcontr...otloaders.html

    Example program - **** DO NOT INCLUDE the line 'DEFINE LOADER USED 1' ****


    DEFINE OSC 48
    DEFINE RESET_ORG 0F00h 'Load code at 0F00h

    RED_LED VAR PORTC.0
    YELLOW_LED VAR PORTC.1
    GREEN_LED VAR PORTC.2

    START:
    HIGH RED_LED
    PAUSE 500
    LOW RED_LED
    HIGH YELLOW_LED
    PAUSE 500
    LOW YELLOW_LED
    HIGH GREEN_LED
    PAUSE 500
    LOW GREEN_LED
    GOTO START:


    Compile and then load the hex file produced into the PIC with the bootloader.
    Reset the PIC by taking MCLR pin low and the LEDs should blink
    Reset the PIC again by taking MCLR low and you should be back in bootloader mode. No need to hold PORTB.4 low as with the Microchip bootloader. Don't forget pull-up on MCLR.

    A few conclusions reached mainly by trial and error.
    1 - DEFINE LOADER_USED 1
    This is not required. As far as I can tell all it does is tell the compiler to load the hex file using Microcode Loader when "Compile/Program" is clicked and puts a jump to where the Microcode loader is in the PIC memory which we do not want.
    2 - DEFINE RESET_ORG 0F00h
    This IS required as it sets the memory address where the program will be loaded.
    3 - The bootloader software is best flashed to a BLANK PIC. It may take 2 or 3 erase cycles before the PIC is blank.
    4 - When flashing the PIC with PICKit programmer, click on "Tools" then "Enable code protect". This seems (so far) to prevent the bootloader from being accidentally over written.
    5 - Tested with Windows XP, PBP 2.6, PIC 18F2550 20mHz Xtal
    I have no other suitable PICs to test at the moment.

    I have tried it with a few short programs and so far it has worked 100%

    Phil
    Phil-- Thanks for taking time to respond to my earlier post!!! As I type, I have both versions, HID & MCHPUSB bootloaders working. The particular one that I am using for no real good reason is the MCHPUSB bootloader. Getting one of these to work can be veeeery tiring if you have not done so to begin with. Some of my problems included the oscillator selection for my "main" because the USB requires either 48 or 20 MHz. After that burden was resolved with the MCHUSB, I had to change the 18F4550 linker code.

    Another thing that pi$$ed me with the HID loader was I read that the bootloader screen would just pop up from the ether once the loader was properly configured. Now granted I might have missed something that directed one to fetch the program screen from Microchip Solutions. For my use at least with C18 I can get by with the the MCHPUSB loader. And of course, Michrochip has now introduced a newer, better, improved more better....eh, make that MUCH better compiler. I spoke to one of their technical gals last January about replacing my full version of C18. I was told that I am eligible for the upgrade....but don't do it now!

    I will say that using the USB loader it gives me greater desk real estate without having to use the programmer.

    Thanks again--

    Foggy
    Last edited by foggysail; - 2nd May 2013 at 02:49.

Similar Threads

  1. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  2. Replies: 7
    Last Post: - 10th November 2008, 09:24
  3. USB Bootloader CRASH on Vista
    By mindthomas in forum USB
    Replies: 9
    Last Post: - 9th March 2008, 20:56
  4. 18F2550 MCRL/RE3 problem with USB bootloader Microchip
    By Ronald123 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 24th September 2007, 10:48
  5. BootLoader with USB to Serial Convertors
    By mike101video in forum General
    Replies: 6
    Last Post: - 10th January 2006, 16:48

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts