• AVR Freaks

Hot!Debugging USB-host on PIC32MM0128GPM048

Author
gurksallad
New Member
  • Total Posts : 27
  • Reward points : 0
  • Joined: 2017/02/02 01:10:12
  • Location: Sweden
  • Status: offline
2020/01/25 08:02:05 (permalink)
0

Debugging USB-host on PIC32MM0128GPM048

I'm tinkering with my first USB-project. Using MCC, I've generated code for UART2 (with printf to UART checked) and USB-host. In the USB-code, there's a lot of DEBUG-lines which are called if DEBUG_ENABLE is enabled. So, I enabled all the DEBUG-outputs just to investigate what's happening. I connected a PL2303 USB-TTL-adapter for the debugging. I've checked "HID Keyboard" in MCC under the USB TPL-table settings.
 
I program the chip and put it in run-mode, and I can see this in the serial-window:
HOST: Initializing DETACHED state.
 
So, the USB-stack is initialized. Fair enough. Then I connect a keyboard and see this:
[>HOST: Starting settling delay.


Then there's...nothing in the serial-window, and I'm unsure where to go from here.
 
Let's say I want to dump information about the keyboard I just connected. Where in the USB-stack code should I start poking / reading code?
 
#1

4 Replies Related Threads

    gurksallad
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2017/02/02 01:10:12
    • Location: Sweden
    • Status: offline
    Re: Debugging USB-host on PIC32MM0128GPM048 2020/01/29 06:13:39 (permalink)
    0
    I added some more debug-strings in the code, and found out that the stack gets stuck here after the keyboard is attached:


                            case SUBSUBSTATE_WAIT_FOR_SETTLING:
                                // Wait for the timer to finish in the background.
                                LED_Toggle();
                                break;


    So it seems that the USB-connection is never settling. Now I just have to find out what that means.
    #2
    JPortici
    Super Member
    • Total Posts : 1159
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Debugging USB-host on PIC32MM0128GPM048 2020/01/29 07:51:45 (permalink)
    0
    Hardware? Demo board? Schematic? The hardware side of things for usb host is critical
    #3
    gurksallad
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2017/02/02 01:10:12
    • Location: Sweden
    • Status: offline
    Re: Debugging USB-host on PIC32MM0128GPM048 2020/02/28 04:47:54 (permalink)
    0
    It's my own board I built for testing USB. Schematics is here.
     
    D+/D- and the XTAL-traces are not crossing each other, so that's not the issue (I thought about that first). XTAL is a HC49SM +-30ppm 18pF.
    #4
    gurksallad
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2017/02/02 01:10:12
    • Location: Sweden
    • Status: offline
    Re: Debugging USB-host on PIC32MM0128GPM048 2020/05/03 05:45:45 (permalink)
    0
    I think I've made a mistake on the PCB. I have connected USB Pin 1 (Vcc) directly to my +5V power source, but if I read the datasheet right I'm supposed to let the PIC32 handle the USB Vcc?
     
    If that's correct then maybe this is the source of the error.
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5