Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix USB Host issues #42

Merged
merged 15 commits into from
Dec 4, 2023
Merged

Conversation

AndrewCapon
Copy link
Contributor

@AndrewCapon AndrewCapon commented Nov 11, 2023

Code to fix the issues currently with the USB Host code.

Enable with ARC_USB_FULL_SIZE=1

Use the HAL to handle the entire transfer.

Stop the NAKs flooding the cpu.

Stop the CHHs flooding the cpu.

Only retry if no data has already been received for transfer.

Copy link

Memory usage change @ 88edfed

Board flash % RAM for global variables %
arduino:mbed_giga:giga 🔺 +6576 - +6640 +0.33 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +6568 - +6640 +0.33 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 6632 0.34 0 0.0 6576 0.33 0 0.0 6632 0.34 0 0.0 6640 0.34 0 0.0 6632 0.34 0 0.0
arduino:mbed_opta:opta 6632 0.34 0 0.0 6568 0.33 0 0.0 6640 0.34 0 0.0 6640 0.34 0 0.0 6632 0.34 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,6632,0.34,0,0.0,6576,0.33,0,0.0,6632,0.34,0,0.0,6640,0.34,0,0.0,6632,0.34,0,0.0
arduino:mbed_opta:opta,6632,0.34,0,0.0,6568,0.33,0,0.0,6640,0.34,0,0.0,6640,0.34,0,0.0,6632,0.34,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

Copy link

Memory usage change @ 864f722

Board flash % RAM for global variables %
arduino:mbed_giga:giga 🔺 +6640 - +6648 +0.34 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +6640 - +6704 +0.34 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 6640 0.34 0 0.0 6648 0.34 0 0.0 6640 0.34 0 0.0 6648 0.34 0 0.0 6640 0.34 0 0.0
arduino:mbed_opta:opta 6704 0.34 0 0.0 6640 0.34 0 0.0 6648 0.34 0 0.0 6648 0.34 0 0.0 6704 0.34 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,6640,0.34,0,0.0,6648,0.34,0,0.0,6640,0.34,0,0.0,6648,0.34,0,0.0,6640,0.34,0,0.0
arduino:mbed_opta:opta,6704,0.34,0,0.0,6640,0.34,0,0.0,6648,0.34,0,0.0,6648,0.34,0,0.0,6704,0.34,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

Copy link

Memory usage change @ 1a82f91

Board flash % RAM for global variables %
arduino:mbed_giga:giga 🔺 +6640 - +6648 +0.34 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +6640 - +6704 +0.34 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 6640 0.34 0 0.0 6648 0.34 0 0.0 6640 0.34 0 0.0 6648 0.34 0 0.0 6640 0.34 0 0.0
arduino:mbed_opta:opta 6704 0.34 0 0.0 6640 0.34 0 0.0 6648 0.34 0 0.0 6648 0.34 0 0.0 6704 0.34 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,6640,0.34,0,0.0,6648,0.34,0,0.0,6640,0.34,0,0.0,6648,0.34,0,0.0,6640,0.34,0,0.0
arduino:mbed_opta:opta,6704,0.34,0,0.0,6640,0.34,0,0.0,6648,0.34,0,0.0,6648,0.34,0,0.0,6704,0.34,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@facchinm
Copy link
Collaborator

Looks good to me but I'd love if @alrvid could take a look too

@AndrewCapon
Copy link
Contributor Author

I guess the GIGA define should be used instead of ARC_USB_FULL_SIZE, I have no idea how this may effect other boards it is only tested with the GIGA.

Copy link

Memory usage change @ 2d7534e

Board flash % RAM for global variables %
arduino:mbed_giga:giga 🔺 +6568 - +6640 +0.33 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +6632 - +6640 +0.34 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 6632 0.34 0 0.0 6640 0.34 0 0.0 6568 0.33 0 0.0 6640 0.34 0 0.0 6632 0.34 0 0.0
arduino:mbed_opta:opta 6632 0.34 0 0.0 6632 0.34 0 0.0 6640 0.34 0 0.0 6640 0.34 0 0.0 6632 0.34 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,6632,0.34,0,0.0,6640,0.34,0,0.0,6568,0.33,0,0.0,6640,0.34,0,0.0,6632,0.34,0,0.0
arduino:mbed_opta:opta,6632,0.34,0,0.0,6632,0.34,0,0.0,6640,0.34,0,0.0,6640,0.34,0,0.0,6632,0.34,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

Copy link

Memory usage change @ 61ccb56

Board flash % RAM for global variables %
arduino:mbed_giga:giga 🔺 +6568 - +6640 +0.33 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +6632 - +6640 +0.34 - +0.34 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 6632 0.34 0 0.0 6640 0.34 0 0.0 6568 0.33 0 0.0 6640 0.34 0 0.0 6632 0.34 0 0.0
arduino:mbed_opta:opta 6632 0.34 0 0.0 6632 0.34 0 0.0 6640 0.34 0 0.0 6640 0.34 0 0.0 6632 0.34 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,6632,0.34,0,0.0,6640,0.34,0,0.0,6568,0.33,0,0.0,6640,0.34,0,0.0,6632,0.34,0,0.0
arduino:mbed_opta:opta,6632,0.34,0,0.0,6632,0.34,0,0.0,6640,0.34,0,0.0,6640,0.34,0,0.0,6632,0.34,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@facchinm facchinm requested a review from a team November 20, 2023 11:23
Copy link

Memory usage change @ dba021e

Board flash % RAM for global variables %
arduino:mbed_giga:giga 🔺 +6896 - +6904 +0.35 - +0.35 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 +6896 - +6904 +0.35 - +0.35 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 6896 0.35 0 0.0 6904 0.35 0 0.0 6904 0.35 0 0.0 6904 0.35 0 0.0 6904 0.35 0 0.0
arduino:mbed_opta:opta 6896 0.35 0 0.0 6904 0.35 0 0.0 6904 0.35 0 0.0 6904 0.35 0 0.0 6904 0.35 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,6896,0.35,0,0.0,6904,0.35,0,0.0,6904,0.35,0,0.0,6904,0.35,0,0.0,6904,0.35,0,0.0
arduino:mbed_opta:opta,6896,0.35,0,0.0,6904,0.35,0,0.0,6904,0.35,0,0.0,6904,0.35,0,0.0,6904,0.35,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@facchinm facchinm merged commit dba021e into arduino-libraries:main Dec 4, 2023
6 checks passed
@facchinm
Copy link
Collaborator

facchinm commented Dec 4, 2023

Manually merged, thank you so much! Everything works wonderfully from my tests!

@AndrewCapon
Copy link
Contributor Author

Nice one.

I'm at the moment trying to track down an issue with hubs.

If you have a bulk device and an interrupt device connected, if you request async data from the bulk device (after data received) and the interrupt device within a ms of each of each other there is a chance that the interrupt device data will never be received, so rxhandler not called, next request not made so dead from that point.

Hopefully I can find the issue, it seems to be deep down, either in the STM code or maybe the TransferDescriptor stuff. It is illusive at the moment. When I find it I will put in another PR...

@KurtE
Copy link
Contributor

KurtE commented Dec 4, 2023

@facchinm @AndrewCapon - I also have a partial fix that works for USB LS devices that are connected directly. So far I don't have the low speed devices working with HUBs, but that may be related to the issues that Andrew mentioned.

So for example I have extended Keyboard and Mouse classes that are working (as well as some tablets and likewise @mjs513 also has some game controllers working as well.

@mjs513
Copy link

mjs513 commented Dec 20, 2023

Hi Andrew - sorry take so long to get back but had to take my little one (7 year old yorkie) to get teeth removed so a bit out of it until she gets back here.

anyway here are a couple of the controllers:

  1. NES Controller neve connects so doesn;t get to your added debug info. Seems there is an issue with it reading the device descriptor. Does get the pid/vid right though.
    NES Controller.txt

2, with the one clone that doesn;t work, i.e., no data is output, am seeing the debug info and it is using the driver:
DS4Clone.txt

  1. The switch is working from what I can tell. In others the rest of the startup code
    SwitchPro.txt

  2. As for the extreme 3d joystick - not sure.
    Logitech3d.txt

@AndrewCapon
Copy link
Contributor Author

As in Yorkie dog?

Hope she is fine.

I'm guessing these joysticks all work with the other joystickEX driver?

@KurtE
Copy link
Contributor

KurtE commented Dec 20, 2023

I was playing some more with the problem child keyboard, and still not talking. Wasted a little time this morning hacking up the dbg.h file as I found the output of the full pathnames was making it harder to see the information.

Did a quick and dirty version:

#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__))



#if (DEBUG > 3)
#define USB_DBG(x, ...) if (rtos::ThisThread::get_id() != 0) { printf("[USB_DBG: %s:%d]" x "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__); }
#else
#define USB_DBG(x, ...)
#endif

#if (DEBUG > 2)
#define USB_INFO(x, ...) if (rtos::ThisThread::get_id() != 0) { printf("[USB_INFO: %s:%d]" x "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__); }
#else
#define USB_INFO(x, ...)
#endif

#if (DEBUG > 1)
#define USB_WARN(x, ...) if (rtos::ThisThread::get_id() != 0) { printf("[USB_WARNING: %s:%d]" x "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__); }
#else
#define USB_WARN(x, ...)
#endif

#if (DEBUG > 0)
#define USB_ERR(x, ...) if (rtos::ThisThread::get_id() != 0) { printf("[USB_ERR: %s:%d]" x "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__); }
#else
#define USB_ERR(x, ...)
#endif

#if (DEBUG_TRANSFER)
#define USB_DBG_TRANSFER(x, ...) if (rtos::ThisThread::get_id() != 0) { printf("[USB_TRANSFER: %s:%d]" x "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__); }
#else
#define USB_DBG_TRANSFER(x, ...)
#endif

#if (DEBUG_EVENT)
#define USB_DBG_EVENT(x, ...) if (rtos::ThisThread::get_id() != 0) { std::printf("[USB_EVENT: %s:%d]" x "\r\n", __FILENAME__, __LINE__, ##__VA_ARGS__); }
#else
#define USB_DBG_EVENT(x, ...)
#endif

I also have added some more debug outputs in the hub code, that gives you additional information... So the last run looked like:

USB Host Keyboard viewer
[USB_DBG: USBHost.cpp:161]usb_thread read device descriptor on dev: 0x2400d464

[USB_DBG: USBHost.cpp:180]Address of 0x2400d464: 1
[USB_INFO: USBHost.cpp:206]New device connected: 0x2400d464 [hub: 0 - port: 1]
[USB_DBG: USBHost.cpp:957]dev: 0x2400d464 nb_intf: 0
[USB_DBG: USBHost.cpp:958]dev: 0x2400d464 nb_intf_attached: 0
[USB_DBG: USBHost.cpp:964]Enumerate dev: 0x2400d464
[USB_DBG: USBHost.cpp:979]CLASS: 09 	 VID: 413C 	 PID: 1004
[USB_DBG: USBHost.cpp:896]TOTAL_LENGTH: 25 	 NUM_INTERF: 1
[USB_DBG: USBHost.cpp:990]CONFIGURATION DESCRIPTOR:

09 02 19 00 01 01 02 A0 32 09 04 00 00 01 09 00 00 02 07 05 81 03 01 00 18 

[USB_DBG: USBHost.cpp:1050]dev: 0x2400d464 has 1 intf
[USB_DBG: USBHost.cpp:1059]ADD INTF 0 on device 0x2400d464: class: 9, subclass: 0, proto: 0
[USB_DBG: USBHost.cpp:629]USBEndpoint created (0x2400ce54): type: 3, dir: 2, size: 1, addr: 1, state: USB_TYPE_IDLE
[USB_DBG: USBHost.cpp:1078]ADD USBEndpoint 0x2400ce54, on interf 0 on device 0x2400d464
[USB_DBG: USBHost.cpp:1003]Set configuration 1 on dev: 0x2400d464
[USB_DBG: USBHost.cpp:1016]dev 0x2400d464 is enumerated

[USB_INFO: USBHostHub.cpp:106]New HUB: VID:413c PID:1004 [dev: 0x2400d464 - intf: 0]
[USB_DBG: USBHost.h:173]register driver for dev: 0x2400d464 on intf: 0
[USB_DBG: USBHostHub.cpp:120]Hub has 3 port
[USB_DBG: USBHostHub.cpp:258]Set port 1 feature: 8
[USB_DBG: USBHostHub.cpp:264]  POWER
[USB_DBG: USBHostHub.cpp:258]Set port 2 feature: 8
[USB_DBG: USBHostHub.cpp:264]  POWER
[USB_DBG: USBHostHub.cpp:258]Set port 3 feature: 8
[USB_DBG: USBHostHub.cpp:264]  POWER
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 10301
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:194][hub handler hub: 0] status port 1 [hub: 0x2400d464]: 0x10301
[USB_DBG: USBHostHub.cpp:199][hub handler hub: 0 - port: 1] new device connected
[USB_DBG: USBHostHub.cpp:278]clear port 1 feature: 10
[USB_DBG: USBHostHub.cpp:308]get port 2 status: 100
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:194][hub handler hub: 0] status port 2 [hub: 0x2400d464]: 0x100
[USB_DBG: USBHostHub.cpp:308]get port 3 status: 100
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:194][hub handler hub: 0] status port 3 [hub: 0x2400d464]: 0x100
[USB_DBG: USBDeviceConnected.cpp:88]init dev: 0x2400d550
[USB_DBG: USBHost.cpp:642]Resetting hub 1, port 1

[USB_DBG: USBHostHub.cpp:232]reset port 1 on hub: 0x2400d464 [this: 0x2400d924]
[USB_DBG: USBHostHub.cpp:258]Set port 1 feature: 4
[USB_DBG: USBHostHub.cpp:263]  RESET
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 311
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:324]  Reset
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHost.cpp:161]usb_thread read device descriptor on dev: 0x2400d550

[USB_ERR: USBHost.cpp:176]SET ADDR FAILED
[USB_DBG: USBHost.cpp:642]Resetting hub 1, port 1

[USB_DBG: USBHostHub.cpp:232]reset port 1 on hub: 0x2400d464 [this: 0x2400d924]
[USB_DBG: USBHostHub.cpp:258]Set port 1 feature: 4
[USB_DBG: USBHostHub.cpp:263]  RESET
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 1
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
[USB_DBG: USBHostHub.cpp:309]  Device is present: 
[USB_DBG: USBHostHub.cpp:322]  Suspended
[USB_DBG: USBHostHub.cpp:325]  Has Power
[USB_DBG: USBHostHub.cpp:308]get port 1 status: 8051945
... <Kept repeating this same status>

@AndrewCapon
Copy link
Contributor Author

Looks like that setaddress failing totally screws it, I wonder why that is failing?

@mjs513
Copy link

mjs513 commented Dec 20, 2023

As in Yorkie dog?

Hope she is fine.

I'm guessing these joysticks all work with the other joystickEX driver?

To answer your questions. Yes, Thanks and Yes :)

When I am in a better frame of mind going to look at code maybe some piece we haven;t implemented yet is the hang up.

@mjs513
Copy link

mjs513 commented Dec 20, 2023

Andrew - Kurt

Decided to try different Hubs just to see if that may be an issue.

The one I am currently using is a UGREEN USB3.0 4 port hub I am using unpowered.

Tried a Amazon Basic USB3 hub and its giving me issues about not being able to read the device descriptor.

A anker USB3 hub seems to work as well.

@AndrewCapon
Copy link
Contributor Author

AndrewCapon commented Dec 20, 2023

So do they all work with some hubs?

If not:

I'm guessing it is changes to https://github.com/AndrewCapon/Arduino_USBHostMbed5/tree/USBHostMulti that are causing the problems.

The code I put in for the driver stuff is as far as I can see does exactly the same as the joystickEX code when initialising.

Can you change USBHostConf.h and give it a go with these settings:

#define ARC_USB_FULL_SIZE (1)
#define ARC_FS_OVER_HS (0)
#define ARC_NO_RESUBMITREQUEST (0)

I also pushed a new version of https://github.com/AndrewCapon/USBHostMulti that fixes the false error log about init on HID devices.

@KurtE
Copy link
Contributor

KurtE commented Dec 20, 2023

Sorry went off to town... Will play more with HUB. Somethings I am seeing in the code versus the Teensy code and the like, is maybe some of the set/clear feature values are not correct and/or sent. Like clear the suspended state, etc. Will be try out changes in this area and see if it helps

@AndrewCapon
Copy link
Contributor Author

I think the HUB code is extremely dodgy, I can still get it in states with disconnecting and connecting devices where it just dies silently. I wouldn't call it reliable.

A total rewrite might be in order.

@KurtE
Copy link
Contributor

KurtE commented Dec 20, 2023

I will try to go through it and compare it versus USBHost_t36 as well as USBHost Shield 2 code...

Edit: As well as USB 2.0 Spec chapter 11...

@AndrewCapon
Copy link
Contributor Author

Things I have noticed with the Hub code:

  1. Sometimes the port states are incorrect.
  2. I have a single memory stick that is only recognised once, you can then unplug and replug and no new connection.
  3. Sometimes it just dies, no new connections at all. Interrupt requests are still running.

The code to stop the NAK flooding does at least fix the issue where the hub dies and no interrupt requests are running.

I'm not sure if this is to do with the two hubs I have tried, one does seem more reliable than the other in general.

@mjs513
Copy link

mjs513 commented Dec 21, 2023

Morning Andrew
Tried to do a little debugging last night using the DS4 clone that registered but didn't give data. Looks like getTransfer length is returning 0 - why have no idea.

Anyway did a dump of the output from @KurtE 's ls branch and looked at it compared to the current multi branch. Here are the 2 outputs - didn't see anything but maybe you all will:
DS4Clone_Kurt.txt
DS4Clone.txt

the only thing i didn't see is where setspeed was being called? but that may just be a debug issue.

hope it helps

@AndrewCapon
Copy link
Contributor Author

Hi Mike,

Sorry, been a bit busy today. Need to look at those logs in more detail in the morning...

Cheers

Andy

@AndrewCapon
Copy link
Contributor Author

AndrewCapon commented Dec 22, 2023

Hi Mike,

If you get some time can you test like this:

  1. Use the joystick example test code from Kurts branch.
  2. Use https://github.com/AndrewCapon/Arduino_USBHostMbed5/tree/USBHostMulti

Then set in `USBHostConf.h"

#define ARC_USB_FULL_SIZE (1)
#define ARC_FS_OVER_HS (0)
#define ARC_NO_RESUBMITREQUEST (0)

If this works it shows my haphazard merge of Kurts low speed code is ok.

Then try:

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)

If this works it shows the new code with retransmit works.

Then we will be in a better place for working things out (maybe!)

As it is a HID device that is failing is there anything special that needs to be done to init these, I could only see init stuff for the xbox and switch controllers?

I do have a SpaveNavigator to test with but the Giga can't power it and all my powered hubs are in use, I may order one for amazon today...

@mjs513
Copy link

mjs513 commented Dec 22, 2023

Morning Andrew or afternoon

To answer your questions:
For the DS4 - no you dont need anything special startup when using the DS4 type controllers in wired mode - BT is another story. Only the Switch and Xbox needs that special handling.

Wouldn't worry about space navigator for now. I have one someplace but not sure where :)

Now for the more complicated things.
Tried these settings:

#define ARC_USB_FULL_SIZE (1)
#define ARC_FS_OVER_HS (0)
#define ARC_NO_RESUBMITREQUEST (0)

and it didn't work. For the DS4 clone it connected and once out of maybe 5 times of hitting restart it would work. The Teiros one connects but again no data.
Here are the dumps if you are interested:

Teiros_failed.txt
DS4Clone_failed.txt
DS4Clone_working.txt

Out of curiosity I did attach the xbox360 w/wireless adapter - it did connect and did display data but, had an issue with set rumbling, would work for a bit (on off) but then get stuck in the on position. Just as a FYI

@AndrewCapon
Copy link
Contributor Author

mmm, something must be really arsed up :)

I expected with ARC_USB_FULL_SIZE=1 then everything should be the same, I will get out beyond compare...

@mjs513
Copy link

mjs513 commented Dec 22, 2023

Andrew - There are 3 sketches in the examples for the joysticks and gamepads (ds4, etc). I tried the joystick sketch with the Logitech 3d joystick with and without the hub with the settings that your recommended.

With it attached to the hub it fails to connect and run. When plugged in directly to the giga it works no issues.

Here is the dump when attached to the hub:
logitech.txt

when attached directly to the Giga:
TyCommander-003700223033511133323537-Arduino-3.txt

Maybe a clue

@AndrewCapon
Copy link
Contributor Author

Right.

So without the hub:

Does this also work:

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)

And if that works, does the Arduino project you have converted from https://github.com/AndrewCapon/USBHostMulti work without the hub?

@mjs513
Copy link

mjs513 commented Dec 22, 2023

Hi Andrew
Sorry didn't get back to this sooner but have been busy with other home stuff today. Anyway did some testing with the devices without the hub.

#define ARC_USB_FULL_SIZE (1)
#define ARC_FS_OVER_HS (0)
#define ARC_NO_RESUBMITREQUEST (0)

Using the gamepad sketch from @KurtE's library:
Xbox360w: Works
DS4 Clone: Works
SpaceNavMouse: Works
Logitech3d: Works
Teiros DS4Clone: causes the GIGA to enter red lights of doom phase. No idea why that would happen. Address or index off?
/************************************************************************************/

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)

Xbox360w: Works
DS4 Clone: Works
SpaceNavMouse: Works
Logitech3d: Works
Teiros DS4Clone: causes the GIGA to enter red lights of doom phase. No idea why that would happen. Address or index off?
/************************************************************************************/

Now for using Multi without the hub with the sketch you have:

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)

Xbox360w: Works
DS4 Clone: Enumerates but no data (Successfully enumerated device index 0 with driver USB Joystick Driver example)
SpaceNavMouse: Works
Logitech3d: Works
Teiros DS4Clone: Ditto to DS4 clone (at least no red lights of doom

/************************************************************************************/

#define ARC_USB_FULL_SIZE (1)
#define ARC_FS_OVER_HS (0)
#define ARC_NO_RESUBMITREQUEST (0)

Xbox360w: Fails

[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:1059]ADD INTF 0 on device 0x2400db74: class: 3, subclass: 0, proto: 0
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:629]USBEndpoint created (0x2400d564): type: 3, dir: 1, size: 64, addr: 2, state: USB_TYPE_IDLE
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:1078]ADD USBEndpoint 0x2400d564, on interf 0 on device 0x2400db74
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:629]USBEndpoint created (0x2400d5fc): type: 3, dir: 2, size: 64, addr: 1, state: USB_TYPE_IDLE
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:1078]ADD USBEndpoint 0x2400d5fc, on interf 0 on device 0x2400db74
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:1003]Set configuration 1 on dev: 0x2400db74
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:1008]SET CONF FAILED
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\USBHostMulti\src\USBHostMulti.cpp:38]USBHostMulti: Failed to enumerate device index 0 with driver USB Joystick Driver example
[USB_DBG: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:520]FREE INTF 0 on dev: 0x2400db7c, 0x2400db74, nb_endpot: 2, Unknown
[USB_INFO: d:\Users\Merli\Documents\Arduino\libraries\Arduino_USBHostMbed5-USBHostMulti\src\USBHost\USBHost.cpp:537]Device disconnected [0x2400db74 - Unknown - hub: 0 - port: 1]
DS4 Clone:  Enumerates but no data (Successfully enumerated device index 0 with driver USB Joystick Driver example)

SpaceNavMouse: Works
Logitech3d: Works
Teiros DS4Clone: Successfully enumerated device index 0 with driver USB Joystick Driver example

@AndrewCapon
Copy link
Contributor Author

AndrewCapon commented Dec 23, 2023

Hi Mike,

Sorry for delay: a combination of back pain and PlatformIO updating itself and arseing everything up.

I have pushed some new code to https://github.com/AndrewCapon/Arduino_USBHostMbed5/tree/USBHostMulti this allows us to disable the few bits of code I added that are different to Kurts branch when #define ARC_USB_FULL_SIZE =1

It is all setup to go, withARC_USB_FULL_SIZE =1 and new code for setting the amount of transfer descriptors and the hid parsing are disabled.

So no need to change USBHostConf.h

Can you test Xbox360w with the sketch from Kurts lib with this code and without a hub when you get some time.

Cheers

Andy

@mjs513
Copy link

mjs513 commented Dec 23, 2023

Hi Andrew
Gave the 360w a try with the changes you made and they seem to be working. Also tried the DS4 clone that was a problem and that seems to be working as well.

Getting closer and closer :)

@KurtE
Copy link
Contributor

KurtE commented Dec 23, 2023

Sorry not keeping up too well. Arm problems...

Playing with the hub code, although probably it for today... I think there are issues in timing and threads and the like...
I also updated my Logic Analyzer HLA script to give more descriptive information on HUB stuff.

Here is connection with keyboard with internal HUB on Micromod:

<style> </style>
21.64607699 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
21.64609206 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
21.64715472 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
21.64815474 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
21.6481698 IN 0x0 0x1 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
21.64818337 IN 0x0 0x1 ACK   0x3c 0x41 0x4 0x10 0x0 0x48 0x1 0x2
21.64819694 IN 0x0 0x1 ACK   0x0 0x1
21.64915476 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - STRING #:0 I:0x0 L:0x7fc] 0x80 0x6 0x0 0x3 0x0 0x0 0xfc 0x7
21.6491699 IN 0x0 0x1 ACK   0x4 0x3 0x9 0x4
21.65015478 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - STRING #:1 I:0x409 L:0x7fc] 0x80 0x6 0x1 0x3 0x9 0x4 0xfc 0x7
21.65016995 IN 0x0 0x1 ACK   0xa 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.65018351 IN 0x0 0x1 ACK   0x6c 0x0
21.65115481 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - STRING #:2 I:0x409 L:0x7fc] 0x80 0x6 0x2 0x3 0x9 0x4 0xfc 0x7
21.65116998 IN 0x0 0x1 ACK   0x2c 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.65118354 IN 0x0 0x1 ACK   0x6c 0x0 0x20 0x0 0x55 0x0 0x53 0x0
21.6511971 IN 0x0 0x1 ACK   0x42 0x0 0x20 0x0 0x4b 0x0 0x65 0x0
21.65121067 IN 0x0 0x1 ACK   0x79 0x0 0x62 0x0 0x6f 0x0 0x61 0x0
21.65122424 IN 0x0 0x1 ACK   0x72 0x0 0x64 0x0 0x20 0x0 0x48 0x0
21.65123781 IN 0x0 0x1 ACK   0x75 0x0 0x62 0x0
21.65215483 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
21.65216993 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
21.65218353 IN 0x0 0x1 ACK   0x32
21.65315486 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x19] 0x80 0x6 0x0 0x2 0x0 0x0 0x19 0x0
21.65316998 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
21.65318355 IN 0x0 0x1 ACK   0x32 0x9 0x4 0x0 0x0 0x1 0x9 0x0
21.65319712 IN 0x0 0x1 ACK   0x0 0x2 0x7 0x5 0x81 0x3 0x1 0x0
21.65321069 IN 0x0 0x1 ACK   0x18
21.65415488 SETUP 0x0 0x1 ACK [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0
21.6551549 SETUP 0x0 0x1 ACK [RT:0xa0 R:0x6 V:0x2900 I:0x0 L:0x10] 0xa0 0x6 0x0 0x29 0x0 0x0 0x10 0x0
21.65516997 IN 0x0 0x1 ACK   0x9 0x29 0x3 0xd 0x0 0x16 0x64 0x2
21.65518353 IN 0x0 0x1 ACK   0xff
21.65615493 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: POWER I:0x1 L:0x0] 0x23 0x3 0x8 0x0 0x1 0x0 0x0 0x0
21.65715494 SETUP 0x0 0x1 ACK [HUB Set port:0x2 Feature: POWER I:0x2 L:0x0] 0x23 0x3 0x8 0x0 0x2 0x0 0x0 0x0
21.65815497 SETUP 0x0 0x1 ACK [HUB Set port:0x3 Feature: POWER I:0x3 L:0x0] 0x23 0x3 0x8 0x0 0x3 0x0 0x0 0x0
21.67407763 IN 0x1 0x1 ACK   0x2
21.67515536 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.67517039 IN 0x0 0x1 ACK   0x1 0x3 0x1 0x0
21.67615538 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_CONNECTION I:0x1 L:0x0] 0x23 0x1 0x10 0x0 0x1 0x0 0x0 0x0
21.69615585 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.69617094 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.7161563 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.71617134 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.73615677 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.73617183 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.75615722 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.75617232 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.77615769 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.77617278 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.77715771 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: RESET I:0x1 L:0x0] 0x23 0x3 0x4 0x0 0x1 0x0 0x0 0x0
21.80208058 IN 0x1 0x1 ACK   0x2
21.8031583 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.8031734 IN 0x0 0x1 ACK   0x3 0x3 0x10 0x0
21.80415833 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_RESET I:0x1 L:0x0] 0x23 0x1 0x14 0x0 0x1 0x0 0x0 0x0
21.8291665 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
21.82936714 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8
21.83008842 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x2 0x0 0x0 0x0 0x0 0x0
21.83108834 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
21.83128852 IN 0x0 0x2 ACK   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8
21.83148589 IN 0x0 0x2 ACK   0x3c 0x41 0x6 0x20 0x0 0x48 0x1 0x2
21.83164142 IN 0x0 0x2 ACK   0x0 0x1
21.83216784 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - STRING #:0 I:0x0 L:0x7fc] 0x80 0x6 0x0 0x3 0x0 0x0 0xfc 0x7
21.83236918 IN 0x0 0x2 ACK   0x4 0x3 0x9 0x4
21.8330885 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - STRING #:1 I:0x409 L:0x7fc] 0x80 0x6 0x1 0x3 0x9 0x4 0xfc 0x7
21.83328966 IN 0x0 0x2 ACK   0xa 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.83344454 IN 0x0 0x2 ACK   0x6c 0x0
21.83409538 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - STRING #:2 I:0x409 L:0x7fc] 0x80 0x6 0x2 0x3 0x9 0x4 0xfc 0x7
21.83429658 IN 0x0 0x2 ACK   0x2c 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.83445146 IN 0x0 0x2 ACK   0x6c 0x0 0x20 0x0 0x55 0x0 0x53 0x0
21.8346495 IN 0x0 0x2 ACK   0x42 0x0 0x20 0x0 0x4b 0x0 0x65 0x0
21.83484686 IN 0x0 0x2 ACK   0x79 0x0 0x62 0x0 0x6f 0x0 0x61 0x0
21.83508844 IN 0x0 0x2 ACK   0x72 0x0 0x64 0x0 0x20 0x0 0x48 0x0
21.83524374 IN 0x0 0x2 ACK   0x75 0x0 0x62 0x0
21.83616794 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
21.83636817 IN 0x0 0x2 ACK   0x9 0x2 0x3b 0x0 0x2 0x1 0x3 0xa0
21.83652304 IN 0x0 0x2 ACK   0x2d
21.83716795 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x3b] 0x80 0x6 0x0 0x2 0x0 0x0 0x3b 0x0
21.83736809 IN 0x0 0x2 ACK   0x9 0x2 0x3b 0x0 0x2 0x1 0x3 0xa0
21.83752363 IN 0x0 0x2 ACK   0x2d 0x9 0x4 0x0 0x0 0x1 0x3 0x1
21.83767917 IN 0x0 0x2 ACK   0x1 0x2 0x9 0x21 0x10 0x1 0x0 0x1
21.8378347 IN 0x0 0x2 ACK   0x22 0x41 0x0 0x7 0x5 0x81 0x3 0x8
21.83808851 IN 0x0 0x2 ACK   0x0 0xa 0x9 0x4 0x1 0x0 0x1 0x3
21.83824408 IN 0x0 0x2 ACK   0x0 0x0 0x2 0x9 0x21 0x10 0x1 0x0
21.83840028 IN 0x0 0x2 ACK   0x1 0x22 0x8e 0x0 0x7 0x5 0x82 0x3
21.83855512 IN 0x0 0x2 ACK   0x4 0x0 0xff
21.839168 SETUP 0x0 0x2 ACK [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0
21.84016802 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - HID REPORT I:0x0 L:0x41] 0x81 0x6 0x0 0x22 0x0 0x0 0x41 0x0
21.84036842 IN 0x0 0x2 ACK   0x5 0x1 0x9 0x6 0xa1 0x1 0x5 0x7
21.8405658 IN 0x0 0x2 ACK   0x19 0xe0 0x29 0xe7 0x15 0x0 0x25 0x1
21.84072066 IN 0x0 0x2 ACK   0x75 0x1 0x95 0x8 0x81 0x2 0x95 0x1
21.84087554 IN 0x0 0x2 ACK   0x75 0x8 0x81 0x1 0x95 0x5 0x75 0x1
21.84108858 IN 0x0 0x2 ACK   0x5 0x8 0x19 0x1 0x29 0x5 0x91 0x2
21.84124308 IN 0x0 0x2 ACK   0x95 0x1 0x75 0x3 0x91 0x1 0x95 0x6
21.84144046 IN 0x0 0x2 ACK   0x75 0x8 0x15 0x0 0x26 0xff 0x0 0x5
21.84159662 IN 0x0 0x2 ACK   0x7 0x19 0x0 0x2a 0xff 0x0 0x81 0x0
21.84175349 IN 0x0 0x2 ACK   0xc0
21.84189882 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - HID REPORT I:0x1 L:0x8e] 0x81 0x6 0x0 0x22 0x1 0x0 0x8e 0x0
21.84213217 IN 0x0 0x2 ACK   0x5 0xc 0x9 0x1 0xa1 0x1 0x85 0x1
21.8423301 IN 0x0 0x2 ACK   0x9 0xe0 0x15 0xe8 0x25 0x18 0x75 0x7
21.84252881 IN 0x0 0x2 ACK   0x95 0x1 0x81 0x6 0x15 0x0 0x25 0x1
21.84272818 IN 0x0 0x2 ACK   0x75 0x1 0x9 0xe2 0x81 0x6 0xc0 0x5
21.84292622 IN 0x0 0x2 ACK   0x1 0x9 0x80 0xa1 0x1 0x85 0x2 0x15
21.84308862 IN 0x0 0x2 ACK   0x0 0x25 0x1 0x75 0x1 0x95 0x3 0x9
21.84328759 IN 0x0 0x2 ACK   0x82 0x9 0x82 0x9 0x82 0x81 0x6 0x95
21.84348563 IN 0x0 0x2 ACK   0x5 0x81 0x1 0xc0 0x5 0xc 0x9 0x1
21.843683 IN 0x0 0x2 ACK   0xa1 0x1 0x85 0x3 0x15 0x0 0x25 0x1
21.84388238 IN 0x0 0x2 ACK   0x75 0x1 0x95 0x1 0xa 0x24 0x2 0x81
21.84408865 IN 0x0 0x2 ACK   0x6 0xa 0x25 0x2 0x81 0x6 0xa 0x26
21.84428642 IN 0x0 0x2 ACK   0x2 0x81 0x6 0xa 0x27 0x2 0x81 0x6
21.84448578 IN 0x0 0x2 ACK   0xa 0x23 0x2 0x81 0x6 0xa 0x8a 0x1
21.8446845 IN 0x0 0x2 ACK   0x81 0x6 0xa 0x94 0x1 0x81 0x6 0xa
21.84488186 IN 0x0 0x2 ACK   0x92 0x1 0x81 0x6 0x9 0xb5 0x81 0x6
21.84508867 IN 0x0 0x2 ACK   0x9 0xb6 0x81 0x6 0x9 0xcd 0x81 0x6
21.8452859 IN 0x0 0x2 ACK   0x9 0xb7 0x81 0x6 0xa 0x83 0x1 0x81
21.84544078 IN 0x0 0x2 ACK   0x6 0x95 0xb 0x81 0x1 0xc0
21.84561278 SETUP 0x0 0x2 ACK [HID SET_IDLE I:0x0 L:0x0] 0x21 0xa 0x0 0x0 0x0 0x0 0x0 0x0

Here is a current run on the GIGA

<style> </style>
0.75142706 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
0.75225684 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26307721 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
2.26408264 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26414154 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
2.26707338 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
2.26808023 IN 0x0 0x1 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26814055 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
2.26907993 IN 0x0 0x1 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26909393 IN 0x0 0x1 ACK   0x3c 0x41 0x4 0x10 0x0 0x48 0x1 0x2
2.26910776 IN 0x0 0x1 ACK   0x0 0x1
2.26916056 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
2.27008008 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
2.27009399 IN 0x0 0x1 ACK   0x32
2.2701483 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x19] 0x80 0x6 0x0 0x2 0x0 0x0 0x19 0x0
2.27107314 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
2.27108705 IN 0x0 0x1 ACK   0x32 0x9 0x4 0x0 0x0 0x1 0x9 0x0
2.27110087 IN 0x0 0x1 ACK   0x0 0x2 0x7 0x5 0x81 0x3 0x1 0x0
2.2711147 IN 0x0 0x1 ACK   0x18
2.27117367 SETUP 0x0 0x1 ACK [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0
2.37203627 SETUP 0x0 0x1 ACK [RT:0xa0 R:0x6 V:0x2900 I:0x0 L:0xa] 0xa0 0x6 0x0 0x29 0x0 0x0 0xa 0x0
2.37304568 IN 0x0 0x1 ACK   0x9 0x29 0x3 0xd 0x0 0x16 0x64 0x2
2.3730596 IN 0x0 0x1 ACK   0xff
2.37311192 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: POWER I:0x1 L:0x0] 0x23 0x3 0x8 0x0 0x1 0x0 0x0 0x0
2.3740727 SETUP 0x0 0x1 ACK [HUB Set port:0x2 Feature: POWER I:0x2 L:0x0] 0x23 0x3 0x8 0x0 0x2 0x0 0x0 0x0
2.3750771 SETUP 0x0 0x1 ACK [HUB Set port:0x3 Feature: POWER I:0x3 L:0x0] 0x23 0x3 0x8 0x0 0x3 0x0 0x0 0x0
2.42101966 IN 0x1 0x1 ACK   0x2
2.4210474 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.42203267 IN 0x0 0x1 ACK   0x1 0x3 0x1 0x0
2.42208756 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_CONNECTION I:0x1 L:0x0] 0x23 0x1 0x10 0x0 0x1 0x0 0x0 0x0
2.43301733 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.43402719 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.44402957 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.44502253 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.45501521 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.45602192 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.46600703 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.46701612 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.47701286 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.47801588 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.47807272 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_CONNECTION I:0x1 L:0x0] 0x23 0x1 0x10 0x0 0x1 0x0 0x0 0x0
2.47904072 SETUP 0x0 0x1 ACK [HUB Get Port:0x2 status I:0x2 L:0x4] 0xa3 0x0 0x0 0x0 0x2 0x0 0x4 0x0
2.480014 IN 0x0 0x1 ACK   0x0 0x1 0x0 0x0
2.48006916 SETUP 0x0 0x1 ACK [HUB Get Port:0x3 status I:0x3 L:0x4] 0xa3 0x0 0x0 0x0 0x3 0x0 0x4 0x0
2.48101264 IN 0x0 0x1 ACK   0x0 0x1 0x0 0x0
2.58099108 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: RESET I:0x1 L:0x0] 0x23 0x3 0x4 0x0 0x1 0x0 0x0 0x0
2.58202987 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.58299886 IN 0x0 0x1 ACK   0x11 0x3 0x0 0x0
2.68296388 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
2.68397209 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8
2.68417068 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x2 0x0 0x0 0x0 0x0 0x0

@AndrewCapon
Copy link
Contributor Author

Hi Andrew Gave the 360w a try with the changes you made and they seem to be working. Also tried the DS4 clone that was a problem and that seems to be working as well.

Getting closer and closer :)

Not so good as we have disabled all the new code :)

There are two defines in USBHostConfig:

  1. First set ARC_HID_DESCRIPTOR to 1 and try again.

Does that still work?

If so:

  1. Uncomment line 28 : //#define MAX_TD_PER_ENDPOINT (2)

Does that still work?

@AndrewCapon
Copy link
Contributor Author

Sorry not keeping up too well. Arm problems...

Playing with the hub code, although probably it for today... I think there are issues in timing and threads and the like... I also updated my Logic Analyzer HLA script to give more descriptive information on HUB stuff.

Here is connection with keyboard with internal HUB on Micromod:

<style> </style>

21.64607699 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
21.64609206 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
21.64715472 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
21.64815474 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
21.6481698 IN 0x0 0x1 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
21.64818337 IN 0x0 0x1 ACK   0x3c 0x41 0x4 0x10 0x0 0x48 0x1 0x2
21.64819694 IN 0x0 0x1 ACK   0x0 0x1
21.64915476 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - STRING #:0 I:0x0 L:0x7fc] 0x80 0x6 0x0 0x3 0x0 0x0 0xfc 0x7
21.6491699 IN 0x0 0x1 ACK   0x4 0x3 0x9 0x4
21.65015478 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - STRING #:1 I:0x409 L:0x7fc] 0x80 0x6 0x1 0x3 0x9 0x4 0xfc 0x7
21.65016995 IN 0x0 0x1 ACK   0xa 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.65018351 IN 0x0 0x1 ACK   0x6c 0x0
21.65115481 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - STRING #:2 I:0x409 L:0x7fc] 0x80 0x6 0x2 0x3 0x9 0x4 0xfc 0x7
21.65116998 IN 0x0 0x1 ACK   0x2c 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.65118354 IN 0x0 0x1 ACK   0x6c 0x0 0x20 0x0 0x55 0x0 0x53 0x0
21.6511971 IN 0x0 0x1 ACK   0x42 0x0 0x20 0x0 0x4b 0x0 0x65 0x0
21.65121067 IN 0x0 0x1 ACK   0x79 0x0 0x62 0x0 0x6f 0x0 0x61 0x0
21.65122424 IN 0x0 0x1 ACK   0x72 0x0 0x64 0x0 0x20 0x0 0x48 0x0
21.65123781 IN 0x0 0x1 ACK   0x75 0x0 0x62 0x0
21.65215483 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
21.65216993 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
21.65218353 IN 0x0 0x1 ACK   0x32
21.65315486 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x19] 0x80 0x6 0x0 0x2 0x0 0x0 0x19 0x0
21.65316998 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
21.65318355 IN 0x0 0x1 ACK   0x32 0x9 0x4 0x0 0x0 0x1 0x9 0x0
21.65319712 IN 0x0 0x1 ACK   0x0 0x2 0x7 0x5 0x81 0x3 0x1 0x0
21.65321069 IN 0x0 0x1 ACK   0x18
21.65415488 SETUP 0x0 0x1 ACK [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0
21.6551549 SETUP 0x0 0x1 ACK [RT:0xa0 R:0x6 V:0x2900 I:0x0 L:0x10] 0xa0 0x6 0x0 0x29 0x0 0x0 0x10 0x0
21.65516997 IN 0x0 0x1 ACK   0x9 0x29 0x3 0xd 0x0 0x16 0x64 0x2
21.65518353 IN 0x0 0x1 ACK   0xff
21.65615493 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: POWER I:0x1 L:0x0] 0x23 0x3 0x8 0x0 0x1 0x0 0x0 0x0
21.65715494 SETUP 0x0 0x1 ACK [HUB Set port:0x2 Feature: POWER I:0x2 L:0x0] 0x23 0x3 0x8 0x0 0x2 0x0 0x0 0x0
21.65815497 SETUP 0x0 0x1 ACK [HUB Set port:0x3 Feature: POWER I:0x3 L:0x0] 0x23 0x3 0x8 0x0 0x3 0x0 0x0 0x0
21.67407763 IN 0x1 0x1 ACK   0x2
21.67515536 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.67517039 IN 0x0 0x1 ACK   0x1 0x3 0x1 0x0
21.67615538 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_CONNECTION I:0x1 L:0x0] 0x23 0x1 0x10 0x0 0x1 0x0 0x0 0x0
21.69615585 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.69617094 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.7161563 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.71617134 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.73615677 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.73617183 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.75615722 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.75617232 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.77615769 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.77617278 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
21.77715771 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: RESET I:0x1 L:0x0] 0x23 0x3 0x4 0x0 0x1 0x0 0x0 0x0
21.80208058 IN 0x1 0x1 ACK   0x2
21.8031583 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
21.8031734 IN 0x0 0x1 ACK   0x3 0x3 0x10 0x0
21.80415833 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_RESET I:0x1 L:0x0] 0x23 0x1 0x14 0x0 0x1 0x0 0x0 0x0
21.8291665 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
21.82936714 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8
21.83008842 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x2 0x0 0x0 0x0 0x0 0x0
21.83108834 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
21.83128852 IN 0x0 0x2 ACK   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8
21.83148589 IN 0x0 0x2 ACK   0x3c 0x41 0x6 0x20 0x0 0x48 0x1 0x2
21.83164142 IN 0x0 0x2 ACK   0x0 0x1
21.83216784 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - STRING #:0 I:0x0 L:0x7fc] 0x80 0x6 0x0 0x3 0x0 0x0 0xfc 0x7
21.83236918 IN 0x0 0x2 ACK   0x4 0x3 0x9 0x4
21.8330885 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - STRING #:1 I:0x409 L:0x7fc] 0x80 0x6 0x1 0x3 0x9 0x4 0xfc 0x7
21.83328966 IN 0x0 0x2 ACK   0xa 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.83344454 IN 0x0 0x2 ACK   0x6c 0x0
21.83409538 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - STRING #:2 I:0x409 L:0x7fc] 0x80 0x6 0x2 0x3 0x9 0x4 0xfc 0x7
21.83429658 IN 0x0 0x2 ACK   0x2c 0x3 0x44 0x0 0x65 0x0 0x6c 0x0
21.83445146 IN 0x0 0x2 ACK   0x6c 0x0 0x20 0x0 0x55 0x0 0x53 0x0
21.8346495 IN 0x0 0x2 ACK   0x42 0x0 0x20 0x0 0x4b 0x0 0x65 0x0
21.83484686 IN 0x0 0x2 ACK   0x79 0x0 0x62 0x0 0x6f 0x0 0x61 0x0
21.83508844 IN 0x0 0x2 ACK   0x72 0x0 0x64 0x0 0x20 0x0 0x48 0x0
21.83524374 IN 0x0 0x2 ACK   0x75 0x0 0x62 0x0
21.83616794 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
21.83636817 IN 0x0 0x2 ACK   0x9 0x2 0x3b 0x0 0x2 0x1 0x3 0xa0
21.83652304 IN 0x0 0x2 ACK   0x2d
21.83716795 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x3b] 0x80 0x6 0x0 0x2 0x0 0x0 0x3b 0x0
21.83736809 IN 0x0 0x2 ACK   0x9 0x2 0x3b 0x0 0x2 0x1 0x3 0xa0
21.83752363 IN 0x0 0x2 ACK   0x2d 0x9 0x4 0x0 0x0 0x1 0x3 0x1
21.83767917 IN 0x0 0x2 ACK   0x1 0x2 0x9 0x21 0x10 0x1 0x0 0x1
21.8378347 IN 0x0 0x2 ACK   0x22 0x41 0x0 0x7 0x5 0x81 0x3 0x8
21.83808851 IN 0x0 0x2 ACK   0x0 0xa 0x9 0x4 0x1 0x0 0x1 0x3
21.83824408 IN 0x0 0x2 ACK   0x0 0x0 0x2 0x9 0x21 0x10 0x1 0x0
21.83840028 IN 0x0 0x2 ACK   0x1 0x22 0x8e 0x0 0x7 0x5 0x82 0x3
21.83855512 IN 0x0 0x2 ACK   0x4 0x0 0xff
21.839168 SETUP 0x0 0x2 ACK [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0
21.84016802 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - HID REPORT I:0x0 L:0x41] 0x81 0x6 0x0 0x22 0x0 0x0 0x41 0x0
21.84036842 IN 0x0 0x2 ACK   0x5 0x1 0x9 0x6 0xa1 0x1 0x5 0x7
21.8405658 IN 0x0 0x2 ACK   0x19 0xe0 0x29 0xe7 0x15 0x0 0x25 0x1
21.84072066 IN 0x0 0x2 ACK   0x75 0x1 0x95 0x8 0x81 0x2 0x95 0x1
21.84087554 IN 0x0 0x2 ACK   0x75 0x8 0x81 0x1 0x95 0x5 0x75 0x1
21.84108858 IN 0x0 0x2 ACK   0x5 0x8 0x19 0x1 0x29 0x5 0x91 0x2
21.84124308 IN 0x0 0x2 ACK   0x95 0x1 0x75 0x3 0x91 0x1 0x95 0x6
21.84144046 IN 0x0 0x2 ACK   0x75 0x8 0x15 0x0 0x26 0xff 0x0 0x5
21.84159662 IN 0x0 0x2 ACK   0x7 0x19 0x0 0x2a 0xff 0x0 0x81 0x0
21.84175349 IN 0x0 0x2 ACK   0xc0
21.84189882 SETUP 0x0 0x2 ACK [GET_DESCRIPTOR - HID REPORT I:0x1 L:0x8e] 0x81 0x6 0x0 0x22 0x1 0x0 0x8e 0x0
21.84213217 IN 0x0 0x2 ACK   0x5 0xc 0x9 0x1 0xa1 0x1 0x85 0x1
21.8423301 IN 0x0 0x2 ACK   0x9 0xe0 0x15 0xe8 0x25 0x18 0x75 0x7
21.84252881 IN 0x0 0x2 ACK   0x95 0x1 0x81 0x6 0x15 0x0 0x25 0x1
21.84272818 IN 0x0 0x2 ACK   0x75 0x1 0x9 0xe2 0x81 0x6 0xc0 0x5
21.84292622 IN 0x0 0x2 ACK   0x1 0x9 0x80 0xa1 0x1 0x85 0x2 0x15
21.84308862 IN 0x0 0x2 ACK   0x0 0x25 0x1 0x75 0x1 0x95 0x3 0x9
21.84328759 IN 0x0 0x2 ACK   0x82 0x9 0x82 0x9 0x82 0x81 0x6 0x95
21.84348563 IN 0x0 0x2 ACK   0x5 0x81 0x1 0xc0 0x5 0xc 0x9 0x1
21.843683 IN 0x0 0x2 ACK   0xa1 0x1 0x85 0x3 0x15 0x0 0x25 0x1
21.84388238 IN 0x0 0x2 ACK   0x75 0x1 0x95 0x1 0xa 0x24 0x2 0x81
21.84408865 IN 0x0 0x2 ACK   0x6 0xa 0x25 0x2 0x81 0x6 0xa 0x26
21.84428642 IN 0x0 0x2 ACK   0x2 0x81 0x6 0xa 0x27 0x2 0x81 0x6
21.84448578 IN 0x0 0x2 ACK   0xa 0x23 0x2 0x81 0x6 0xa 0x8a 0x1
21.8446845 IN 0x0 0x2 ACK   0x81 0x6 0xa 0x94 0x1 0x81 0x6 0xa
21.84488186 IN 0x0 0x2 ACK   0x92 0x1 0x81 0x6 0x9 0xb5 0x81 0x6
21.84508867 IN 0x0 0x2 ACK   0x9 0xb6 0x81 0x6 0x9 0xcd 0x81 0x6
21.8452859 IN 0x0 0x2 ACK   0x9 0xb7 0x81 0x6 0xa 0x83 0x1 0x81
21.84544078 IN 0x0 0x2 ACK   0x6 0x95 0xb 0x81 0x1 0xc0
21.84561278 SETUP 0x0 0x2 ACK [HID SET_IDLE I:0x0 L:0x0] 0x21 0xa 0x0 0x0 0x0 0x0 0x0 0x0
Here is a current run on the GIGA

<style> </style>

0.75142706 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
0.75225684 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26307721 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
2.26408264 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26414154 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
2.26707338 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
2.26808023 IN 0x0 0x1 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26814055 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
2.26907993 IN 0x0 0x1 ACK   0x12 0x1 0x10 0x1 0x9 0x0 0x0 0x8
2.26909393 IN 0x0 0x1 ACK   0x3c 0x41 0x4 0x10 0x0 0x48 0x1 0x2
2.26910776 IN 0x0 0x1 ACK   0x0 0x1
2.26916056 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
2.27008008 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
2.27009399 IN 0x0 0x1 ACK   0x32
2.2701483 SETUP 0x0 0x1 ACK [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x19] 0x80 0x6 0x0 0x2 0x0 0x0 0x19 0x0
2.27107314 IN 0x0 0x1 ACK   0x9 0x2 0x19 0x0 0x1 0x1 0x2 0xa0
2.27108705 IN 0x0 0x1 ACK   0x32 0x9 0x4 0x0 0x0 0x1 0x9 0x0
2.27110087 IN 0x0 0x1 ACK   0x0 0x2 0x7 0x5 0x81 0x3 0x1 0x0
2.2711147 IN 0x0 0x1 ACK   0x18
2.27117367 SETUP 0x0 0x1 ACK [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0
2.37203627 SETUP 0x0 0x1 ACK [RT:0xa0 R:0x6 V:0x2900 I:0x0 L:0xa] 0xa0 0x6 0x0 0x29 0x0 0x0 0xa 0x0
2.37304568 IN 0x0 0x1 ACK   0x9 0x29 0x3 0xd 0x0 0x16 0x64 0x2
2.3730596 IN 0x0 0x1 ACK   0xff
2.37311192 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: POWER I:0x1 L:0x0] 0x23 0x3 0x8 0x0 0x1 0x0 0x0 0x0
2.3740727 SETUP 0x0 0x1 ACK [HUB Set port:0x2 Feature: POWER I:0x2 L:0x0] 0x23 0x3 0x8 0x0 0x2 0x0 0x0 0x0
2.3750771 SETUP 0x0 0x1 ACK [HUB Set port:0x3 Feature: POWER I:0x3 L:0x0] 0x23 0x3 0x8 0x0 0x3 0x0 0x0 0x0
2.42101966 IN 0x1 0x1 ACK   0x2
2.4210474 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.42203267 IN 0x0 0x1 ACK   0x1 0x3 0x1 0x0
2.42208756 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_CONNECTION I:0x1 L:0x0] 0x23 0x1 0x10 0x0 0x1 0x0 0x0 0x0
2.43301733 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.43402719 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.44402957 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.44502253 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.45501521 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.45602192 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.46600703 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.46701612 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.47701286 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.47801588 IN 0x0 0x1 ACK   0x1 0x3 0x0 0x0
2.47807272 SETUP 0x0 0x1 ACK [HUB Clear port:0x1 Feature: C_CONNECTION I:0x1 L:0x0] 0x23 0x1 0x10 0x0 0x1 0x0 0x0 0x0
2.47904072 SETUP 0x0 0x1 ACK [HUB Get Port:0x2 status I:0x2 L:0x4] 0xa3 0x0 0x0 0x0 0x2 0x0 0x4 0x0
2.480014 IN 0x0 0x1 ACK   0x0 0x1 0x0 0x0
2.48006916 SETUP 0x0 0x1 ACK [HUB Get Port:0x3 status I:0x3 L:0x4] 0xa3 0x0 0x0 0x0 0x3 0x0 0x4 0x0
2.48101264 IN 0x0 0x1 ACK   0x0 0x1 0x0 0x0
2.58099108 SETUP 0x0 0x1 ACK [HUB Set port:0x1 Feature: RESET I:0x1 L:0x0] 0x23 0x3 0x4 0x0 0x1 0x0 0x0 0x0
2.58202987 SETUP 0x0 0x1 ACK [HUB Get Port:0x1 status I:0x1 L:0x4] 0xa3 0x0 0x0 0x0 0x1 0x0 0x4 0x0
2.58299886 IN 0x0 0x1 ACK   0x11 0x3 0x0 0x0
2.68296388 SETUP 0x0 0x0 ACK [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
2.68397209 IN 0x0 0x0 ACK   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8
2.68417068 SETUP 0x0 0x0 ACK SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x2 0x0 0x0 0x0 0x0 0x0

I think you might well be right about timing, I have noticed printfs changing things.

So with the GIGA stuff, the last set_address is failing, and that's the device?

@AndrewCapon
Copy link
Contributor Author

Also I'm having a GIGA/USB free Christmas now for a few days :)

So you guys have a really nice Christmas, maybe Santa will bring us some working USB code, I did send a letter to him.

All the best

Andy

@mjs513
Copy link

mjs513 commented Dec 23, 2023

Merry Christmas Andrew - enjoy the time

First set ARC_HID_DESCRIPTOR to 1 and try again.

Works

Uncomment line 28 : //#define MAX_TD_PER_ENDPOINT (2)

Works.

PS tested with the DS4 Clone and it works as well. Since I like punisment also tried with the SpaceNavCompact and it worked as well.

Out of curiosity tested with this config

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)
#define ARC_HID_DESCRIPTOR (1)

/*
* Maximum number of transfer descriptors that can be allocated
*/
#define MAX_TD_PER_ENDPOINT         (2)

360w: WORKS
SpaceNav: Works
DS4clone: Works

@AndrewCapon
Copy link
Contributor Author

Happy new year guys.

Out of curiosity tested with this config

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)
#define ARC_HID_DESCRIPTOR (1)

/*
* Maximum number of transfer descriptors that can be allocated
*/
#define MAX_TD_PER_ENDPOINT         (2)

360w: WORKS SpaceNav: Works DS4clone: Works

Well that makes no sense to me at all :)

With those settings it should have been the same as before, the only difference is that Kurts debug messages are there now. I wonder if it is a timing issue.

Does it work if you turn the USB debug messages off?

@mjs513
Copy link

mjs513 commented Jan 5, 2024

Happy New Year Andrew -

Anyway will try testing again later today - still early here and just having 1st cup coffee. Not to fear will get back to it soon :)

@mjs513
Copy link

mjs513 commented Jan 5, 2024

Hi Andrew and Kurt
Did some more testing with debug completely off

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)
#define ARC_HID_DESCRIPTOR (0)

the one joystick (Ds4 clone) would not enumerate

With this

#define ARC_USB_FULL_SIZE (0)
#define ARC_FS_OVER_HS (1)
#define ARC_NO_RESUBMITREQUEST (0)
#define ARC_HID_DESCRIPTOR (1)

I get the ds4 clone working again.

One note is that the spacenav mouse and logitech joysticks don't seem to work from the hub but does work if plugged directly into the usbhost port on the giga.

@KurtE
Copy link
Contributor

KurtE commented Jan 5, 2024

Happy new year all...

Sorry taking things slowly right now.

Debug messages: Locally I changed the printing of the detailed stuff to debug level > 4 to reduce it: like:

void USBHostHub::setPortFeature(uint32_t feature, uint8_t port)
{
    USB_DBG("Set port %u feature: %lx", port, feature);
    #if (DEBUG > 4)
    switch (feature) {
        //case HUB_FEATURE::C_HUB_LOCAL_POWER: USB_DBG("  C_HUB_LOCAL_POWER"); break;
        //case HUB_FEATURE::C_HUB_OVER_CURRENT: USB_DBG("  C_HUB_OVER_CURRENT"); break;
        case HUB_FEATURE::PORT_CONNECTION: USB_DBG("  PORT_CONNECTION"); break;
        case HUB_FEATURE::PORT_ENABLE: USB_DBG("  PORT_ENABLE"); break;
        case HUB_FEATURE::PORT_SUSPEND: USB_DBG("  PORT_SUSPEND"); break;
        case HUB_FEATURE::PORT_OVER_CURRENT: USB_DBG("  PORT_OVER_CURRENT"); break;
        case HUB_FEATURE::PORT_RESET: USB_DBG("  PORT_RESET"); break;
        case HUB_FEATURE::PORT_POWER: USB_DBG("  PORT_POWER"); break;
        case HUB_FEATURE::PORT_LOW_SPEED: USB_DBG("  PORT_LOW_SPEED"); break;
        case HUB_FEATURE::C_PORT_CONNECTION: USB_DBG("  C_PORT_CONNECTION"); break;
        case HUB_FEATURE::C_PORT_ENABLE: USB_DBG("  C_PORT_ENABLE"); break;
        case HUB_FEATURE::C_PORT_SUSPEND: USB_DBG("  C_PORT_SUSPEND"); break;
        case HUB_FEATURE::C_PORT_OVER_CURRENT: USB_DBG("  C_PORT_OVER_CURRENT"); break;
        case HUB_FEATURE::C_PORT_RESET: USB_DBG("  C_PORT_RESET"); break;
        case HUB_FEATURE::PORT_TEST: USB_DBG("  PORT_TEST"); break;
        case HUB_FEATURE::PORT_INDICATOR: USB_DBG("  PORT_INDICATOR"); break;
        default: USB_DBG("  <UNKNOWN>"); break;    
    }
    #endif

Locally my hub code is probably completely busted... At least it still does not like my keyboard...

Finding issues, where debug output looked like jiberish, but I believe is two different places output to debug at same time. Not sure if ISR and Thread or two threads... But I think that is a clue to some of the underlying issues.

That is some of the code is run from the USBHostHub::rxHandler()
and some which the rxHandler when it calls:
host->deviceConnected(dev->getHub() + 1, port, status & HUB_PORTSTATUS::ST_PORT_LOW_SPEED, this);
puts into mailbox... and the code that pulls it out of the mailbox, then calls
USBHostHub::portReset(uint8_t port)
From the USB thread context...

I think there could be confusion going on, And one undoing or trying to redo what the other one is...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants