USB host issues

Hi,

I've just start playing with the MKR USB host. I've read some general instructions about how to use the native USB as USB host and I added the GD Sports (GitHub - gdsports/USB_Host_Library_SAMD: USB host library 2.0 for Zero/M0/SAMD) library, since it is said to work correctly with the MKR and has Prolific / FTDI driver support.

So far I've been trying to run the basic examples but can't see anything working yet.
Have some of you already worked with USB host on this MKR boards? I tryed the keyboard and mouse examples, the usb.Init() returns normally and no errors are shown, but it also doesn't recognize the keyboard or mouse when plugged in.
Actaully, my results are (Using the KeyboardController or MouseController example):

  • When nothing is connected:
Keyboard Controller Program started
USB state changed: 0x0 -> 0x20
Device Attached
USB state changed: 0x20 -> 0x30
Resetting Device
USB state changed: 0x30 -> 0x40
Reset complete

-When a keyboard or a mouse is connected:

Keyboard Controller Program started
USB state changed: 0x0 -> 0x12
Detached, waiting for Device

When nothing is attached on the USB port, the 3 states messages occurs instantly on start up.
The results are the same doesn't matter if I am using the GD Sports lib or not.
Well, I'm looking for more information on this feature and how can I debug and move further on it.
Thanks!

If you are getting serial console output via the USB port you are doing it wrong. When using USB Host, serial console does not work. The board must be powered via 5V to VIN. The details are covered in the USB Host Library for SAMD README.md.

gbafamily:
If you are getting serial console output via the USB port you are doing it wrong. When using USB Host, serial console does not work. The board must be powered via 5V to VIN. The details are covered in the USB Host Library for SAMD README.md.

Sorry for not giving enough information.
I am not getting serial console output via USB, since there is only one USB physical interface. I am using the UART on pins 13 / 14 (Serial1) for debug, and connecting the USB devices (keyboard, mouse) through an OTG USB cable. The board is being powered with 5V at Vin pin.

I am following the USB Host Library for SAMD README.md instructions, even so I can't get a USB device recognition/enumeration to work. If you can, please, give me some further information on how can I debug this USB host function I'll really appreciate.
Thanks.

Ok, I got it. My OTG cable wasn't actually an OTG. After checking the 4th pin (sense / USB_ID), I realized that it wasn't connected to GND. Solving this little issue makes everything work like a charm.

Regards,
Marcio Jr.