Go Down

Topic: [RESOLVED] Connecting an usb joystick to Arduino Due using Native usb port (Read 3674 times) previous topic - next topic

DANNY003

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.


DANNY003

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.

ard_newbie

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


DANNY003

#4
Aug 10, 2019, 05:09 pm Last Edit: Aug 13, 2019, 05:51 pm by DANNY003
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.

vjaycareer

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

Go Up