[RESOLVED] Connecting an usb joystick to Arduino Due using Native usb port

I would like to know how to connect my joystick (logitech dual action: Getting Started - Dual Action Gamepad โ€“ Logitech Support + Download ) to Native usb port of Arduino Due.

A library already done is USBHOST (USBHost - Arduino Reference) compatible with Due,
but it works only with mouse and keyboard.

Is there someone who has integrated to the library USB HOST, to use it with a joystick?

Thank.

Maybe this Library:

in the library is written "Arduino library that allows an Arduino Leonardo, Arduino Micro, or Arudino Due to appear as a Joystick or Gamepad.", so I don't think it goes well.

1 Like

OK. A library for an HID joystick attached to the USB Host remains to be written (certainly a lot of work), BUT:

There is a library for a USB HID Mouse attached to the USB Shield, and a library for a HID joystick attached to the USB shield too. This could be a starting point to adapt a version for the DUE Native USB2.0 as a USB HID Host for an HID joystick Device:

Compare e.g. the USB Host library for a HID Mouse and the one for the shield and understand differences so that you can adapt the library below for the DUE USB as a USB HID Host for an HID joystick Device.

Since there was no library to satisfy my needs, by changing the UsbHost library (in particular the mouse example) I created the possibility of using a USB joystick (in particular I used my joystick which I talk about above).
Attached is the new version of the library, with the basic example of the joystick.

JOYSTICK-USBHOST.zip (52.3 KB)

1 Like

Hi Danny,

please guide me to make the Logitech F710 speak with my Arduino due.

I connected the controller nano receiver to native port via otg cable.

when I power up arduino with usb trace log, i get below log:

Program started
+ USB_DETACHED_SUBSTATE_INITIALIZE
+ USB_ATTACHED_SUBSTATE_SETTLE
+ USB_ATTACHED_SUBSTATE_RESET_DEVICE
+ USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE
+ USB_ATTACHED_SUBSTATE_WAIT_SOF
+ USB_STATE_CONFIGURING
HIDBoot::Init

  • => ctrlReq*
  • => SetAddress deviceEP=0 configued as hostPIPE=0 sending to address=0*
  • => dispatchPkt token=0 pipe=0 nak_limit=65535*
  • => ctrlData IN*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=512 pipe=0 nak_limit=65535*
  • => USBHost::setAddr*
  • => ctrlReq*
  • => SetAddress deviceEP=0 configued as hostPIPE=0 sending to address=0*
  • => dispatchPkt token=0 pipe=0 nak_limit=0*
  • => dispatchPkt token=256 pipe=0 nak_limit=0*
    HIDBoot::Init : device address is now 1
  • => ctrlReq*
  • => SetAddress deviceEP=0 configued as hostPIPE=0 sending to address=1*
  • => dispatchPkt token=0 pipe=0 nak_limit=0*
  • => ctrlData IN*
  • => dispatchPkt token=256 pipe=0 nak_limit=0*
  • => dispatchPkt token=256 pipe=0 nak_limit=0*
  • => dispatchPkt token=256 pipe=0 nak_limit=0*
  • => dispatchPkt token=512 pipe=0 nak_limit=0*
    HIDBoot::Init : number of configuration is 1
  • => ctrlReq*
  • => SetAddress deviceEP=0 configued as hostPIPE=0 sending to address=1*
  • => dispatchPkt token=0 pipe=0 nak_limit=65535*
  • => ctrlData IN*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=512 pipe=0 nak_limit=65535*
  • => ctrlReq*
  • => SetAddress deviceEP=0 configued as hostPIPE=0 sending to address=1*
  • => dispatchPkt token=0 pipe=0 nak_limit=65535*
  • => ctrlData IN*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=256 pipe=0 nak_limit=65535*
  • => dispatchPkt token=512 pipe=0 nak_limit=65535*
    USBHost::Configuring : ERROR : device not supported!
  • => USBHost::setAddr*
  • => ctrlReq*
  • => SetAddress deviceEP=0 configued as hostPIPE=0 sending to address=0*
  • => dispatchPkt token=0 pipe=0 nak_limit=0*
    /!\ USBHost::ctrlReq : Setup packet error: 255
    /!\ USBHost::DefaultAddressing : Set address failed with code: 255
    /!\ USBHost::Task : USB_STATE_CONFIGURING failed with code: 255