Repository navigation
Open
Labels
Milestone
Description
CircuitPython version and board name
Adafruit CircuitPython 9.2.5 on 2025-03-19; Adafruit Feather RP2040 USB Host with rp2040Code/REPL
import usb.core
import time
time.sleep(5) # needed for USB to settle? I don't think so, but whatev.
print("Looking for midi devices")
while True:
i = 0
for device in usb.core.find(find_all=True):
print("Found a device")
i += 1
print(f"Found {i} devices; going around again...")
time.sleep(1)Behavior
Adafruit CircuitPython 9.2.5 on 2025-03-19; Adafruit Feather RP2040 USB Host with rp2040
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Looking for midi devices
Found 0 devices; going around again...
Found 0 devices; going around again...
Found 0 devices; going around again...
Traceback (most recent call last):
File "code.py", line 2, in <module>
File "super_simple_test.py", line 14, in <module>
KeyboardInterrupt:
Description
usb.core.find() does not see the device under CP>=9.2.5, but did under <=9.2.4.
Additional information
The following test code runs correctly with all MIDI keyboards I have tried it on under CP 9.2.4 and earlier, but fails on some MIDI keyboards under CP 9.2.5 and later.
Test code
import usb.core
import time
time.sleep(5) # needed for USB to settle? I don't think so, but whatev.
print("Looking for midi devices")
while True:
i = 0
for device in usb.core.find(find_all=True):
print("Found a device")
i += 1
print(f"Found {i} devices; going around again...")
time.sleep(1)
Testing with Akai MPKMini2 MIDI keyboard
Test run 1 (success)
Adafruit CircuitPython 9.2.4 on 2025-01-28; Adafruit Feather RP2040 USB Host with rp2040
>>>
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Looking for midi devices
Found a device
Found 1 devices; going around again...
Found a device
Found 1 devices; going around again...
Traceback (most recent call last):
File "code.py", line 2, in <module>
File "super_simple_test.py", line 14, in <module>
KeyboardInterrupt:
...
Test run 2 (failure)
Adafruit CircuitPython 9.2.5 on 2025-03-19; Adafruit Feather RP2040 USB Host with rp2040
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Looking for midi devices
Found 0 devices; going around again...
Found 0 devices; going around again...
Found 0 devices; going around again...
Test run 3 (failure)
Adafruit CircuitPython 10.0.0-alpha.8 on 2025-07-08; Adafruit Feather RP2040 USB Host with rp2040
>>>
>>>
soft reboot
Auto-reload is off.
code.py output:
Looking for midi device
Found 0 devices; going around again...
Found 0 devices; going around again...
...
Output from lsusb --vvv for Akai MPKMini2
As per suggestion/request of @tannewt here is some info on the device from a Linux box:
rob@ScreamerIVU:~$ sudo lsusb -vvv >mpkmini.lsusb.text
(and then edited to show only the pertinent device)
...
Bus 001 Device 009: ID 2011:0715 AKAI MPKmini2
Negotiated speed: Full Speed (12Mbps)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 [unknown]
bDeviceSubClass 0 [unknown]
bDeviceProtocol 0
bMaxPacketSize0 32
idVendor 0x2011 AKAI
idProduct 0x0715 MPKmini2
bcdDevice 0.00
iManufacturer 1 AKAI
iProduct 2 MPKmini2
iSerial 3 0001
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0085
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x00
(Missing must-be-set bit!)
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 [unknown]
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 (null)
wDescriptorLength 52
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 0x0009
bInCollection 1
baInterfaceNr(0) 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 1 Audio
bInterfaceSubClass 3 MIDI Streaming
bInterfaceProtocol 0
iInterface 0
MIDIStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 0x0041
MIDIStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 2 (MIDI_IN_JACK)
bJackType 1 Embedded
bJackID 1
iJack 0
MIDIStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 2 (MIDI_IN_JACK)
bJackType 2 External
bJackID 2
iJack 0
MIDIStreaming Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (MIDI_OUT_JACK)
bJackType 1 Embedded
bJackID 3
bNrInputPins 1
baSourceID( 0) 2
BaSourcePin( 0) 1
iJack 0
MIDIStreaming Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (MIDI_OUT_JACK)
bJackType 2 External
bJackID 4
bNrInputPins 1
baSourceID( 0) 1
BaSourcePin( 0) 1
iJack 0
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
bRefresh 0
bSynchAddress 0
MIDIStreaming Endpoint Descriptor:
bLength 5
bDescriptorType 37
bDescriptorSubtype 1 (Invalid)
bNumEmbMIDIJack 1
baAssocJackID( 0) 1
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
bRefresh 0
bSynchAddress 0
MIDIStreaming Endpoint Descriptor:
bLength 5
bDescriptorType 37
bDescriptorSubtype 1 (Invalid)
bNumEmbMIDIJack 1
baAssocJackID( 0) 3
...
Activity
RobCranfill commentedon Dec 8, 2025
Still failing on
Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit Feather RP2040 USB Host with rp2040dhalbert commentedon Jun 1, 2026
I tested with 9.2.4, 9.2.5, and 10.3.0-alpha.2 with the MIDI devices I had on hand: Arturia MiniLab Mk II, Line 6 MobileKeys 25, and a decades-old USB-MIDI adapter. All were detected in all builds. One thing I tried with the Line 6 and the adapter was to unplug and replug them while the detect loop was running. On all builds they did not re-detect, but did re-detect after a hard reset.
I looked at the code changes between 9.2.4 and 9.2.5.
Pico-PIO-USBwas updated. There don't appear to be any significant code changes in the USB host code besides that.I'm going to push this to
10.x.xfor now, because it seems to work on a lot of keyboards. @RobCranfill if you could list some other devices it doesn't work on, that might help in debugging in the long term.RobCranfill commentedon Jun 2, 2026
Awesome: I find that my test code does work under CP 10.2.1 with the MPK Mini, and also works on myNektar Impact LX88+ and a Roland FP30X (which is the one kbd that it's always worked on) - so it now works on 100% of my suitable keyboards. Nice work!
I guess I should close this issue?
/rob
dhalbert commentedon Jun 2, 2026
Thanks for re-testing so quickly! I'll close now.
RobCranfill commentedon Jul 8, 2026
I am sorry to say I appear to have spoken too soon. This bug remains in effect in CP 10.2.1. I'm not sure how I made that mistake. (I think I was running 10.0.3 on the testbed and forgot that.)
I will poke around some more and see if I can bring anything new to the table.
Sorry,
/r
dhalbert commentedon Sep 20, 2026
More work has been done on USB host, so worth retesting on 10.4.0-alpha.2.
mikeysklar commentedon Sep 20, 2026
@RobCranfill could you also try these test builds on the Feather RP2040 USB Host with the MPK Mini? It has a Pico-PIO-USB receive fix (#11135).
; older build with PIO USB patches
cp-11135-feather_rp2040_usb_host-en_US.uf2.zip
; new build with PIO USB patches and larger cap
cp-main-9701f33a8f-piousb-5a37a66+210+211-cap68-feather_rp2040_usb_host.uf2.zip
RobCranfill commentedon Sep 22, 2026
Yes, some progress. See my upcoming comment as a reply to you and mikeysklar.
RobCranfill commentedon Sep 22, 2026
Yes, some progress. See my upcoming comment as a reply to you and dhalbert.
RobCranfill commentedon Sep 22, 2026
Well, there was a little progress: all 3 flavors now detect the DM6 and can open it as a MIDI device.
The MPKMini is still not even detected by usb.find().
10.4.0-alpha.2
; older build with PIO USB patches
Zip: cp-11135-feather_rp2040_usb_host-en_US.uf2.zip
UF2: adafruit-circuitpython-adafruit_feather_rp2040_usb_host-en_US-20260723-main-PR11135-f32e05c.uf2
REPL: Adafruit CircuitPython 10.3.0-alpha.4-1-gf32e05c77c on 2026-07-23; Adafruit Feather RP2040 USB Host with rp2040
; new build with PIO USB patches and larger cap
Zip: cp-main-9701f33a8f-piousb-5a37a66+210+211-cap68-feather_rp2040_usb_host.uf2.zip
UF2: cp-main-9701f33a8f-piousb-5a37a66+210+211-cap68-feather_rp2040_usb_host.uf2
REPL: Adafruit CircuitPython 10.4.0-alpha.2-24-g9701f33a8f-dirty on 2026-09-20; Adafruit Feather RP2040 USB Host with rp2040
Here's the test code:
Output with DM6 attached:
but thumping on the drum produces no MIDI notes. (Works fine elsewhere.)
Thanks for looking into this! This is progress, and one step closer to me being able to continue with my USBMIDI-to-DINMIDI project.
Thanks,
Rob
mikeysklar commentedon Sep 22, 2026
@RobCranfill thanks! Could you run this with the DM6 attached, hit a few pads, and paste the output? It skips the MIDI libraries and prints the raw USB data.
If you have a Linux box handy,
lsusb -vfor the DM6 would help too. This board might being using a crazy device name.RobCranfill commentedon Sep 22, 2026
Not sure which version(s) you wanted me to test against. I tried 10.3.0-alpha.4.1 and 10.4.0-alpha.2-24-g9701f33a8f-dirty. Happy to do this with the older one if you want. Same result with both (no MIDI events output.)
Hitting the pads produced no output.
Here ya go:
Again, thanks for looking into this!
/rob
mikeysklar commentedon Sep 22, 2026
@RobCranfill thanks, that helps. The DM6 uses 4 byte packets, so a 64 byte read never fills and times out. Could you change
buf = bytearray(64)tobuf = bytearray(4)and try again?RobCranfill commentedon Sep 22, 2026
Yes, that worked! Here's some output with a couple drum-hits:
I'm about to go on vacation in a place with crummy internet access, but I'm gonna try to bring everything I need to work on this and I can check in here on my phone. (OK, I'm a dweeb and this is indeed fun, so no worries!)
/rob
mikeysklar commentedon Sep 22, 2026
Good, that confirms it. The DM6 sends 4 byte packets and the library always reads 64, so the read never completes and the data is dropped. Fix here: adafruit/Adafruit_CircuitPython_USB_Host_MIDI#10. Enjoy the vacation!
The MPK Mini is a separate problem, it fails before any of this.
RobCranfill commentedon Sep 25, 2026
As I just commented over on that USB_host_midi thread/issue, I can report that CP 11.0.0-alpha.1 along with a new adafruit_usb_host_midi.py does work with my un-simulated DM6! So onward with my project!
And thanks to y'all for moving this forward!!
(This, after 2 trips to the public library to download stuff - no internet here except on my phone! :-) )