• AVR Freaks

Hot!USB Host Bootloader without using VBUS

Author
LysandreL
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2018/05/24 09:18:40
  • Location: 0
  • Status: offline
2018/07/23 01:10:17 (permalink)
0

USB Host Bootloader without using VBUS

Hello everyone !
 
I come here because I have to realize a bootloader on a specific board that uses a PIC32MZ2048EFH144.
I'm quite new to the microchip world (I previously worked with motorola micropro and I work with microchip micropro for 2 months now) so I'm sorry if I misunderstood something.
 
I first realised a bootloader using Harmony (I work on MPLAB X 4.15 and Harmony 2.05) on the starter kit using a PIC32MZ and I made the modifications I wanted to make it works as I wanted. But basically the bootloader is the bootloader made by harmony. It worked well.
 
Now I have to modify this bootloader to make it work on a board designed by my collegues. This board uses a PIC32MZ2048EFH144. The main problem I face is that the 5V alimentation of the USB port is externally powered and is not using the VBUS of the pic32.
For me the problem comes from here because the bootloader keeps on waiting the key even when I plug it in.
 
I have a good 5V to power the USB port and I also see 3.3V out of VBUS.
I tried different things to make an enumeration happen like disable and enable VBUS state with:
 
BSP_USBVBUSSwitchStateSet(BSP_USB_VBUS_SWITCH_STATE_DISABLE);
BSP_USBVBUSSwitchStateSet(BSP_USB_VBUS_SWITCH_STATE_ENABLE);
 
I also tried:
 
BSP_USBVBUSPowerEnable(0, false);
BSP_USBVBUSPowerEnable(0, true);
 
But none is working.
 
So I came here, not to make you work for me but, I searched for days now and I begin to have no idea.
 
Did I miss something for the USB protocol ? Is enumeration made on VBUS detection or on D+/D- ? Should I ask to create a new board to put the power of USB port on VBUS ?
 
I'll keep on searching and I thank you in advance.
 
Lysandre
#1

4 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18266
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: USB Host Bootloader without using VBUS 2018/07/23 05:44:08 (permalink)
    0
    Which USB bootloader?
    Is your PIC the master, or device?
    #2
    LysandreL
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2018/05/24 09:18:40
    • Location: 0
    • Status: offline
    Re: USB Host Bootloader without using VBUS 2018/07/23 08:36:38 (permalink)
    0
    Hi,

    I build a USB Host Bootloader and my pic (pic32mz2048efh144) is the master. The goal is to check if the USB stick is connected when we boot and, if the USB stick is connected, to update the firmware.
     
    The board will always boot on the bootloader and check if the USB stick os connected, if not, it starts the application. If a USB stick is connected it update the firmware with the .hex file beforehand put on the root of the USB stick.
    The first time we boot the board, because no firmware is installed on the board, the bootloader will wait indefinitely that a USB stick is connected to update the firmware.
     
    The problem is that I can't even install the first firmware. I can't detect the USB stick.
     
     
    Thank for your respond,
    Lysandre
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 18266
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: USB Host Bootloader without using VBUS 2018/07/23 08:51:30 (permalink)
    3 (1)
    Did you examine the Harmony bootloader? That is exactly how it works.
    Does you Hardware match the Microchip Evaluation board?
    #4
    mdehaven
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2020/01/18 10:07:18
    • Location: Indiana
    • Status: offline
    Re: USB Host Bootloader without using VBUS 2020/01/23 18:03:55 (permalink)
    4 (1)
    On the MZ part the VBUS needs to be connected directly to 5V.  3.3V is, I think, 3 rather than 4 on the USBOTG bits representing VBUS using the analog window comparators (0b10 rather than 0b11.)
     
    If you're debugging, pause and you'll see in the peripheral register what these bits are.  They align on the 5th and 4th bits so 0x...18 is '11'.  My register shows 0x....98 when Vbus is connected to 5V.  I had this issue with our Vbus connecting to 3.3V rather than 5.
     
    Not only that but there was another good catch from another post that if ANY other pin is overdriven, it will cause the analog comparators to fault and the USBOTG bits will not report correctly.  This will prevent USB communication from continuing in the state machine.  We had a 12V sense that was overdriving an analog input pin and it caused this exact behavior.
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5