If you want to use USB bootloader later?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1

    Default If you want to use USB bootloader later?

    Hi!

    When you have installed a bootloader (4550.hex) in your pic and then you have programmed with it and Microchip USB HID Bootloader v.2.2 an application to it, how can you then afterwards invoke the bootloader ?

    Is it by pulling down RB4?

    I have RC5 pulled up to tell the hw that a bootloader is in use "here. Can't remember where from I got that info. Is that correct?

    If you can, please help!

    Regards
    Key

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    Ground RB4 then reset the PIC. If RB4=0 at power-up, it should enter loader mode.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3

    Default

    Quote Originally Posted by Bruce View Post
    Ground RB4 then reset the PIC. If RB4=0 at power-up, it should enter loader mode.
    Thank you Bruce!

    Yes, that was true (RB4=0)! It works as it should! I already tested it...

    My PIC environment seems to work as it should also with RC5 pulled up. I assume that it does not harm, however because it is with a SMD resitor pulled up I can not (want not) remove it just to check the theory.

    My next step is now to invoke the bootloader from my application, not from the boot sequence with RB4=0. In other words, when the real application is running I would like to jump from there to the bootloader, to that location where RB4 is tested and the decision has been made to continue with the bootloader.

    To do this one need first to find that point in the bootloader.
    MPLAB can dissamble a hex file, can it really?
    Is it View/Disassembly listing? I can't see anything in that listing...

    Any ideas?
    Can one really use MPLAB to disassembly pic.HEX?

    Maybe it would be better to start a new thread with completely new approach to this? Or then not...

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    All of the HID loader loader firmware is available. Just start MPLAB, open the HID loader
    project, select MPSIM as the debugger, then select View Program Memory.

    As you step through the loader source you can view where it checks for RB4, and jumps
    into the loader section if RB4=0.

    In the C source it's if(sw2 == 1) then run user program. If (sw2 == 0), it jumps to the
    loader section.

    An easy way would be to have your own code test RB4, and issue an assembler RESET
    instruction if RB4=0.

    Or you can step through the C18 source and find the exact location to GOTO & land right
    on the loader routine start section.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5

    Default

    Quote Originally Posted by Bruce View Post
    All of the HID loader loader firmware is available. Just start MPLAB, open the HID loader
    project, select MPSIM as the debugger, then select View Program Memory.

    As you step through the loader source you can view where it checks for RB4, and jumps
    into the loader section if RB4=0.

    In the C source it's if(sw2 == 1) then run user program. If (sw2 == 0), it jumps to the
    loader section.

    An easy way would be to have your own code test RB4, and issue an assembler RESET
    instruction if RB4=0.

    Or you can step through the C18 source and find the exact location to GOTO & land right
    on the loader routine start section.
    Bruce, thanks for the excellent idea.
    The only problem seems to be that I have only PICbasicPro but not PIC C-compailer. It seems to me that you can not use MPLAB to run a source code if you do not have a corresponding compiler (in this case C-compiler).

    What we know at this point is that the decision is made on RB4.
    Using MPLAB and choosing first Program Memory and when that is open you choose Machine or Symbolic tab at the bottom of the page and you can then see the disassembled listing.

    You cannot find RB4, however you can find PORTB, and in this HID bootloader only in one place, line 1953 and the disassembled code looks like this there:

    Line, Address, Opcode, Disassembly
    1953 0F40 A881 BTFSS, PORTB, 0x4, ACCESS
    1954 0F42 D004 BRA 0xf4c
    1955 0F44 0E07 MOVLW 0x7
    1956 0F46 6EC1 MOVWF ADCON1, ACCESS
    1957 0F48 EF00 GOTO 0x1000
    1958 0F4A F008 NOP
    1959 0F4C D80E RCALL 0xf6a

    So, a jump from the application code to 0x0f4a (NOP) or 0xf4c (RCALL oxf6a) should work, at least one would think so and "the problem" is hence solved. I will tell you if there are other problems... hope not

    The ACCESS on line 1953 and line 1956 refers to access bank? Is this true? Could one find a good PIC18F4550/2550 tutorial on the web somewhere, where all about the assembler would be clearly explained?

    Thanks again Bruce for your great support...

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    C-18 is still kinda free on Microchip website. Not sure if they used their optimizer to generate the .HEX though...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. USB Bootloader.
    By HenrikOlsson in forum USB
    Replies: 22
    Last Post: - 2nd May 2013, 02:46
  2. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  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 : 0

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