You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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:
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"
Beta Was this translation helpful? Give feedback.
All reactions