Arduino Forum

Products => Arduino Due => Topic started by: DANNY003 on Jun 14, 2019, 08:16 pm

Title: [RESOLVED] Connecting an usb joystick to Arduino Due using Native usb port
Post by: DANNY003 on Jun 14, 2019, 08:16 pm
I would like to know how to connect my joystick (logitech dual action: https://support.logitech.com/en_us/product/dual-action-gamepad ) to Native usb port of Arduino Due.

A library already done is USBHOST (https://www.arduino.cc/en/Reference/USBHost) 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.
Title: Re: Connecting an usb joystick to Arduino Due using Native usb port
Post by: ard_newbie on Jun 14, 2019, 08:53 pm
Maybe this Library:

https://github.com/MHeironimus/ArduinoJoystickLibrary (https://github.com/MHeironimus/ArduinoJoystickLibrary)
Title: Re: Connecting an usb joystick to Arduino Due using Native usb port
Post by: DANNY003 on Jun 14, 2019, 09:56 pm
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.
Title: Re: Connecting an usb joystick to Arduino Due using Native usb port
Post by: ard_newbie on Jun 15, 2019, 06:13 am
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.

https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/HID/USBHIDJoystick (https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/HID/USBHIDJoystick)

Title: RISOLVED
Post by: DANNY003 on Aug 10, 2019, 05:09 pm
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.
Title: Re: [RESOLVED] Connecting an usb joystick to Arduino Due using Native usb port
Post by: vjaycareer on Jul 12, 2020, 06:23 pm
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