Description
Hi Guys,
I have managed to get a hacked version running a Midi Host:
[USB_TRANSFER: .pio/libdeps/giga_m7/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1100]----- BULK READ [dev: 0x24010554 - MIDI - hub: 0 - port: 1 - addr: 1 - ep: 81]------
[USB_EVENT: .pio/libdeps/giga_m7/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:274]call callback on td 0x2400161f [ep: 0x2400ffdc state: USB_TYPE_IDLE - dev: 0x24010554 - MIDI]
READ SUCCESS [64 bytes transferred - td: 0x2400161F] on ep: [0x2400ffdc - addr: 81]: 0B B0 4F 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[USB_INFO: .pio/libdeps/giga_m7/Arduino_USBHostMbed5/src/USBHostMIDI/USBHostMIDI.cpp:102] MIDI MESSAGE b, b0, 4f, 5b
Along the way I have found the following:
First issue: Getting the configuration descriptor was not working, this was due to only a maximum of 64 bytes being returned, so any data after this was being lost.
In USBEndpoint_STM.cpp
:
queueTransfer()
will only callHAL_HCD_HC_SubmitRequest
with a maximum size of 64.HAL_HCD_HC_NotifyURBChange_Callback()
has code onURB_DONE
to callHAL_HCD_HC_SubmitRequest()
to get the next packet of data, the call works but something is going wrong. We do not get anotherURB_DONE
, so the maximum data returned is 64 bytes.
HAL_HCD_HC_SubmitRequest() can internally handle this packet splitting, you can just request all the data needed and it will work it out. I changed the code to do this and now the data is returned correctly. There is still an issue with control->ep_queue.get(TD_TIMEOUT_CTRL);
timing out that I need to look into, the data is there but we get the timeout.
Second issue: The dreaded MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL=0
causing the callbacks to fail. See #29 (comment)
This was fixed by forcing MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL=1
in callback.h
So I guess the question is if the maximum size of 64 bytes is a known issue?