Go Down

Topic: USB Host mode not detecting device on Due on external supply (Read 553 times) previous topic - next topic

morgan14322

For my first electronics project, I decided to build an adapter to use a modern USB controller on a Gamecube console.
I got everything working using the USB programming port for development/power supply and using the USBHost library.
However, my ultimate goal is to only use the GC cable as a power source to the adapter, to carry it around  easily.

The Gamecube cable contains 5 wires: 3.3v data line, 3.3v power, 3.3v GND, 5v power (for the rumble functionality) and 5v GND.

I first tried to plug the 3.3v power and GND wires from the GC cable into the 3.3v and GND pins of the Due. Debugging had to be done by talking to a logic analyzer since I did not have the USB programming port to print to `Serial`. Here's what happened:
  • Due boots up
  • Controller (USB native port) does not seem to be detected
  • Controller (USB native port) does not seem to be detected
  • the `loop()` function seems to crash when invoking `usb.Task()` or `usb.getUsbTaskState()`
  • plugging in a USB mouse, the LED in the mouse wheel did not light up


After reading that VBUS is supposed to provide 5v to the guest device, I tried using the 5v power/GND wires from the GC cable instead of the 3.3v. Here's what happened:
  • as before, Due boots up
  • as before, controller (USB native port) does not seem to be detected
  • unlike before, the `loop()` function DID NOT seem to crash when invoking `usb.Task()` or `usb.getUsbTaskState()`
  • unlike before, the LED in the mouse wheel DID light up
  • with mouse plugged in, USBHost's `usb.getUsbTaskState()` returns `USB_STATE_RUNNING` (yay!) and libsam's `UHD_GetVBUSState()` returns `UHD_STATE_CONNECTED` (yay!)
  • with controller plugged in however, USBHost's `usb.getUsbTaskState()` returns `USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE` (boo!) and libsam's `UHD_GetVBUSState()` returns `UHD_STATE_DISCONNECTED` (boo!)


I attached some code to reproduce the issue.

1) It appears that I can power the board, VBUS and the mouse is even working fine with the 5v coming from the Gamecube cable. Why isn't the controller working/detected by `UHD_GetVBUSState()`? What can I try next?

2) I do need to use the 3.3v data line to communicate with the console regardless. Would it be ok to plug the 5v power and GND to the corresponding pins in the Due, and plug the 3.3v data line into a digital I/O pin? Would GND behave correctly then?

Thank you for your help!

EDIT: added some details and code

ard_newbie




I got everything working using the USB programming port for development/power supply and using the USBHost library.

AFAIK the USBHOST library works with the Native USB Port to connect a mouse or a keyboard.

morgan14322

The USBHost library provides mouse and keyboard out of the box, but can be used with any USB device as far as I know, and I did successfully use it with my game console controller.

The issue is that it is not working anymore when I try to use external 5v supply.

I attached some code if that helps.

Go Up