• AVR Freaks

vendor class bootloader with OHCI host

Author
Elisandra
Starting Member
  • Total Posts : 83
  • Reward points : 0
  • Joined: 2007/08/10 12:55:45
  • Location: Brazil
  • Status: offline
2009/04/23 12:23:44 (permalink)
0

vendor class bootloader with OHCI host

Hi

I'm working on a project based on HID generic example form version 2.2 of the framework. After a hard time to make it work on OHCI hosts controllers (because of a compumption requirement I had to run my CPU at the lower clock speed possible), I finally got it working in both OHCI and UHCI hosts. Now I have issues with the bootloader (based on vendor class example).
The first time my device is recognized as a bootloader it works fine on OHCI hosts, but from the second time I always get "code 10" error. When testing on UHCI hosts it always works correctly (my firmware and bootloader), so I don't think a have a hardware issue. The bootloader code I'm using is from version 2.2, but it haven't changed since then. The changes I've made to the code were to use it with a 18F2450 and to use CPU clock speed of 12MHz, and nothing else. To be sure it is not a CPU clock frequency problem I've tested another project which uses almost the same bootloader, the only difference is that it runs at 48MHz, and I see the same behavior.

So, has anyone succesfully used the vendor class bootloader in OHCI hosts? Or have any idea of what could be causing this behavior?

Thank you all,
Best regards!
Elisandra
#1

12 Replies Related Threads

    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/23 16:55:52 (permalink)
    0
    The vendor class bootloader is still based on V1.x firmware due to size constraint. And it is actually a cut down version of the V1.x firmware framework. It you use usbcv to test USB chapter 9 compliance, it will not pass at all.

    On the other hand, you probably can make it to work. A USB hardware analyzer may help. If you do not have it, try a software analyzer (eg: SourceUSB trial version as suggested by Tsuneo: http://www.microchip.com/forums/tm.aspx?m=417993 ).
    post edited by xiaofan - 2009/04/23 16:57:26

      USB_Links and libusb
    #2
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/23 18:11:39 (permalink)
    0
    The first time my device is recognized as a bootloader it works fine on OHCI hosts, but from the second time I always get "code 10" error. When testing on UHCI hosts it always works correctly (my firmware and bootloader)

    Does "the second time" mean "when your firmware runs"?
    If so,
    - the bootloader works either on OHCI or on UHCI,
    - but your firmware works just on UHCI, but not on OHCI.
    Is it right?

    Then, the problem lies in your firmware, especially in timing issue of control transfer handling while enumeration.

    As xiaofan said, trace the USB traffic on sniffer.
    The point is,
    - Does error occur before or after SET_CONFIGURATION ?

    I posted typical enumeration sequence of HID, here.
    "Difference on HID enumeration on Win, Linux and Mac"
    http://www.cygnal.org/ubb/Forum9/HTML/001325.html


    When the error occurs before SET_CONFIGURATION
    you have just this option,
    a) Run the firmware in faster system clock than 12 MHz

    When error occurs after SET_CONFIGURATION
    you have two more options
    b) Move to v2.4 stack, for interrupt handling of control transfer
    c) Delay your task until the first interrupt IN transaction occurs.

    Tsuneo
    post edited by chinzei - 2009/04/23 18:28:36
    #3
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/23 18:42:06 (permalink)
    0
    ORIGINAL: chinzei
    b) Move to v2.4 stack, for interrupt handling of control transfer


    This probably will not work. The vendor class bootloader needs to reside below 0x800 (code size <2KB) which I think the V2.4 stack will not make it. Actually the full V1.x stack will not fit. So Microchip chooses to cut some corners for it and as a result it will not pass USBCV Chapter 9 test at all. Even then, people need to use the full version of C18 compiler or further cut down some features (LED blinking, etc) to make it fit if using the student version with PA optimization off.

      USB_Links and libusb
    #4
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/23 19:05:34 (permalink)
    0
    Ah, thanks xiofan,
    I'm not aware of the restriction of the vendor class bootloader, until you pointed out.

    Hmmm,
    Why does Microchip leave the code size restriction of the bootloader ?
    Any USB MCU of PIC18F families has greater program ROM than 2KB.

    Tsuneo
    #5
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/23 22:17:55 (permalink)
    0
    I do not know the reason. The later HID bootloader fits into 8KB.

    Sometimes every bytes count. Maybe that is the reason. The PICkit 2 HID bootloader reserves 16kB (but not used all the 16kB). The later PICkit 2 firmware really grows and the developer wished that the original PICkit 2 HID bootloader would only reserve 8kB so that he can have 8KB extra flash.



      USB_Links and libusb
    #6
    Elisandra
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2007/08/10 12:55:45
    • Location: Brazil
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/24 06:02:08 (permalink)
    0
    Hi!

    Thak you, Xiaofan and Tsuneo, for your answers!

    In fact, my firmware works in both OHCI and UHCI hosts. My problem is that the bootloader doesn't work properly on OHCI hosts. I can use the bootloader just the first time it is plugged in a PC, when it asks me for the driver. In this case, it works pretty fine, I can update my firmware correctly. If I want to enter in bootloade mode again, it will give me "code 10" error.
    In UHCI hosts it works fine, it never gave me that error. I made some changes to use it with a 18F2450 part at 12MHz, and instead of using a button to get into bootloader mode I check for a constant in the flash memory, I thought that maybe 12MHz wasn't enough to make it work in a OHCI host. But in other device I use the same bootloader, just working at a different frequency (48MHz) and it has the same behavior.
    I don't have the development board anymore, so I can't test with the original code to see if this issue was already there. I searched in the forum and in the web and I haven't seen any problem similar to mine... Then I don't know if I introduced the problem in the bootloader Smile or if nobody has tested it with a OHCI host.

    In my application I don't have much free space, I'm afraid I'll not be able to move to HID bootloader... But I'll test it in both hosts. As you suggested I'll try to catch with a software sniffer where it fails. I also put a ticket for Microchip's support. As soon as I get some results I'll post them here.

    Thanks again for your help,
    Regards!
    Elisandra
    #7
    Elisandra
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2007/08/10 12:55:45
    • Location: Brazil
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/28 10:17:32 (permalink)
    0
    Hi!

    I've tested the HID bootloader, modified to work in the 18F2450 part at 12MHz. It seems to work fine in both hosts. But I can't use this solution because I don't have enough free space in program memory sad
    Change framework version is useless, since the bootloader hasn't changed since version 1.3.
    I'm trying to understand the problem using a software sniffer. Meanwhile I'm waiting Microchip's support reply.

    Thanks for your help!
    Elisandra
    #8
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/29 07:56:01 (permalink)
    0
    Could you use PIC18F2550 so that you have more flash memory? The cost is higher than PIC18F2450 though.

      USB_Links and libusb
    #9
    Elisandra
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2007/08/10 12:55:45
    • Location: Brazil
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/29 08:31:43 (permalink)
    0
    Hi,

    Unfortunately, I can't change the pic, it's not my decision... We already use the 18F2450 in another project, and as we have a very small board, we need a 28-pin QFN part (the 44-pin will not fit into the board).
    I see a light at the end of the tunel, though grin The 2 PCs with OHCI hosts I have here use the same controller (SiS 7001 PCI), a very old and as I discovered googling it, a very buggy one. I'm waiting to test my device in other PC, with Vista instead of Windows XP to see if I get better results.

    Thanks again,
    Regards!
    Elisandra
    #10
    Elisandra
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2007/08/10 12:55:45
    • Location: Brazil
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/30 13:44:15 (permalink)
    0
    Hi

    So, I tested my device in another PC, with another OHCI host controller, with Vista, and I saw the same behavior.
    Now I've run out of ideas... I'm waiting for a reply from microchip's support.
    I'm sending attached two SnoopyPro logs: the first one from the first time I plug my device and the second one shows what happens if I just restart my device (for testing purposes I programmed just the bootloader, so when I restart my device it will enumerate as bootloader again).

    Regards!
    Elisandra

    #11
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/04/30 18:44:59 (permalink)
    0
    It is better to copy the txt from USBSnoopy Pro and post it here. The files are of binary format.

      USB_Links and libusb
    #12
    Elisandra
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2007/08/10 12:55:45
    • Location: Brazil
    • Status: offline
    RE: vendor class bootloader with OHCI host 2009/05/05 06:44:28 (permalink)
    0
    Hi,

    I think it's easier to just explain the difference between the two situations: the first time I plug my device in a PC with OHCI host I see a regular log, with no errors. When I restart it, I see just two requests: get descriptor and select configuration. On select configuration there's the following message: "no Configuration descriptor present => unconfigure device!". The same happens if I run the bootloader at 48MHz.
    I have a ticket in Microchip's support, they will try to replicate my problem (at least I was told so :) ). So now I'm waiting. I don't have the necessary knowledge to explore this problem. I'm trying to get the development board again, so that I can test the original code.

    Thanks for your help!
    Regards,
    Elisandra
    #13
    Jump to:
    © 2020 APG vNext Commercial Version 4.5