Update 25-10-08: Strictly speaking, you no longer have to rely on TinyUSB: Commit Enable TinyUSB MIDI support So, the only disadvantage of the Pico is its physical limitations. (When will the 100-LQFP "Pico" finally arrive?) (Unfortunately, due to time constraints, I haven’t had a chance to test it yet) I've completely modified my original, vague post so that there's quick information for anyone searching.In principle, I assume that the "Adafruit Tiny-USB" USB stack is selected for USB MIDI devices (for several practical reasons). At first: Please start with the midi-test example from the TinyUSB library and copy the header & inits - they are really necessary Problem#1: USB serial + USB MIDI: If both are enabled, problems can occur (device stucks): Unfortunately, this requires modifying the tusb.c file in the Adafruit TinyUSB library. Caution! This library is in the rp20240 package folder): (Line numbers may vary depending on the revision) tusb.c, Line 205:
//(void) osal_mutex_lock(mutex, OSAL_TIMEOUT_WAIT_FOREVER); to
(void) osal_mutex_lock(mutex, OSAL_TIMEOUT_NORMAL); and Line 220
//(void) osal_mutex_lock(mutex, OSAL_TIMEOUT_WAIT_FOREVER); to
(void) osal_mutex_lock(mutex, OSAL_TIMEOUT_NORMAL); Problem#2: Especially when midi.h is included, MIDI Through is enabled by default. This usually creates beautiful feedback loops. Therefore, the line after MIDI - Begin:
MIDI.turnThruOff(); should not be missing. Problem#3: Windows and those lovely MIDI device names (it's been bothering us since Windows XP). This especially affects those who have two USB MIDI controllers running with Arduino simultaneously: For both(!), the name of the device that was plugged in first is always displayed. Unfortunately, changing the USB device name isn't enough, nor is changing the MIDI string description: usb_midi.setStringDescriptor("RP2040 TEST1 MIDI"); (Always set this anyway!) Either the vendor (bad idea) or USB_PID (basically the manufacturer's subclass) must be changed (!!!): for Adafruit TinyUSB: Open the file "Adafruit_USBD_Device.cpp" in the library and search for the following lines: #ifndef USB_PID#ifdef BOARD_PRODUCTID#define USB_PID BOARD_PRODUCTID#else#define USB_PID 0xcafe#endif#endif
Now you can change the USB_PID 0xcafe, for example, to USB_PID 0x0001 (this can be used continuously - for example, I use 0xAAAA for each test environment and alternate 0x1111 continuously for the production environment). Unfortunately, I haven't had the time yet to find an ideal solution for the control surface. Library Gihub Control-surface can be found. Although it's based on Adafruit TinyUSB, it has its own methods. Here, too, it's sufficient to change the USB_PID as described above. You can also edit boards.txt (or take a boards.local.txt) and modify your board entry like mine:
vccgnd_yd_rp2040.build.usb_product="test-production" |