Skip to content

GIGA R1: devices such as FTDI adapters with control endpoint transfer size=8 reading device descriptor does not work #32

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

Open
KurtE opened this issue Oct 30, 2023 · 64 comments

Comments

@KurtE
Copy link
Contributor

KurtE commented Oct 30, 2023

As I have mentioned on the forum:
https://forum.arduino.cc/t/can-not-find-examples-for-usbhostserial/1182486/17
I am trying to hack up some code similar to the USBHostSerial code that works with other USB to Serial adapters other than those which are CDC ACM devices. Ones like FTDI, Prolific...

On the forum thread: I posted an example sketch which reproduces this, but just about any sketch that will print out the
wrong IDS. VID: 0103 PID: 0000

Where other code bases on some other Arduinos, plus Windows and Ubuntu return the IDs:
vid=403 pid=6001

Note: I just tried plugging it in to the GIGA board, with my Logic Analyzer hooked up to it, with my modified USB Analyzer and HLA, which helps reduce the data down...

The Packets that I received on the GIGA:

16.308830162 ; SETUP ; 0x0 ; 0x0 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
16.308907428 ; IN ; 0x0 ; 0x0 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
16.308963208 ; SETUP ; 0x0 ; 0x0 ; SET_ADDRESS I:0x0 L:0x0] ;  0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
16.317414284 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
16.317496376 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
20.478046968 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
20.478125602 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
20.478314948 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x4 0x1 0x60 0x0 0x6 0x1 0x2
20.478336022 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x1
20.502892408 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] ;  0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
20.503027744 ; IN ; 0x0 ; 0x1 ;  ;  0x9 0x2 0x20 0x0 0x1 0x1 0x0 0xa0
20.50305689 ; IN ; 0x0 ; 0x1 ;  ;  0x2d
20.510192198 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x20] ;  0x80 0x6 0x0 0x2 0x0 0x0 0x20 0x0
20.510326864 ; IN ; 0x0 ; 0x1 ;  ;  0x9 0x2 0x20 0x0 0x1 0x1 0x0 0xa0
20.510358858 ; IN ; 0x0 ; 0x1 ;  ;  0x2d 0x9 0x4 0x0 0x0 0x2 0xff 0xff
20.510387752 ; IN ; 0x0 ; 0x1 ;  ;  0xff 0x2 0x7 0x5 0x81 0x2 0x40 0x0
20.510416558 ; IN ; 0x0 ; 0x1 ;  ;  0x0 0x7 0x5 0x2 0x2 0x40 0x0 0x0

I don't have time today, but it almost looks like the device is still only returning a max of something like 8 bytes at a time...
And You are probably indexing off the end of the data, and maybe not waiting for the additional data packets to be returned.

If I remember correctly on the Teensy USBHost code, we first asked for the device descriptor, for its first 8 bytes, and then update the control endpoint to the size specified in those first 8 bytes and then asked for the whole endpoint...

@AndrewCapon
Copy link
Contributor

Are you using the most recent version from GitHub?

I had this 8 byte issue before, pretty sure using the version from GitHub fixed this.

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Oct 30, 2023

I think the last setSizeControlEndpoint was not there before:

                            devices[i].setSizeControlEndpoint(8);

                            devices[i].activeAddress(false);

                            // get first 8 bit of device descriptor
                            // and check if we deal with a hub
                            USB_DBG("usb_thread read device descriptor on dev: %p\r\n", &devices[i]);
                            res = getDeviceDescriptor(&devices[i], buf, 8);

                            if (res != USB_TYPE_OK) {
                                USB_ERR("usb_thread could not read dev descr");
                                continue;
                            }

                            // set size of control endpoint
                            devices[i].setSizeControlEndpoint(buf[7]);

Without that last setSizeControlEndpoint the size sticks at 8 when the enumerate code is run.

@AndrewCapon
Copy link
Contributor

Actually I think I'm wrong, I have been testing loads of midi devices and one of them returns the size requested in buf[7], so 8.

using instead:

devices[i].setSizeControlEndpoint(64);

And this device then enumerates.

@AndrewCapon
Copy link
Contributor

Incorrectly it seems, ignore me!

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Oct 30, 2023

Right, I think this is related to : #31 (with 8 bytes instead of 64)

The device I have here wants to deal with 8 byte packets, I guess the same as your one.

So when it tries to get the full 18 bytes to get the VID and PID, this going to require 3 packets.

The existing code should request these three packets but it doesn't work for me here:

        if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) {
            switch (urb_state) {
                case URB_DONE:
#if defined(MAX_NOTREADY_RETRY)
                    td->retry = 0;
#endif
                    if (td->size >  max_size) {
                        /*  enqueue  another request */
                        td->currBufPtr += max_size;
                        td->size -= max_size;
                        length = td->size <= max_size ? td->size : max_size;
                        HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
                        HAL_HCD_EnableInt(hhcd, chnum);
                        return;
                    }
                    break;
                case  URB_NOTREADY:
#if defined(MAX_NOTREADY_RETRY)
                    if (td->retry < MAX_NOTREADY_RETRY) {
                        td->retry++;
#endif
                        // Submit the same request again, because the device wasn't ready to accept the last one
                        length = td->size <= max_size ? td->size : max_size;
                        HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
                        HAL_HCD_EnableInt(hhcd, chnum);
                        return;

                        return;
#if defined(MAX_NOTREADY_RETRY)
                    } else {
                        // MAX_NOTREADY_RETRY reached, so stop trying to resend and instead wait for a timeout at a higher layer
                    }
#endif
                    break;
            }
        }
Screenshot 2023-10-30 at 11 36 36

for status : 0 = URB_IDLE, 1=URB_DONE, 2 = URB_NOTREADY

So you can see the first URB_DONE, then the code requests another 8 byte packet, we get two URB_IDLE then multiple URB_NOTREADY where the code keeps retrying the last 8 bytes.

May be different there but that's what I'm seeing here.

@AndrewCapon
Copy link
Contributor

I just tried a prolific one I have here but it works, it is using 64 byte packets though.

@KurtE
Copy link
Contributor Author

KurtE commented Oct 30, 2023

I am running version 0.2.0 - and I don't see any other changes since then. Mine is slightly mucked up for debug, plus maybe forced to not simple callbacks...

Looking at the data from Logic Analyzer:

20.478046968 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
20.478125602 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
20.478314948 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x4 0x1 0x60 0x0 0x6 0x1 0x2
20.478336022 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x1

The line:
devices[i].setSizeControlEndpoint(buf[7]);
Set the size to 8 Valid sizes are ( 8, 16, 32, 64). Wonder if your other devices have larger values...
When it asked for 0x12 (18) bytes it did properly return 3 packets.
Combining them we have:

 0        1      2    3    4    5    6    7     8     9    10   11    12   13  14   15  16   17 
0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8 0x3 0x4 0x1 0x60 0x0 0x6 0x1 0x2 0x3 0x1

So ID vendor(bytes 8-9): 0x403 and Product: 0x601

But it returned vid 0x103... Maybe like it skipped the middle packet. Maybe assuming end point size of 16?

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Oct 30, 2023

Is the device you are having trouble with returning 8 in buf[7]?

What I was seeing with midi devices was that I was never getting > 64 bytes returned, so just a single packet. I was not seeing what you are seeing there with multiple packets with the existing code. They all had 64 byte packets.

@KurtE
Copy link
Contributor Author

KurtE commented Oct 30, 2023

Yes it is returning 0x8 in buf[7]

Where as the PL2303 device the USB data looks like:

14.689485844 ; SETUP ; 0x0 ; 0x0 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
14.689516876 ; IN ; 0x0 ; 0x0 ;  ;  0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x40
14.689572596 ; SETUP ; 0x0 ; 0x0 ; SET_ADDRESS I:0x0 L:0x0] ;  0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
14.691096216 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
14.691125776 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x40
17.252858628 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
17.252888864 ; IN ; 0x0 ; 0x1 ; SET_PROTOCOL(0x0xb) ;  0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x40 0x7b 0x6 0x3 0x23 0x0 0x4 0x1 0x2 0x0 0x1
17.253834594 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] ;  0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
17.253865 ; IN ; 0x0 ; 0x1 ; 0x32(0x0x2) ;  0x9 0x2 0x27 0x0 0x1 0x1 0x0 0x80 0x32
17.254269648 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x27] ;  0x80 0x6 0x0 0x2 0x0 0x0 0x27 0x0
17.254299062 ; IN ; 0x0 ; 0x1 ; 0x32(0x0x2) ;  0x9 0x2 0x27 0x0 0x1 0x1 0x0 0x80 0x32 0x9 0x4 0x0 0x0 0x3 0xff 0x0 0x0 0x0 0x7 0x5 0x81 0x3 0xa 0x0 0x1 0x7 0x5 0x2 0x2 0x40 0x0 0x0 0x7 0x5 0x83 0x2 0x40 0x0 0x0
17.258187612 ; SETUP ; 0x0 ; 0x1 ; [SET_CONFIGURATION I:0x0 L:0x0] ;  0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0

So it has 64 byte control packets. And retrieved the proper VID/PID...

Before it crashes... Currently in the Red blink...
But that is a different issue...

@AndrewCapon
Copy link
Contributor

So with 64 byte packets here with the existing code the issue I was seeing was when the configuration data was > 64 bytes, only 64 bytes were ever returned.

Changing to using HAL_HCD_HC_SubmitRequest() to request the full amount of data, say 101 bytes then fixed this issue for me. Which is what I was going on about in the other issue.

I now have a midi device that only uses 8 byte packets, this is not working correctly at all HAL_HCD_HC_SubmitRequest() is not returning all the data with an 8 byte packet. Interestingly if I set the packet size to 64 and then request 8 times more data I get the 64 byte packets with the correct 8 bytes at the beginning of each.

At the moment for me here I'm wondering about an underlying HAL issue with 8 byte packets.

@KurtE
Copy link
Contributor Author

KurtE commented Oct 30, 2023

Could be HAL or their library, not sure where the code is that detects that requested data exceeded the size of a packet, and then requests or waits for the right number of data packets to come back in this case and pack the data into the correct buffer...

Let alone what is there any support anywhere in this library and/or HAL when I plug in a high speed device who typically might send 512 byte packets, although I think the control endpoint stays at max 64 byte...

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Oct 30, 2023

The code as it is is using the code I posted above to split the packets, this code is in this repository. So they never call HAL_HCD_HC_SubmitRequest() with greater than the packet size, they do all the work here.

This is the code I was pretty sure is not working, so I changed it to let HAL_HCD_HC_SubmitRequest() split the packets as it already does this for you and this solved my issues with 64 byte packets and everything now works. You can see what I did in the PR in the other issue: #33

Unfortunately HAL_HCD_HC_SubmitRequest() doesn't seem to be working with 8 byte packets, the top level code looks fine it is requesting the correct number of packets, something is going wrong though.

I hate USB stuff!

@AndrewCapon
Copy link
Contributor

Concerning packet sizes but from the device side I also found this one: arduino/ArduinoCore-mbed#736

@KurtE KurtE changed the title GIGA R1: FTDI adapters do not return the correct Vendor and Product IDs GIGA R1: devices such as FTDI adapters with control endpoint transfer size=8 reading device descriptor does not work Nov 1, 2023
@KurtE
Copy link
Contributor Author

KurtE commented Nov 1, 2023

@alrvid - Not sure if you are the main person on this library?

@AndrewCapon - I am guessing that the code is losing packets.

Note: I renamed the issue as I believe it is not specific to FTDI. I am also not sure how specific this is to reading the device descriptor, or if it might manifest issues, whenever a response to a request might span multiple USB packets. Or potentially if the device might generate a burst of data.

More specifics about this manifestation:
When I plug in an FTDI adapter, The code does not properly return the 18 bytes of the device descriptor:
I know that the device is sending the 18 bytes, in three input packets:

The USB analyzer code I have running on my Saleae Logic Analyzer shows that:

1.979299366 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
1.9867984699999999 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
1.9869933480000002 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x4 0x1 0x60 0x0 0x6 0x1 0x2
1.987014406 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x1

image

Probably does not show it very well, but there is about 8ms from the time of the request to the response. You can see this by the areas of blue at the top which is from the HLA analyzer showing the packet data. Zooming in on the 3 packet area:
image
You can see they are clumped pretty close together, especially the 2nd two.

Looking at debug output

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1216]SETUP PACKET: 
80 6 0 1 0 0 12 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1244]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1273]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1281]CONTROL READ SUCCESS [16 bytes transferred]
12 01 00 02 00 00 00 08 03 01 00 00 00 00 00 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1314]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:957]DEVICE DESCRIPTOR(18):

12 01 00 02 00 00 00 08 03 01 00 00 00 00 00 00 00 00 

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:969]CLASS: 00 	 VID: 0103 	 PID: 0000
[USB_INFO: c:\Users\kurte\Documents\Arduino\libraries\GIGA_USBHostMBed5_devices\src\USBHostSerialDevice.cpp:165]VID: 103, PID: 0

You can see it completely missed the data of the 2nd IN packet. And in fact used the first two bytes of the 3rd packet and assumed it received 8 bytes. i.e. it did not look at the actual size of data in the IN packet.

Interesting that the USBHost::getDeviceDescriptor call has parameter to return the size of data returned, the return value actually just returns the size of data requested (or size of a device descriptor)....
So it prints out now 18 bytes....

As a test, I tried hacking the 2nd request to get the descriptor from asking for 18 bytes and instead only ask for 16. And it returned all 0s after the first 8 bytes... Again, it lost the 2nd packet.

Guessing: that maybe you don't have a request queued up in time to receive the 2nd part of the data.

Sorry, I don't know enough about this board, to understand it's lower level mechanisms on queueing up requests. On some other systems, I believe there are ways to queue up multiple requests, such that when the hardware fills one, it is setup to handle the next, not sure if that is possible here or not.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 1, 2023

It also appears to be failing with CH340G like devices such as:
https://www.sparkfun.com/products/15096

5.923490414 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
5.923526774 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x10 0x1 0xff 0x0 0x0 0x8
5.923555124 ; IN ; 0x0 ; 0x1 ;  ;  0x86 0x1a 0x23 0x75 0x54 0x2 0x0 0x2
5.92357572 ; IN ; 0x0 ; 0x1 ;  ;  0x0 0x1

Comes back
12 01 10 01 FF 00 00 08 00 01 00 00 00 00 00 00 00 00
Instead of what it should be:
12 01 10 01 ff 00 00 08 86 1a 23 75 54 02 00 02 00 01

@AndrewCapon
Copy link
Contributor

Hi @KurtE ,

From my fumblings I have noticed lengths reported and number of bytes logged in the USB debug messages cannot be trusted!

I am sadly lacking a USB analyser, I do have a Saleae clone though, it is only 400mhz though. What is yours?

I am looking into the USB_NOTREADY/NAK thing, I am guessing the issue may be originating here. What I don't understand though is that devices should not NAK on Setup messages, so we should never see NAKs when getting the device description (but I am here). Is this your understanding as well?

@KurtE
Copy link
Contributor Author

KurtE commented Nov 2, 2023

Morning @AndrewCapon,

I also don't have a full USB analyzer. Like a Beagle 12 (about $500) or 480 (about $1300 and up), which would be great for analyzing this stuff.

I do however have a few Saleae logic analyzers. The main one I use is their Pro 8. Which has gone up in price a lot since I purchased it... You can still get the non-pro 8 as a student or as a hobbyist for about $250.

They come with a USB analyzer setup for LS and FS (but can not handle HS). They have not yet updated it to support their newer High Level analyzer stuff, so I took a stab at it, which is working reasonably well for me.,,,

Note: I was hoping that your stuff in your PR #33 would help with the stuff I am seeing.

So far still no luck. Will double check I put in the change correctly. So far still not getting the configuration descriptor for some of these boards... Will double check I have it in the same way you do.

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 2, 2023

Afternoon @KurtE

Have you got a little breakout board for the usb signals then?

PR 33 would help I'm guessing with 64 byte packets because that works here, it doesn't work with 8 byte packets here though, I'm trying to get to the bottom of it. Unfortunately I have messed my back up so can't sit at the desk so am trying to use an old laptop with Remote Desktop so the going is slow :)

Basically what I am seeing is loads of NAKs, I can re-add in the code to handle NAKs (retransmit) which then means the descriptors work but it then goes wonky elsewhere.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 2, 2023

Sorry about your back...
image
Also my setup is sort of a mess, but on this board, I simply use a couple of the test clips (that came with the LAs) https://usd.saleae.com/collections/accessories/products/test-clips-93

The center two pins are the D+ and D-...

On my own boards, like the one in the picture (Micromod Teensy), I added breakout pins which are the two on the left of the USB Host connector, for those signals to make it easy.

I will try a bit more with your changes to see what is happening.

This code looks considerably different than the code USBHostGiga, So I might try a few more things out on that library to see how it differs on handling the packets.

I don't understand why the released code, Tries to restrict the request down to one packet and then try to start up new request for next packet... I could be completely wrong, but I believe that the Channels on these boards are setup to handle transfers > packet_size... That is the OTG_HCTSIZx registers, look like they have fields for Transfer size, and then the 19 bits, then a packet count 10 bits.

So I would think it should just handle it.

I believe that it funnels down to HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc, uint8_t dma)

which does:

  if (hc->xfer_len > 0U)
  {
    num_packets = (uint16_t)((hc->xfer_len + hc->max_packet - 1U) / hc->max_packet);

    if (num_packets > max_hc_pkt_count)
    {
      num_packets = max_hc_pkt_count;
      hc->XferSize = (uint32_t)num_packets * hc->max_packet;
    }
  }

So wondering if I am reading the stuff wrong, or there were problems with it or ???

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 2, 2023

The STM HAL stuff does handle multiple packets, the PR 33 I put in changes the "MBED" code to use this functionality.

The existing MBED code does not though, the MBED code is never requesting more than one packet at a time, they do the handling of multiple packets themselves.

If you look at the code I removed:

       if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) {
            switch (urb_state) {
                case URB_DONE:
#if defined(MAX_NOTREADY_RETRY)
                    td->retry = 0;
#endif
                    if (td->size >  max_size) {
                        /*  enqueue  another request */
                        td->currBufPtr += max_size;
                        td->size -= max_size;
                        length = td->size <= max_size ? td->size : max_size;
                        HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
                        HAL_HCD_EnableInt(hhcd, chnum);
                        return;
                    }
                    break;
                case  URB_NOTREADY:
#if defined(MAX_NOTREADY_RETRY)
                    if (td->retry < MAX_NOTREADY_RETRY) {
                        td->retry++;
#endif
                        // Submit the same request again, because the device wasn't ready to accept the last one
                        length = td->size <= max_size ? td->size : max_size;
                        HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
                        HAL_HCD_EnableInt(hhcd, chnum);
                        return;

                        return;
#if defined(MAX_NOTREADY_RETRY)
                    } else {
                        // MAX_NOTREADY_RETRY reached, so stop trying to resend and instead wait for a timeout at a higher layer
                    }
#endif
                    break;
            }
        }
#endif

On a URB_DONE they (MBED) transmit the next packet, until all packets are done. they are doing this via td

They also handle the NAK (URB_NOTREADY) and re transmit the last packet.

This is the code that I did not think was working , so the PR33 stops the MBED code doing this packet splitting and lets the underlying STM HAL code do it. (partly with the code bit you just posted)

This PR 33 fixed all my problems for 64 byte packets.

But it is not working with 8 byte packets here.

@AndrewCapon
Copy link
Contributor

Also of course our 8 byte issues may be different :) Mine seem to be based on NAKs.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 2, 2023

Thanks, as I mentioned, I think I brought in your changes... But might have messed up some... I also just now synced up the current GITHUB code changes, and then did a Winmerge to the one in libraries folder. Will try again.

My gut tells me that a lot of these NAKs and data lost with current code is due to them doing the one packet at a time. An in between the time they process the one packet and issue new request for the next one, it may have lost one or more packets and then things get confused.

@AndrewCapon
Copy link
Contributor

Yes I think there is definitely a disconnect there, that code gets called every 20us. For the NAKs the existing code is terribly wrong it just spams the HAL submitrequest.

but the bad news, even with letting the HAL deal with the full size and some more common sense NAK code (retry, wait 10 ms before another retry) I’m still getting missed data, and I’m guessing it is the data at the start. Need to check.

I have dealt with the stm32 HAL device code before and that was pretty strange, maybe the host side us similar :)

thanks for the pic about how you gave the usb connected, I would not gave thought of doing that!

@KurtE
Copy link
Contributor Author

KurtE commented Nov 3, 2023

@AndrewCapon, For some reason, I did some more editing of my copy of the library with your changes. And AFAIK, I did not change anything related to these changes, but now in several cases it is now reading in the FTDI device descriptor (8 byte control endpoint)... Also was able to read some Teensy boards configuration descriptors, which was failing.

It is still failing to read in the Arduino UNO R4 MINIMA, will investigate this some more... Maybe tomorrow or the next day or so.

I am now curious, about when it connected up to the Teensy Micromod, I think it connected at USB FS (64 byte packets). The Teensy also support HS (512 byte packets). I think the USB on these STM boards support HS? Wondering if the library supports it... Maybe time to investigate.

@AndrewCapon
Copy link
Contributor

Morning @KurtE

I have made a change that may be useful, I won't add it to the PR as I have loads of hacked stuff I am working on.

in USBHALHost_STM.cpp change the line 108 from

#if !ARC_USB_FULL_SIZE

to

#if ARC_USB_FULL_SIZE

        if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) 
        {
          static uint32_t uRetry = 0;
          if(urb_state == URB_NOTREADY)
          {
            if(uRetry == 0)
            {
              // Submit the same request again, because the device wasn't ready to accept the last one
              // should use a proper timer here but as we seem to be called every 20us just use that
              // to only re-request every 10ms
              length = td->size;
              HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
              HAL_HCD_EnableInt(hhcd, chnum);
              uRetry = 500;
            }
            else
              uRetry--;
          }
          else
            uRetry = 0;
        }
#else

This should help with any NAKs which the underlying HAL code doesn't handle itself.

With the problem device I have here though I am still getting missed data even though all the data is being received into the USB fifo it is not ending up in the correct place, will be looking into this today. I'm getting close I think!

@AndrewCapon
Copy link
Contributor

So some success:

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1215]SETUP PACKET: 
80 6 0 1 0 0 12 0 
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1244]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1274]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1282]CONTROL READ SUCCESS [18 bytes transferred]
12 01 10 01 00 00 00 08 56 22 10 20 00 00 01 02 00 01 

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1315]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:966]CLASS: 00         VID: 2256       PID: 2010
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1197]----- CONTROL READ [dev: 0x2401078c - hub: 0 - port: 1] ------
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1211]Control transfer on device: 1

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1215]SETUP PACKET: 
80 6 0 2 0 0 9 0 
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1244]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1274]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1282]CONTROL READ SUCCESS [9 bytes transferred]
09 02 65 00 02 01 00 C0 32 

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1315]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:882]TOTAL_LENGTH: 101         NUM_INTERF: 2
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1197]----- CONTROL READ [dev: 0x2401078c - hub: 0 - port: 1] ------
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1211]Control transfer on device: 1

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1215]SETUP PACKET: 
80 6 0 2 0 0 65 0 
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1244]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1274]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1282]CONTROL READ SUCCESS [101 bytes transferred]
09 02 65 00 02 01 00 C0 32 09 04 00 00 00 01 01 00 00 09 24 01 00 01 09 00 01 01 09 04 01 00 02 01 03 00 00 07 24 01 00 01 41 00 06 24 02 01 01 00 06 24 02 02 02 00 09 24 03 01 03 01 02 01 00 09 24 03 02 04 01 01 01 00 09 05 01 02 40 00 00 00 00 05 25 01 01 01 09 05 82 02 40 00 00 00 00 05 25 01 01 03 

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1315]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:978]CONFIGURATION DESCRIPTOR:

09 02 65 00 02 01 00 C0 32 09 04 00 00 00 01 01 00 00 09 24 01 00 01 09 00 01 01 09 04 01 00 02 01 03 00 00 07 24 01 00 01 41 00 06 24 02 01 01 00 06 24 02 02 02 00 09 24 03 01 03 01 02 01 00 09 24 03 02 04 01 01 01 00 09 05 01 02 40 00 00 00 00 05 25 01 01 01 09 05 82 02 40 00 00 00 00 05 25 01 01 03 

[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1030]dev: 0x2401078c has 2 intf
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1039]ADD INTF 1 on device 0x2401078c: class: 1, subclass: 3, proto: 0
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:614]USBEndpoint created (0x2401017c): type: 2, dir: 1, size: 64, addr: 1, state: USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1058]ADD USBEndpoint 0x2401017c, on interf 1 on device 0x2401078c
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:614]USBEndpoint created (0x24010214): type: 2, dir: 2, size: 64, addr: 2, state: USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1058]ADD USBEndpoint 0x24010214, on interf 1 on device 0x2401078c
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:991]Set configuration 1 on dev: 0x2401078c
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1197]----- CONTROL WRITE [dev: 0x2401078c - hub: 0 - port: 1] ------
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1211]Control transfer on device: 1

[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1215]SETUP PACKET: 
0 9 1 0 0 0 0 0 
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1244]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1315]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1004]dev 0x2401078c is enumerated

[USB_INFO: lib/Arduino_USBHostMbed5/src/USBHostMIDI/USBHostMIDI.cpp:70]New MIDI device: VID:2256 PID:2010 [dev: 0x2401078c - intf: 1]
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.h:170]register driver for dev: 0x2401078c on intf: 1
[USB_TRANSFER: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1108]----- BULK READ [dev: 0x2401078c - MIDI - hub: 0 - port: 1 - addr: 1 - ep: 82]------

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 4, 2023

I am thinking though that this is more luck than judgement, I think there is another timing issue I have not quite got yet.

here is the code to use rather than the previously posted code, it might help.

I'm still investigating what exactly is going on though because this still failed sometimes. (don't worry about the recount bit not doing anything, still using that to investigate and it may well go in the end)

#if ARC_USB_FULL_SIZE

        if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) 
        {
          static constexpr uint32_t uPreCount = 1;
          static constexpr uint32_t uPostCount = 500;
          
          static uint32_t uNotReadyCount = 0;
          
          if(urb_state == URB_NOTREADY)
          {
            volatile uint32_t transferred = HAL_HCD_HC_GetXferCount(hhcd, chnum);


            uNotReadyCount++;

            if(uNotReadyCount == uPreCount)
            {
              // Submit the same request again, because the device wasn't ready to accept the last one
              // we need to be aware of any data that has already been transferred as it wont be again by the look of it.
              td->currBufPtr += transferred;
              td->size -= transferred;
              length = td->size;
              HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
              HAL_HCD_EnableInt(hhcd, chnum);
            }
            else if (uNotReadyCount == uPostCount)
              uNotReadyCount = 0;
          }
          else
            uNotReadyCount = 0;
        }
#else

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 4, 2023

Ok a slight rethink, this code works with all the midi devices I have just tried. (Disconnect and reconnect seems buggy but I'm guessing that is something unrelated)

The other devices even though they are 64 byte bulk packets were actually still using 8 byte control packets, the difference is they do not need the re-request from the NAKs, everything is handled correctly by the HAL. Doing the re-request confused the HAL.

So we have one that needs the re-request and others that don't.

The new Idea is that we basically ignore NAK/URB_NOTREADY for 10ms after any USB_TYPE_IDLE (this is on the transfer descriptor (td)).

If we are still getting them after 10ms we resend the request.

void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum, HCD_URBStateTypeDef urb_state)
{
    USBHALHost_Private_t *priv = (USBHALHost_Private_t *)(hhcd->pData);
    USBHALHost *obj = priv->inst;
    void (USBHALHost::*func)(volatile uint32_t addr) = priv->transferCompleted;

    uint32_t addr = priv->addr[chnum];
    uint32_t max_size = HAL_HCD_HC_GetMaxPacket(hhcd, chnum);
    uint32_t type = HAL_HCD_HC_GetType(hhcd, chnum);
    uint32_t dir = HAL_HCD_HC_GetDirection(hhcd, chnum);
    

    uint32_t length;
    if ((addr != 0)) {
        HCTD *td = (HCTD *)addr;

#if ARC_USB_FULL_SIZE
        constexpr uint32_t uRetryCount = 10000/20; // 10 ms (TODO: should be done with timer, investigate)
        if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) 
        {
          td->retry++;

          if(urb_state == URB_NOTREADY)
          {
            volatile uint32_t transferred = HAL_HCD_HC_GetXferCount(hhcd, chnum);

            if((td->retry > uRetryCount) || (td->size==0))
            {
              // Submit the same request again, because the device wasn't ready to accept the last one
              // we need to be aware of any data that has already been transferred as it wont be again by the look of it.
              // Also only do this once until if (td->state == USB_TYPE_IDLE) resets it below
              td->currBufPtr += transferred;
              td->size -= transferred;
              td->retry = 0;
              length = td->size;

              HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
              HAL_HCD_EnableInt(hhcd, chnum);
            }
          }
        }
#else
        if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) {
            switch (urb_state) {
                case URB_DONE:
#if defined(MAX_NOTREADY_RETRY)
                    td->retry = 0;
#endif
                    if (td->size >  max_size) {
                        /*  enqueue  another request */
                        td->currBufPtr += max_size;
                        td->size -= max_size;
                        length = td->size <= max_size ? td->size : max_size;
                        HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
                        HAL_HCD_EnableInt(hhcd, chnum);
                        return;
                    }
                    break;
                case  URB_NOTREADY:
#if defined(MAX_NOTREADY_RETRY)
                    if (td->retry < MAX_NOTREADY_RETRY) {
                        td->retry++;
#endif
                        // Submit the same request again, because the device wasn't ready to accept the last one
                        length = td->size <= max_size ? td->size : max_size;
                        HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
                        HAL_HCD_EnableInt(hhcd, chnum);
                        return;

                        return;
#if defined(MAX_NOTREADY_RETRY)
                    } else {
                        // MAX_NOTREADY_RETRY reached, so stop trying to resend and instead wait for a timeout at a higher layer
                    }
#endif
                    break;
            }
        }
#endif
        if ((type == EP_TYPE_INTR)) {
            /*  reply a packet of length NULL, this will be analyze in call back
             *  for mouse or hub */
            td->state = USB_TYPE_IDLE ;
            HAL_HCD_DisableInt(hhcd, chnum);

        } else {
            if (urb_state == URB_DONE) {
                td->state = USB_TYPE_IDLE;
            }
            else if (urb_state == URB_ERROR) {
                // While USB_TYPE_ERROR in the endpoint state is used to activate error recovery, this value is actually never used.
                // Going here will lead to a timeout at a higher layer, because of ep_queue.get() timeout, which will activate error
                // recovery indirectly.
                td->state = USB_TYPE_ERROR;
            } else {
                td->state = USB_TYPE_PROCESSING;
            }
        }
        if (td->state == USB_TYPE_IDLE) {
#if ARC_USB_FULL_SIZE
            td->retry = 0;
#endif
            td->currBufPtr += HAL_HCD_HC_GetXferCount(hhcd, chnum);
            (obj->*func)(addr);
        }
    } else {
        if (urb_state != 0) {
            //USB_DBG_EVENT("spurious %d %d", chnum, urb_state);
        }
    }
}

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 4, 2023

Actually seems to work through a hub as well!

As long as you only plug in one device in that is :)

Two devices and red lights of doom, will investigate tomorrow. I need to get hubs working to have multiple controllers...

@KurtE
Copy link
Contributor Author

KurtE commented Nov 7, 2023

@AndrewCapon @mjs513 -
Sorry just tried your latest stuff...

I am getting several warnings, plus an error on the line:
LogicUint7(0x40 + transferred);
LogicUint7 is not defined anywhere...

@AndrewCapon
Copy link
Contributor

Hi @KurtE

Sorry that's some of my test code that I didn't remove, just delete that line.

I will update the PR today.

I have also managed to get multiple devices going, there is an issue with the MBED Hub code though, once a device is connected the HUB code seems to stop working and it doesn't recognise new devices. Will look into that a bit today...

KurtE added a commit to KurtE/Arduino_USBHostMbed5 that referenced this issue Nov 8, 2023
@KurtE
Copy link
Contributor Author

KurtE commented Nov 17, 2023

@AndrewCapon @mjs513 - Not sure if this is best place to mention. I think I still have one problem child with reading in descriptors. In this case it is a HID descriptor for a Wacom tablet. This descriptor is 759 bytes long.

It errors out on the read on the GIGA. I verified it reads fine on Teensy. And the parser there properly decoded it.
On GIGA:



*** starting Device information sketch ***
No USB host device connected
Device:0x2400c72c
VID: 56A, PID: 374

----------------------------------------
Device Descriptor:
  bcdUSB: 512
  bDeviceClass: 0
  bDeviceSubClass: 0
  bDeviceProtocol: 0
  bMaxPacketSize: 64
  idVendor: 0x56a
  idProduct: 0x374
  bcdDevice: 273
  iManufacturer: 1
  iProduct: 2
  iSerialNumber: 3
  bNumConfigurations: 1
Manufacturer: Wacom Co.,Ltd.
Product: Intuos S
Serial Number: 1GE00R2010013
Speed: 0

----------------------------------------
Size of configuration Descriptor: 34
Configuration Descriptor
2400E8E8 - 09 02 22 00 01 01 00 80  FA 09 04 00 00 01 03 00  : .."..... ........
2400E8F8 - 00 00 09 21 10 01 00 01  22 F7 02 07 05 81 03 40  : ...!.... "......@
2400E908 - 00 01                                             : ..
Config:
 wTotalLength: 34
 bNumInterfaces: 1
 bConfigurationValue: 1
 iConfiguration: 0
 bmAttributes: 128
 bMaxPower: 250
****************************************
** Interface level **
  bInterfaceNumber: 0
  bAlternateSetting: 0
  Number of endpoints: 1
  bInterfaceClass: 3
  bInterfaceSubClass: 0
    HID
  bInterfaceProtocol: 0
    None
  iInterface: 0
  HID Descriptor size: 759
  Endpoint: 81 In
    Attrributes: 3 Interrupt
    Size: 64
    Interval: 1
>>>>> USBDumperDevice::getHIDDesc(0) called <<<<< 
*** Failed to read in HID Report Descriptor ***
parseInterface nb:0
 bInterfaceClass = 3
 bInterfaceSubClass = 0
    HID
 bProtocol = 0
    None
useEndpoint(0, 3, 2)
New Debug device: VID:056a PID:0374 [dev: 0x2400c72c - intf: 0]
USB host device(56a:374) connected
Manufacturer: Wacom Co.,Ltd.
Product: Intuos S
Serial Number: 1GE00R2010013

Which failed as mentioned on the line: *** Failed to read in HID Report Descriptor ***

On Teensy Micromod:

USB HID Device Info Program

This Sketch shows information about plugged in HID devices

*** You can control the output by simple character input to Serial ***
R - Turns on or off showing the raw data
C - Toggles showing changed data only on or off
<anything else> - toggles showing the Hid formatted breakdown of the data


USBDeviceInfo claim this=2000CF64

****************************************
** Device Level **
  vid=56A
  pid=374
  bDeviceClass = 0
  bDeviceSubClass = 0
  bDeviceProtocol = 0
09 04 00 00 01 03 00 00 00 09 21 10 01 00 01 22 F7 02 07 05 81 03 40 00 01 

USBDeviceInfo claim this=2000CF64

****************************************
** Interface Level **
09 04 00 00 01 03 00 00 00 09 21 10 01 00 01 22 F7 02 07 05 81 03 40 00 01 
 bInterfaceNumber = 0
 number end points = 1
 bInterfaceClass =    3
 bInterfaceSubClass = 0
    HID
 bInterfaceProtocol = 0
    None
report descriptor size = 759
  endpoint = 81
    attributes = 3 Interrupt
    size = 64
    interval = 1
*** Device HID1 56a:374 - connected ***
  manufacturer: Wacom Co.,Ltd.
  product: Intuos S
  Serial: 1GE00R2010013
HIDDumpController(1 : 0x20004220 : 0x20009680) Claim: 56a:374 usage: ff0d0001 SubClass: 0 Protocol: 0 - Yes

HID Report Descriptor (0x20009a18) size: 759
  06 0D FF	// Usage Page(ff0d) - Digitizer
  09 01	// Usage(1) -
  A1 01	// Collection(1) top Usage(ff0d0000)
    85 10	// Report ID(10)
    09 20	// Usage(20) -
    35 00	// Physical Minimum(0)
    45 00	// Physical Maximum(0)
    15 00	// Logical Minimum(0)
    25 01	// Logical maximum(1)
    A1 00	// Collection(0)
    09 42	// Usage(42) -
    09 44	// Usage(44) -
    09 5A	// Usage(5a) -
    25 01	// Logical maximum(1)
    75 01	// Report Size(1)
    95 03	// Report Count(3)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    95 02	// Report Count(2)
    81 03	// Input(3)	// (Constant, Variable, Absolute)
    09 32	// Usage(32) -
    09 36	// Usage(36) -
    95 02	// Report Count(2)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    95 01	// Report Count(1)
    81 03	// Input(3)	// (Constant, Variable, Absolute)
    0A 30 01	// Usage(130) -
    65 11	// Unit(11)
    55 0D	// Unit Exponent(d)
    47 60 3B 00 00	// Physical Maximum(3b60)
    27 60 3B 00 00	// Logical maximum(3b60)
    75 18	// Report Size(18)
    95 01	// Report Count(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    0A 31 01	// Usage(131) -
    47 1C 25 00 00	// Physical Maximum(251c)
    27 1C 25 00 00	// Logical maximum(251c)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    09 30	// Usage(30) -
    55 00	// Unit Exponent(0)
    65 00	// Unit(0)
    26 FF 0F	// Logical maximum(fff)
    75 10	// Report Size(10)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    75 08	// Report Size(8)
    95 06	// Report Count(6)
    81 03	// Input(3)	// (Constant, Variable, Absolute)
    0A 32 01	// Usage(132) -
    25 3F	// Logical maximum(3f)
    75 08	// Report Size(8)
    95 01	// Report Count(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    09 5B	// Usage(5b) -
    09 5C	// Usage(5c) -
    17 00 00 00 80	// Logical Minimum(80000000)
    27 FF FF FF 7F	// Logical maximum(7fffffff)
    75 20	// Report Size(20)
    95 02	// Report Count(2)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    09 77	// Usage(77) -
    15 00	// Logical Minimum(0)
    26 FF 0F	// Logical maximum(fff)
    75 10	// Report Size(10)
    95 01	// Report Count(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    C0	// End Collection
  85 11	// Report ID(11)
  65 00	// Unit(0)
  55 00	// Unit Exponent(0)
  35 00	// Physical Minimum(0)
  45 00	// Physical Maximum(0)
  09 39	// Usage(39) -
  A1 00	// Collection(0) top Usage(ff0d0039)
    0A 10 09	// Usage(910) -
    0A 11 09	// Usage(911) -
    0A 12 09	// Usage(912) -
    0A 13 09	// Usage(913) -
    15 00	// Logical Minimum(0)
    25 01	// Logical maximum(1)
    75 01	// Report Size(1)
    95 04	// Report Count(4)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    95 04	// Report Count(4)
    81 03	// Input(3)	// (Constant, Variable, Absolute)
    75 08	// Report Size(8)
    95 07	// Report Count(7)
    81 03	// Input(3)	// (Constant, Variable, Absolute)
    C0	// End Collection
  85 13	// Report ID(13)
  65 00	// Unit(0)
  55 00	// Unit Exponent(0)
  35 00	// Physical Minimum(0)
  45 00	// Physical Maximum(0)
  0A 13 10	// Usage(1013) -
  A1 00	// Collection(0) top Usage(ff0d1013)
    0A 3B 04	// Usage(43b) -
    15 00	// Logical Minimum(0)
    25 64	// Logical maximum(64)
    75 07	// Report Size(7)
    95 01	// Report Count(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    0A 04 04	// Usage(404) -
    25 01	// Logical maximum(1)
    75 01	// Report Size(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    09 00	// Usage(0) -
    26 FF 00	// Logical maximum(ff)
    75 08	// Report Size(8)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    75 08	// Report Size(8)
    95 06	// Report Count(6)
    81 03	// Input(3)	// (Constant, Variable, Absolute)
    C0	// End Collection
  09 0E	// Usage(e) -
  A1 02	// Collection(2) top Usage(ff0d0000)
    85 02	// Report ID(2)
    0A 02 10	// Usage(1002) -
    15 01	// Logical Minimum(1)
    25 02	// Logical maximum(2)
    75 08	// Report Size(8)
    95 01	// Report Count(1)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 03	// Report ID(3)
    0A 03 10	// Usage(1003) -
    15 00	// Logical Minimum(0)
    26 FF 00	// Logical maximum(ff)
    95 01	// Report Count(1)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 04	// Report ID(4)
    0A 04 10	// Usage(1004) -
    15 01	// Logical Minimum(1)
    25 01	// Logical maximum(1)
    95 01	// Report Count(1)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 07	// Report ID(7)
    0A 09 10	// Usage(1009) -
    15 00	// Logical Minimum(0)
    26 FF 00	// Logical maximum(ff)
    95 01	// Report Count(1)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    B1 03	// Feature(3)	// (Constant, Variable, Absolute)
    0A 07 10	// Usage(1007) -
    09 00	// Usage(0) -
    27 FF FF 00 00	// Logical maximum(ffff)
    75 10	// Report Size(10)
    95 02	// Report Count(2)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    75 08	// Report Size(8)
    95 09	// Report Count(9)
    B1 03	// Feature(3)	// (Constant, Variable, Absolute)
    85 0C	// Report ID(c)
    0A 30 0D	// Usage(d30) -
    0A 31 0D	// Usage(d31) -
    0A 32 0D	// Usage(d32) -
    0A 33 0D	// Usage(d33) -
    65 11	// Unit(11)
    55 0D	// Unit Exponent(d)
    35 00	// Physical Minimum(0)
    46 C8 00	// Physical Maximum(c8)
    15 00	// Logical Minimum(0)
    26 90 01	// Logical maximum(190)
    75 10	// Report Size(10)
    95 04	// Report Count(4)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 0D	// Report ID(d)
    0A 0D 10	// Usage(100d) -
    65 00	// Unit(0)
    55 00	// Unit Exponent(0)
    45 00	// Physical Maximum(0)
    25 01	// Logical maximum(1)
    75 08	// Report Size(8)
    95 01	// Report Count(1)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 14	// Report ID(14)
    0A 14 10	// Usage(1014) -
    26 FF 00	// Logical maximum(ff)
    95 0D	// Report Count(d)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 CC	// Report ID(cc)
    0A CC 10	// Usage(10cc) -
    95 02	// Report Count(2)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 31	// Report ID(31)
    0A 31 10	// Usage(1031) -
    25 64	// Logical maximum(64)
    95 03	// Report Count(3)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    95 02	// Report Count(2)
    B1 03	// Feature(3)	// (Constant, Variable, Absolute)
    C0	// End Collection
  0A AC 10	// Usage(10ac) -
  A1 02	// Collection(2) top Usage(ff0d10ac)
    15 00	// Logical Minimum(0)
    26 FF 00	// Logical maximum(ff)
    75 08	// Report Size(8)
    85 AC	// Report ID(ac)
    09 00	// Usage(0) -
    96 BF 00	// Report Count(bf)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    85 15	// Report ID(15)
    09 00	// Usage(0) -
    95 0E	// Report Count(e)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 33	// Report ID(33)
    09 00	// Usage(0) -
    95 12	// Report Count(12)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 44	// Report ID(44)
    09 00	// Usage(0) -
    95 04	// Report Count(4)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 45	// Report ID(45)
    09 00	// Usage(0) -
    95 20	// Report Count(20)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 60	// Report ID(60)
    09 00	// Usage(0) -
    95 3F	// Report Count(3f)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 61	// Report ID(61)
    09 00	// Usage(0) -
    95 3E	// Report Count(3e)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 62	// Report ID(62)
    09 00	// Usage(0) -
    95 3E	// Report Count(3e)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 65	// Report ID(65)
    09 00	// Usage(0) -
    95 04	// Report Count(4)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 66	// Report ID(66)
    09 00	// Usage(0) -
    95 04	// Report Count(4)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 67	// Report ID(67)
    09 00	// Usage(0) -
    95 04	// Report Count(4)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 68	// Report ID(68)
    09 00	// Usage(0) -
    95 11	// Report Count(11)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 6F	// Report ID(6f)
    09 00	// Usage(0) -
    95 3E	// Report Count(3e)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 CD	// Report ID(cd)
    09 00	// Usage(0) -
    95 02	// Report Count(2)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 16	// Report ID(16)
    09 00	// Usage(0) -
    95 0E	// Report Count(e)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    85 35	// Report ID(35)
    09 00	// Usage(0) -
    95 0A	// Report Count(a)
    B1 02	// Feature(2)	// (Data, Variable, Absolute)
    C0	// End Collection
  85 D0	// Report ID(d0)
  09 01	// Usage(1) -
  96 08 00	// Report Count(8)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D1	// Report ID(d1)
  09 01	// Usage(1) -
  96 04 01	// Report Count(104)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D2	// Report ID(d2)
  09 01	// Usage(1) -
  96 04 01	// Report Count(104)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D3	// Report ID(d3)
  09 01	// Usage(1) -
  96 04 00	// Report Count(4)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D4	// Report ID(d4)
  09 01	// Usage(1) -
  96 04 00	// Report Count(4)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D5	// Report ID(d5)
  09 01	// Usage(1) -
  96 04 00	// Report Count(4)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D6	// Report ID(d6)
  09 01	// Usage(1) -
  96 04 00	// Report Count(4)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D7	// Report ID(d7)
  09 01	// Usage(1) -
  96 08 00	// Report Count(8)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D8	// Report ID(d8)
  09 01	// Usage(1) -
  96 0C 00	// Report Count(c)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 D9	// Report ID(d9)
  09 01	// Usage(1) -
  96 00 05	// Report Count(500)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 DA	// Report ID(da)
  09 01	// Usage(1) -
  96 04 02	// Report Count(204)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 DB	// Report ID(db)
  09 01	// Usage(1) -
  96 06 00	// Report Count(6)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 DC	// Report ID(dc)
  09 01	// Usage(1) -
  96 02 00	// Report Count(2)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 DD	// Report ID(dd)
  09 01	// Usage(1) -
  96 04 00	// Report Count(4)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 DE	// Report ID(de)
  09 01	// Usage(1) -
  96 04 00	// Report Count(4)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 DF	// Report ID(df)
  09 01	// Usage(1) -
  96 22 00	// Report Count(22)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 E0	// Report ID(e0)
  09 01	// Usage(1) -
  96 01 00	// Report Count(1)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 E1	// Report ID(e1)
  09 01	// Usage(1) -
  96 02 00	// Report Count(2)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 E2	// Report ID(e2)
  09 01	// Usage(1) -
  96 02 00	// Report Count(2)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 E3	// Report ID(e3)
  09 01	// Usage(1) -
  96 02 00	// Report Count(2)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  85 E4	// Report ID(e4)
  09 01	// Usage(1) -
  96 FF 01	// Report Count(1ff)
  B1 02	// Feature(2)	// (Data, Variable, Absolute)
  C0	// End Collection
*** HID Device hdc1 56a: 374 - connected ***
  manufacturer: Wacom Co.,Ltd.
  product: Intuos S
  Serial: 1GE00R2010013

@AndrewCapon
Copy link
Contributor

Hi @KurtE

Can you set the debug fully on in dbg.h:

#define DEBUG 4 /*INFO,ERR,WARN*/
#define DEBUG_TRANSFER 1
#define DEBUG_EP_STATE 1
#define DEBUG_EVENT 1

And post the log here.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 17, 2023

*** starting Device information sketch ***
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:89]*** DEVICE_CONNECTED_EVENT: 0 1 0 0x0

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:120]HPRT Speed: 1: Low speed? 0

[USB_EVENT: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:130]new device connected: 0x2400c72c

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.cpp:88]init dev: 0x2400c72c
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:629]USBEndpoint created (0x2400c084): type: 0, dir: 1, size: 8, addr: 0, state: USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 0 1 0 8)

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:642]Resetting hub 0, port 1

No USB host device connected
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:166]usb_thread read device descriptor on dev: 0x2400c72c

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 0 1 0 8)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 0

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 1 0 0 8 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [8 bytes transferred]
12 01 00 02 00 00 00 40 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL WRITE [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 0 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 0

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
0 5 1 0 0 0 0 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:185]Address of 0x2400c72c: 1
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 1 0 0 8 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [8 bytes transferred]
12 01 00 02 00 00 00 40 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_INFO: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:211]New device connected: 0x2400c72c [hub: 0 - port: 1]
Device:0x2400c72c
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:957]dev: 0x2400c72c nb_intf: 0
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:958]dev: 0x2400c72c nb_intf_attached: 0
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:964]Enumerate dev: 0x2400c72c
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 1 0 0 12 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [18 bytes transferred]
12 01 00 02 00 00 00 40 6A 05 74 03 11 01 01 02 03 01 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:979]CLASS: 00 	 VID: 056A 	 PID: 0374
VID: 56A, PID: 374

----------------------------------------
Device Descriptor:
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 1 0 0 12 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [18 bytes transferred]
12 01 00 02 00 00 00 40 6A 05 74 03 11 01 01 02 03 01 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 3 0 0 40 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [4 bytes transferred]
04 03 09 04 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
  bcdUSB: 512
  bDeviceClass: 0
  bDeviceSubClass: 0
  bDeviceProtocol: 0
  bMaxPacketSize: 64
  idVendor: 0x56a
  idProduct: 0x374
  bcdDevice: 273
  iManufacturer: 1
  iProduct: 2
  iSerialNumber: 3
  bNumConfigurations: 1
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 1 3 9 4 A2 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [30 bytes transferred]
1E 03 57 00 61 00 63 00 6F 00 6D 00 20 00 43 00 6F 00 2E 00 2C 00 4C 00 74 00 64 00 2E 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Manufacturer: Wacom Co.,Ltd.
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 2 3 9 4 A2 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [18 bytes transferred]
12 03 49 00 6E 00 74 00 75 00 6F 00 73 00 20 00 53 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Product: Intuos S
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 3 3 9 4 A2 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [28 bytes transferred]
1C 03 31 00 47 00 45 00 30 00 30 00 52 00 32 00 30 00 31 00 30 00 30 00 31 00 33 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Serial Number: 1GE00R2010013
Speed: 0
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 2 0 0 9 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [9 bytes transferred]
09 02 22 00 01 01 00 80 FA 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE

----------------------------------------
Size of configuration Descriptor: 34
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 2 0 0 9 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [9 bytes transferred]
09 02 22 00 01 01 00 80 FA 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: D:\github\GIGA_USBHostMBed5_devices\examples\GIGA_USBHost_DeviceInfo\USBDumperDevice.cpp:429]TOTAL_LENGTH: 34 	 NUM_INTERF: 1
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 2 0 0 22 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [34 bytes transferred]
09 02 22 00 01 01 00 80 FA 09 04 00 00 01 03 00 00 00 09 21 10 01 00 01 22 F7 02 07 05 81 03 40 00 01 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Configuration Descriptor
2400ECF8 - 09 02 22 00 01 01 00 80  FA 09 04 00 00 01 03 00  : .."..... ........
2400ED08 - 00 00 09 21 10 01 00 01  22 F7 02 07 05 81 03 40  : ...!.... "......@
2400ED18 - 00 01                                             : ..
Config:
 wTotalLength: 34
 bNumInterfaces: 1
 bConfigurationValue: 1
 iConfiguration: 0
 bmAttributes: 128
 bMaxPower: 250
****************************************
** Interface level **
  bInterfaceNumber: 0
  bAlternateSetting: 0
  Number of endpoints: 1
  bInterfaceClass: 3
  bInterfaceSubClass: 0
    HID
  bInterfaceProtocol: 0
    None
  iInterface: 0
  HID Descriptor size: 759
  Endpoint: 81 In
    Attrributes: 3 Interrupt
    Size: 64
    Interval: 1
>>>>> USBDumperDevice::getHIDDesc(0) called <<<<< 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
81 6 0 22 0 0 F7 2 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_ERROR
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [0 bytes transferred]


*** Failed to read in HID Report Descriptor ***
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 2 0 0 9 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [9 bytes transferred]
09 02 22 00 01 01 00 80 FA 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:896]TOTAL_LENGTH: 34 	 NUM_INTERF: 1
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 0 2 0 0 22 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [34 bytes transferred]
09 02 22 00 01 01 00 80 FA 09 04 00 00 01 03 00 00 00 09 21 10 01 00 01 22 F7 02 07 05 81 03 40 00 01 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:989]CONFIGURATION DESCRIPTOR:

09 02 22 00 01 01 00 80 FA 09 04 00 00 01 03 00 00 00 09 21 10 01 00 01 22 F7 02 07 05 81 03 40 00 01 

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1041]dev: 0x2400c72c has 1 intf
parseInterface nb:0
 bInterfaceClass = 3
 bInterfaceSubClass = 0
    HID
 bProtocol = 0
    None
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1050]ADD INTF 0 on device 0x2400c72c: class: 3, subclass: 0, proto: 0
useEndpoint(0, 3, 2)
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1002]Set configuration 1 on dev: 0x2400c72c
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL WRITE [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
0 9 1 0 0 0 0 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1015]dev 0x2400c72c is enumerated

New Debug device: VID:056a PID:0374 [dev: 0x2400c72c - intf: 0]
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHost.h:170]register driver for dev: 0x2400c72c on intf: 0
USB host device(56a:374) connected
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 1 3 9 4 A2 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [30 bytes transferred]
1E 03 57 00 61 00 63 00 6F 00 6D 00 20 00 43 00 6F 00 2E 00 2C 00 4C 00 74 00 64 00 2E 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Manufacturer: Wacom Co.,Ltd.
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 2 3 9 4 A2 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [18 bytes transferred]
12 03 49 00 6E 00 74 00 75 00 6F 00 73 00 20 00 53 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Product: Intuos S
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1210]----- CONTROL READ [dev: 0x2400c72c - hub: 0 - port: 1] ------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:99]** USBEndpoint::setSpeed(0x2400c084, 0) **

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:89]0x2400c084 0 1 2 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:91](SA)HAL_HCD_HC_Init(0x2400131c 0 0 1 1 0 64)

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1224]Control transfer on device: 1

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1228]SETUP PACKET: 
80 6 3 3 9 4 A2 0 
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1256]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1285]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1293]CONTROL READ SUCCESS [28 bytes transferred]
1C 03 31 00 47 00 45 00 30 00 30 00 52 00 32 00 30 00 31 00 30 00 30 00 31 00 33 00 

[USB_TRANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1326]CONTROL ack stage USB_TYPE_IDLE
Serial Number: 1GE00R2010013

@AndrewCapon
Copy link
Contributor

Hi @KurtE

Can you try changing in void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *pHcd, uint8_t uChannel, HCD_URBStateTypeDef urbState) in USBHALHost_STM.cpp

constexpr uint32_t uRetryCount = 10;

Try making that retry count larger, maybe 20, then 50, then 100 to see if that makes it work.

Really this retry count should be based on a timer as HAL_HCD_HC_NotifyURBChange_Callback can be called differently for different devices, that 10 was a arbitrary figure I came up with here which equates to about 4ms from the number of times it was called here, this may be different for different devices.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 17, 2023

Thanks, will try and let you know soon.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 17, 2023

Did not notice any difference. I think I may need to debug more... I am not seeing the tablet responding to the request...
Maybe it does not like something with it...

@AndrewCapon
Copy link
Contributor

I guess you need to find out where that USB_TYPE_ERROR is coming from, I'm guessing that it is a timeout because the device is not responding.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 17, 2023

Here is a query for the HID Descriptor done by Teensy.
image
A more closeup showing the setup packet, and the ones up to when the first Input data started coming bacK
image
And the color on top shows my HLA analyzer output for the setup and in...
image

However on the GIGA, we see at the request time.
image

And the next actual frame with any information is about a second later:
image
image

Almost like the IN endpoint is not active... Wondering if maybe the register to setup for transfer size is computing correctly tne number of return packets and allowing it.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 18, 2023

I think there is a hint in the request failing:
image
Note the last thing on the right. The IN packet ended up in STALED state...

And I noticed in:
void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *pHcd, uint8_t uChannel, HCD_URBStateTypeDef urbState)
The comments:

//  - URB_STALL    = a stall response from the device - but it is never handled by the library and will end up
//                   as a timeout at a higher layer, because of an ep_queue.get() timeout, which will activate
//                   error recovery indirectly

@AndrewCapon
Copy link
Contributor

What's the time between the NAK and the STALL?

Also yesterday I was a bit confused, these HID requests are on the Control Endpoint not the Interrupt Endpoint?

Also as a quick test can you set uRetryCount to 0 and give that a go. (instant retry on NAK)
And set to 0xffffffff as well. (No retries at all)

@KurtE
Copy link
Contributor Author

KurtE commented Nov 18, 2023

image

Will try some of the other retry and see what that does. It may be that the tablet gets anxious and gives up quickly as it has 12 packets to send back.

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 18, 2023

I wonder if it is something with the lower level (STM) NAK handling.

From what I understand from the traces the teensy is receiving multiple NAKs while the device works it out and then the data, looks good.

The GIGA is getting a single NAK and then a STALL.

Does that sound about right?

@KurtE
Copy link
Contributor Author

KurtE commented Nov 18, 2023

image

Same as before, except it sends it 1 more time, which still returns stalled.
And then back to only SOF packets every ms for about a second until I issue the next request

I should mention that it does work on some devices, here is keyboard USB LS 8 byte control packets
image

And a different tablet USB HS - has two report descriptors:
First is only 18 bytes
image

Second one is 119 bytes: But again 8 byte control endpoint so lots of packets... spread over a lot of time:
image

On the Teensy with the tablet that fails on GIGA:
image

So yes 3 NAKs before it responds true. But the time between when the request finished sending until the In attempt that starts retrieving data is about 21us

So wondering if timing?

@AndrewCapon
Copy link
Contributor

Can you notice any differences between the USB data going from the teensy/giga to the tablet?

I do have a Wacom tablet somewhere but I have no idea where it is, I will attempt to spot it tomorrow...

@KurtE
Copy link
Contributor Author

KurtE commented Nov 18, 2023

As I mentioned, I wonder if some of this is about timing and the usage of the frames. That is I think the current code will check for the IN data something like once per frame.
It was hard for me to see exactly where the SOF frames are in some of these captures, so I spent a little time this morning hacking up a new HLA that put a "*" up at each SOF...

So for example with the last tablet I mentioned, (HUION) with the 119 byte HID descriptor which takes 15 data packets.

Again looks like we only ask for data once per 1ms frame:
image
In this case the device is really slow so maybe does not matter as much:

On the Micromod:
The USB Frames are sliced up into more parts. Probably depending on how many things are wanting some of the USB Band width.
But for example the slow responding device for the HID descriptor shown earlier, Here is showing the frame with the request and start of the next frame:
image

And each of those sections within those portions are asking multiple times sometimes 15 times or so.
image

But this is the control end point... For later on when waiting for input it is just asking once per frame.

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 18, 2023

Doesn't It depend on the device: so if it is using frames it is 1ms, if it is using microframes it is 125us.

For (BULK and CONTROL) the underlying HAL/STM code will ask for another packet after it receives a packet, so every (1-n) ms or every (1-n) 125us depending on the device.

For input if using interrupt endpoints like HID then it is always 1ms.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 18, 2023

I am also not an expert on some of this stuff, I have browsed through the USB documents some, such that I have some basic
understandings.

I have also done a reasonable amount of work on the sort of layers above this low level stuff. PaulStoffregen does most/all of this lower stuff on the Teensy.

One of the websites I often go to with USB questions is:
https://beyondlogic.org/usbnutshell/usb4.shtml#Control

If you go to the bottom of the above page, it talks about some of the bandwidth management stuff...

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 19, 2023

That is for ISO and INTERRUPT endpoints though.

When dealing with BULK and CONTROL I am pretty sure the transfer throughput is based on (Frames & packet size) or (Microframes & packet size).

So if the device is using Frames and an 8 byte packet and you are transferring 64 bytes it will take 8ms at best. 8 bytes per frame (1ms)

If the device is using Microframes and an 8 byte packet and you are transferring 64 bytes then it will take 1ms at best. 8 bytes per microframe (125us)

Edit: And looking at this: https://www.microchip.com/en-us/education/developer-help/learn-solutions/wired/usb/how-usb-works/frame

What I said is correct for CONTROL but it looks like BULK can have up to 19 transfers per frame or 13 transfers per microframe.

@AndrewCapon
Copy link
Contributor

AndrewCapon commented Nov 19, 2023

I found my cheap Wacom, unfortunately it works though (smaller HID Descriptor size):

*** starting Device information sketch ***
No USB[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBDeviceConnected.cpp:88]init dev: 0x2400f84c
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:634]USBEndpoint created (0x2400f1a4): type: 0, dir: 1, size: 8, addr: 0, state: USB_TYPE_IDLE
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:647]Resetting hub 0, port 1

 host device connected
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:162]usb_thread read device descriptor on dev: 0x2400f84c

[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:181]Address of 0x2400f84c: 1
[USB_INFO: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:206]New device connected: 0x2400f84c [hub: 0 - port: 1]
Device:0x2400f84c
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:963]dev: 0x2400f84c nb_intf: 0
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:964]dev: 0x2400f84c nb_intf_attached: 0
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:970]Enumerate dev: 0x2400f84c
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:986]CLASS: 00         VID: 056A       PID: 00D2
VID: 56A, PID: d2
Speed: 0
Size of configuration Descriptor: 59
[USB_DBG: src/USBDumperDevice.cpp:406]TOTAL_LENGTH: 59   NUM_INTERF: 2
 bNumInterfaces: 2
 bConfigurationValue: 1
 iConfiguration: 0
 bmAttributes: 128
 bMaxPower: 49
  bInterfaceNumber: 0
  bAlternateSetting: 0
  Number of endpoints: 1
  bInterfaceClass: 3
  bInterfaceSubClass: 1
  bInterfaceProtocol: 2
  iInterface: 0
  HID Descriptor size: 176
81    Attrributes: 3    Size: 9
    Interval: 4
>>>>> USBDumperDevice::getHIDDesc(0) called <<<<< 

HID Report Descriptor (0x24011228) size: 176
  05 01 // Usage Page(1) -   09 02      // Usage(2) -  A1 01    // Collection(1) top Usage(10000)  85 01        // Report ID(1)  09 01  // Usage(1) -  A1 00    // Collection(0)  05 09 // Usage Page(9) -   19 01 // Usage Minimum(1) -  (BUTTON 1)  29 05        // Usage Maximum(5) -  (BUTTON 5)  15 00        // Logical Minimum(0)  25 01    // Logical maximum(1)  95 05    // Report Count(5)  75 01       // Report Size(1)  81 02   // Input(2)     // (  95 01     // Report Count(1)  75 03       // Report Size(3)  81 01        // Input(1)     // (  05 01     // Usage Page(1) -   09 30      // Usage(30) -  09 31      // Usage(31) -  15 81   // Logical Minimum(81)  25 7F   // Logical maximum(7f)  75 08   // Report Size(8)  95 02        // Report Count(2)  81 06       // Input(6)     // (  C0  C0  05 0D     // Usage Page(d) -   09 01 // Usage(1) -  A1 01    // Collection(1) top Usage(d0000)  85 02        // Report ID(2)  A1 00  // Collection(0)  06 00 FF      // Usage Page(ff00) -   09 01   // Usage(1) -  15 00       // Logical Minimum(0)  26 FF 00 // Logical maximum(ff)  75 08   // Report Size(8)  95 08        // Report Count(8)  81 02       // Input(2)     // (  C0  09 01 // Usage(1) -  85 02    // Report ID(2)  95 01     // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 03    // Report ID(3)  95 01  // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 04       // Report ID(4)  95 01  // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 05    // Report ID(5)  95 01  // Report Count(1)  B1 02       // Feature(2)   // (  09 01        // Usage(1) -  85 10    // Report ID(10)  95 02 // Report Count(2)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 11    // Report ID(11)  95 10 // Report Count(10)  B1 02// Feature(2)    // (  09 01     // Usage(1) -  85 13    // Report ID(13)  95 01 // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 20    // Report ID(20)  95 01 // Report Count(1)  B1 02  // Feature(2)   // (  09 01     // Usage(1) -  85 21    // Report ID(21)  95 01 // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 06    // Report ID(6)  95 01     // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 07    // Report ID(7)  95 01  // Report Count(1)  B1 02       // Feature(2)   // (  09 01     // Usage(1) -  85 14       // Report ID(14)  95 01 // Report Count(1)  B1 02       // Feature(2)   // (  C0  bInterfaceNumber: 1
  bAlternateSetting: 0
  Number of endpoints: 1
  bInterfaceClass: 3
  bInterfaceSubClass: 0
  bInterfaceProtocol: 0
  iInterface: 0
  HID Descriptor size: 75
82    Attrributes: 3    Size: 64
    Interval: 4
>>>>> USBDumperDevice::getHIDDesc(1) called <<<<< 

HID Report Descriptor (0x24011290) size: 75
  06 00 FF      // Usage Page(ff00) -   09 01   // Usage(1) -  A1 01    // Collection(1) top Usage(ff000000)  85 02     // Report ID(2)  05 0D  // Usage Page(d) -   09 22      // Usage(22) -  A1 00   // Collection(0)  06 00 FF // Usage Page(ff00) -   09 01   // Usage(1) -  15 00    // Logical Minimum(0)  26 FF 00 // Logical maximum(ff)  75 08   // Report Size(8)  95 02        // Report Count(2)  81 02 // Input(2)      // (  05 01     // Usage Page(1) -   09 30      // Usage(30) -  35 00   // Physical Minimum(0)  46 E0 2E        // Physical Maximum(2ee0)  26 E0 01     // Logical maximum(1e0)  75 10  // Report Size(10)  95 01  // Report Count(1)  81 02       // Input(2)     // (  09 31     // Usage(31) -  46 40 1F        // Physical Maximum(1f40)  26 40 01     // Logical maximum(140)  81 02  // Input(2)// (  06 00 FF  // Usage Page(ff00) -   09 01   // Usage(1) -  26 FF 00 // Logical maximum(ff)  75 08   // Report Size(8)  95 0D        // Report Count(d)  81 02       // Input(2)     // (  C0  C0[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:902]TOTAL_LENGTH: 59         NUM_INTERF: 2
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:999]CONFIGURATION DESCRIPTOR:

09 02 3B 00 02 01 00 80 31 09 04 00 00 01 03 01 02 00 09 21 00 01 00 01 22 B0 00 07 05 81 03 09 00 04 09 04 01 00 01 03 00 00 00 09 21 00 01 00 01 22 4B 00 07 05 82 03 40 00 04 

[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1051]dev: 0x2400f84c has 2 intf
parseInterface nb:0
 bInterfaceClass = 3
 bInterfaceSubClass = 1
 bProtocol = 2
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1060]ADD INTF 0 on device 0x2400f84c: class: 3, subclass: 1, proto: 2
useEndpoint(0, 3, 2)
parseInterface nb:1
 bInterfaceClass = 3
 bInterfaceSubClass = 0
 bProtocol = 0
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1012]Set configuration 1 on dev: 0x2400f84c
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1025]dev 0x2400f84c is enumerated

New Debug device: VID:056a PID:00d2 [dev: 0x2400f84c - intf: 0]
[USB_DBG: lib/Arduino_USBHostMbed5/src/USBHost/USBHost.h:172]register driver for dev: 0x2400f84c on intf: 0
USB host device(56a:d2) connected
Manufacturer: Wacom Co.,Ltd.
Product: CTH-461

@AndrewCapon
Copy link
Contributor

Just tried a HUION one as well, also worked as well, even smaller descriptor size though.

@AndrewCapon
Copy link
Contributor

I'm running through in the debugger with a size of 759

Looking in `stm32h7xx_ii_usb.c"


  /* Compute the expected number of packets associated to the transfer */
  if (hc->xfer_len > 0U)
  {
    num_packets = (uint16_t)((hc->xfer_len + hc->max_packet - 1U) / hc->max_packet);

    if (num_packets > max_hc_pkt_count)
    {
      num_packets = max_hc_pkt_count;
      hc->XferSize = (uint32_t)num_packets * hc->max_packet;
    }
  }
  else
  {
    num_packets = 1U;
  }

max_hc_pkt_count is 256 so that's not the problem, it calculates (8 byte packets) that we need 95 packets correctly.

Then:

/*
   * For IN channel HCTSIZ.XferSize is expected to be an integer multiple of
   * max_packet size.
   */
  if (hc->ep_is_in != 0U)
  {
    hc->XferSize = (uint32_t)num_packets * hc->max_packet;
  }
  else
  {
    hc->XferSize = hc->xfer_len;
  }

We get a XferSize of 760 here.

So it looks like the underlying stuff is calculating the packets needed correctly.

@AndrewCapon
Copy link
Contributor

Hi @KurtE

While I was looking at the HUION tablet I noticed that we were sometimes still getting USB interrupt flooding despite the NAK fixes.

So I looked into this and tracked it down to the "Channel Halted Interrupt".

I have updated #42 to also stop this CHH interrupt flooding.

Might be worth you giving this version a go, maybe there is an outside chance this might have something to do with your issue.

@AndrewCapon
Copy link
Contributor

Hold off on those recent changes, with the CHH interrupt flooding turned off we are not getting any data from the interrupt endpoint, looking into it...

@AndrewCapon
Copy link
Contributor

Ok fixed that issue, the CHH flooding is only disabled for the CONTROL endpoints now.

Might be worth a go to see if it sorts your issue, slim chance I would guess.

@KurtE
Copy link
Contributor Author

KurtE commented Nov 19, 2023

Thanks, will give your changes a try and see if they help.
May wait until I get more coffee in me. About 4:45am here...

Note: The wacom tablet with the large HID has 64 byte control endpoint size. So only about 12 packets needed

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

No branches or pull requests

3 participants