USBHost_t36 Adding New Joysticks Acting Strangely

mjs513

Senior Member+
While playing with the Arduino USBHost lib and adding a lib for wired Joysticks I was working with the 2 new controllers that I added to USBHost_t36. PS: The Teensy USBHost_t36 is heads and shoulders more flexible and my 2 cents better (Giga does not support Bluetooth 2.0 only BLE). Also another big difference is that on the Giga I am dealing with HID data only not USB device data like on the Teensy USBHost_t36.

Any now for the issue at hand. While working with the XBOX360 controller with a separate receiver that plugs into the USBHost port found that the Teensy USBHost_t36 picks up the receiver PID/VID instead of the XBOX360 PID/VID. On the GIGA it shows on connection:
Code:
New Gamepad device: VID:045e PID:028e [dev: 0x2400cb74 - intf: 0]Match PID/VID:

Joystick (45E:28E): connected

  Joystick Data: 01 03 0e
  Joystick Data: 02 03 00
Manufacturer: Microsoft
  Joystick Data: 03 03 03
Product: Xbox 360 Controller for Windows
  Joystick Data: 08 03 00
Serial Number: 1126ED72
and set Rumble and set Leds work without an issue.

However, on the Teensy (3.6, Micromod) it only works if I include the Receiver PID/VID:
Code:
USB Host Joystick Testing
*** Device HID1 62a:38da - connected ***
  manufacturer: MosArt
  product: Wireless Gamepad
    JoystickController claim collection
*** HID Device joystick[0H] 62a:38da - connected ***
  manufacturer: MosArt
  product: Wireless Gamepad
it never sees the PID/VID of the XBOX controller. If I include in the device PID/VID list we will see our normal controller type data:
Code:
 0:128 1:139 2:128 5:128 9:15 10:0 11:0 12:0 13:0 14:0 15:0 16:0 17:0 18:0 19:0 20:0 21:0 22:512 23:400 24:512 25:512
Joystick(0): buttons = 0
lx: 128, ly: 139, rx: 128, ry: 128
DPAD: 15 -> None
but set Rumble and/or LEDs don't work for some reason. Have to figure that one out. Maybe its me so more work is required there but have a feeling it is because its not seeing the Controller only the receiver.

Now the second controller I added was the USB Version of the classic NES controller. This case is a bit different between Teensy 3.6 and Micromod. On the Micromod it works no problem, i.e., works the way I intended the data to be seen:
Code:
 0:255 1:255 2:6 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 11:1 12:1
Joystick(0): buttons = 300
DPAD: 6 -> SE
Select Button Pressed
Start Button Pressed

However, on the T3.6 it starts out no issues, identifies the controller
Code:
USB Host Joystick Testing
*** Device HID1 79:11 - connected ***
  product: USB Gamepad
    JoystickController claim collection
*** HID Device joystick[0H] 79:11 - connected ***
  product: USB Gamepad
 0:127 1:127
Note this is the same on both the T3.6 and Mircomod.

But prints data for about 5 seconds and stops dead. The sketch is still running because if I pull out the NES Controller the Sermon shows device disconnected and I can then plug in a different controller and it runs.

Note: if I turn on debug nothing shows up saying I got an error so I am totally at a loss on this one.

If interested the updated USBHost_t36 library and the sketch I am using (joystick_new) is in my branch on github: https://github.com/mjs513/USBHost_t36/tree/NES_XBOX360
 
Good morning @mjs513,

I guess I should probably dig out a T3.6 to see if we can get any clues on the difference between it and the Micromod. Although I don't think I have those controllers.

The Teensy USBHost_t36 is heads and shoulders more flexible and my 2 cents better (Giga does not support Bluetooth 2.0 only BLE). Also another big difference is that on the Giga I am dealing with HID data only not USB device data like on the Teensy USBHost_t36.
I completely agree with you, that their current USBHost stuff for the GIGA and Portenta H7, is not working overly well, likewise for many of their other peripherals, like SD, USB and Hardware Serial. For example, I don't believe any of their current code uses DMA, by default Hardware Serial is blocking, ditto for outputs to Serial... So some of their performance is needing of a lot of work.


But it is not all bad. For example, I find certain things easier. For example, if I need to send out 6 messages to initialize a device, I can simply send the message and wait for the result, to then decide what to do next, versus, trying to setup state machines, where maybe 6 different devices send the same message and then having to know that this response was from this device and then figure out what to do with it... And if I don't want my waiting to block the processor, I can always simply create a thread...

As you mentioned, they currently only support BLE. Note: on the Arduino UNO R4 WIFI, I believe that the ESP32 that they are using, only supports BLE. I have not checked yet on the GIGA or Portenta, if they can support classic Bluetooth or not. And ArduinoBLE is nice in that they do have things implemented that we don't, for example, I believe that you can setup communications between your board and your phone.... Need to play more to understand what they can or cannot do.
 
While playing with the Arduino USBHost lib and adding a lib for wired Joysticks I was working with the 2 new controllers that I added to USBHost_t36. PS: The Teensy USBHost_t36 is heads and shoulders more flexible and my 2 cents better (Giga does not support Bluetooth 2.0 only BLE). Also another big difference is that on the Giga I am dealing with HID data only not USB device data like on the Teensy USBHost_t36.

Any now for the issue at hand. While working with the XBOX360 controller with a separate receiver that plugs into the USBHost port found that the Teensy USBHost_t36 picks up the receiver PID/VID instead of the XBOX360 PID/VID. On the GIGA it shows on connection:
Code:
New Gamepad device: VID:045e PID:028e [dev: 0x2400cb74 - intf: 0]Match PID/VID:

Joystick (45E:28E): connected

  Joystick Data: 01 03 0e
  Joystick Data: 02 03 00
Manufacturer: Microsoft
  Joystick Data: 03 03 03
Product: Xbox 360 Controller for Windows
  Joystick Data: 08 03 00
Serial Number: 1126ED72
and set Rumble and set Leds work without an issue.

However, on the Teensy (3.6, Micromod) it only works if I include the Receiver PID/VID:
Code:
USB Host Joystick Testing
*** Device HID1 62a:38da - connected ***
  manufacturer: MosArt
  product: Wireless Gamepad
    JoystickController claim collection
*** HID Device joystick[0H] 62a:38da - connected ***
  manufacturer: MosArt
  product: Wireless Gamepad
it never sees the PID/VID of the XBOX controller. If I include in the device PID/VID list we will see our normal controller type data:
Code:
 0:128 1:139 2:128 5:128 9:15 10:0 11:0 12:0 13:0 14:0 15:0 16:0 17:0 18:0 19:0 20:0 21:0 22:512 23:400 24:512 25:512
Joystick(0): buttons = 0
lx: 128, ly: 139, rx: 128, ry: 128
DPAD: 15 -> None
but set Rumble and/or LEDs don't work for some reason. Have to figure that one out. Maybe its me so more work is required there but have a feeling it is because its not seeing the Controller only the receiver.

Now the second controller I added was the USB Version of the classic NES controller. This case is a bit different between Teensy 3.6 and Micromod. On the Micromod it works no problem, i.e., works the way I intended the data to be seen:
Code:
 0:255 1:255 2:6 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 11:1 12:1
Joystick(0): buttons = 300
DPAD: 6 -> SE
Select Button Pressed
Start Button Pressed

However, on the T3.6 it starts out no issues, identifies the controller
Code:
USB Host Joystick Testing
*** Device HID1 79:11 - connected ***
  product: USB Gamepad
    JoystickController claim collection
*** HID Device joystick[0H] 79:11 - connected ***
  product: USB Gamepad
 0:127 1:127
Note this is the same on both the T3.6 and Mircomod.

But prints data for about 5 seconds and stops dead. The sketch is still running because if I pull out the NES Controller the Sermon shows device disconnected and I can then plug in a different controller and it runs.

Note: if I turn on debug nothing shows up saying I got an error so I am totally at a loss on this one.

If interested the updated USBHost_t36 library and the sketch I am using (joystick_new) is in my branch on github: https://github.com/mjs513/USBHost_t36/tree/NES_XBOX360
Hi, I am building a full size BB8 robot for a university project that uses an Arduino GIGA and I need to drive it with a wireless controller. I have a wireless Xbox360 controller and receiver that I have been trying to use but I've been having major issues. Did you get it working for the Arduino GIGA and if so what libraries and controllers did you use? Thanks
 
This is the controller I have:

If you scroll down there are pairing instructions. Think I had to press the button on the controller to pair each session. If the red light is on think it is paired been a long time
 
I have seem that controller recommend before but unfortunately I can't buy a Voyee controller in the UK. I tried one Amazon Xbox 360 Controller but the receiver never lit up when I ran the sketch GIGA_USBHostGamepad from your fork of the GIGA_USBHostMBed5_devices library. Do you think it is worthwhile ordering a different Xbox controller and trying again? I also noticed in the sketch that there are options for PS3, PS4 and switch controllers. How does that work? If I was to order a switch controller or use a PS3 controller how would the GIGA read it as they don't have a dongle like the Xbox 360 controller.
Can I use the USBHost_t36 library on the GIGA or is the GIGA_USBHostMBed5_devices library the only option?
 
Sorry for the delay in getting back to you.

My guess is that it has a different PID/VID than the one I am using or that is covered in the library. Trying to remember how to sort it out.

Lets see if we can figure it out though.

First you need to be using this library: https://github.com/KurtE/GIGA_USBHostMBed5_devices. Not the one provided by arduino.

If it still does not work try running the example (Device Info) and let me know what PID/VID is shown https://github.com/KurtE/GIGA_USBHostMBed5_devices/tree/main/examples/GIGA_USBHost_DeviceInfo

Can I use the USBHost_t36 library on the GIGA or is the GIGA_USBHostMBed5_devices library the only option?
Unfortunately no. They are designed for the different controllers. GIGA and Teensy use different controllers and firmway.
 
Back
Top