Open SoerenSofke opened 5 days ago
@SoerenSofke Thank you for taking the time to file this issue. I see nothing wrong with your expectations.
I do not have the feather board, so I can only take guesses on how to help. I will try to figure it out with you if you will work with me. Please accept my apology in advance if you have already done the basic steps.
First, verify you have selected the Adafruit Feather RP2040 USB Host board as the board type in the Arduino IDE.
Next, do you have a way to measure the power output of the Feather's USB host port? If so, please verify that you are measuring a full +5VDC between the USB A port's VBus pin and ground. Measure before you plug the device to the port and afterwards. The Feather board uses the RP2040's GPIO 18 to turn on the 5V VBus power to the host port. I am not sure if the software activates the pin or not. If the power is good before you plug in but not afterwards, then the surge current of the device you are plugging in may be too high or you may be otherwise overloading your computer's USB port's power output capability. If you have a powered hub you can put between the computer and the Feather board or between the Feather board and your MIDI device, that may solve the problem.
If power is a steady 5V, please modify the example code to not transmit MIDI to your MIDI messages to your device. That will tell us if the problem is related to sending to your MIDI device. You can disable the transmissions by commenting out the sendNextNote()
function call in the loop()
function as follows:
void loop() {
// Handle any incoming data; triggers MIDI IN callbacks
usbhMIDI.readAll();
// Do other processing that might generate pending MIDI OUT data
// Commenting this line out ==> sendNextNote();
// Tell the USB Host to send as much pending MIDI OUT data as possible
usbhMIDI.writeFlushAll();
// Do other non-USB host processing
blinkLED();
}
If none of these things solve the problem, please tell me more about the brand and model of the MIDI device you are plugging to the Feather board.
Dear @rppicomidi,
First, verify you have selected the Adafruit Feather RP2040 USB Host board as the board type in the Arduino IDE.
The board selected is of type Adafruit Feather RP2040 USB Host
please verify that you are measuring a full +5VDC between the USB A port's VBus pin and ground
The Feather board uses the RP2040's GPIO 18 to turn on the 5V VBus power to the host port. I am not sure if the software activates the pin or not.
In my initial post, I mentioned that I modified setup1()
in order to power VBus with 5V. As you assumed, the default configuration was not allowing for a proper supply of the attached MIDI device.
Compilation and upload of [EZ_USB_MIDI_HOST_PIO_example.ino]>(https://github.com/rppicomidi/EZ_USB_MIDI_HOST/blob/2.0.0/examples/arduino/EZ_USB_MIDI_HOST_PIO_example/EZ_ USB_MIDI_HOST_PIO_example.ino) with modification in setup1(), e.g.
// Sets pin USB_HOST_5V_POWER to HIGH to enable USB power
pinMode(18, OUTPUT);
digitalWrite(18, HIGH);
If you have a powered hub you can put between the computer and the Feather board or between the Feather board and your MIDI device, that may solve the problem.
I followed your suggestion and used a powered USB hub. However, this changes the power-up sequence to an unfavorable order, i.e. the MIDI device is turned on before the Feather boots, and as a consequence the Feather does not detect the MIDI device at all, which may be suspicious in itself, but is the same as without the powered USB hub.
If power is a steady 5V, please modify the example code to not transmit MIDI to your MIDI messages to your device.
I conducted this experiment in advance without mentioning it in my initial post, since it did not change my observation: Not handling incoming MIDI events after some seconds of MIDI device inactivity.
I do not have the feather board, so I can only take guesses on how to help.
If you like, I would like to sponsor you with a bunch of Adafruit Feather RP2040 USB host boards to test your code. In my opinion, your software library is great and a perfect complement to this very board. Many hobbyists like me will most likely use your library with this very Feather board. So please send me your e.g. Paypal and I will send you the money to support this project.
Best, Sören
@SoerenSofke Thank you for your generous offer to sponsor my work here. I must decline. The MIDI projects I do for fun. The only reason I have not yet purchased the feather board is my workshop already has too many boards in it. I am currently working on a different issue with the Arturia BeatStep Pro. Once I am through with that bug, I will attempt to duplicate the issues you are seeing with hardware that I have. If I am unable to duplicate them, I will order one of those feather boards myself.
@SoerenSofke
I have a little time to work on this. I am not seeing any of the issues you are reporting with just my Raspberry Pi Pico board hand-wired to a USB A connector powered via the Pico board's built-in micro USB port. I plan to order a feather board this week.
Can you tell me what your MIDI test device is? There might be something special about the device that is confusing my software. The MIDI devices I am using to test are a Korg nanoKONTROL2 and a Yamaha Reface CS. When it is idle, the nanoKONTROL2 sends nothing to the USB Host. The Yamaha Reface CS, on the other hand, is constantly sending MIDI clock and Active Sensing.
This is not an issue you reported, but I will bring it up anyway. The example code will block until the feather board's USB C port is connected to a computer with an active serial terminal. That means that the feather's USB host will not react to the MIDI device unless the feather board is connected to a PC with the Arduino IDE with the serial monitor window open or some other serial port terminal.
@SoerenSofke Because you mention not ruling out compile issues, please tell me how you have set up the Arduino IDE options under the "Tools" menu. In particular, what are your settings for
?
Dear @rppicomidi
I have a little time to work on this.
I am glad to hear that. I will try to report as well as I can to help you reproduce my issue.
Can you tell me what your MIDI test device is?
The two MIDI devices I use for testing are (incl. diagnostic outputs):
With both MIDI devices, I see the same issue that the example stops handling MIDI callbacks after ~3 seconds of MIDI inactivity, be it e.g.
onNoteOff
onNoteOn
onMIDIdisconnect
During inactivity, none of my devices is sending any kind of messages. At least, this is what I retrieve when using MIDI View on Windows (not my primary PC for development).
The example code will block until the feather board's USB C port is connected to a computer with an active serial terminal.
Thanks for bringing this up. I am aware of this behavior by looking at the source code.
please tell me how you have set up the Arduino IDE options under the "Tools" menu
Please see the standard configuration I am using below:
Btw, to rule out a hardware defect of my Feather board, I tested with a second one I recently ordered and see the exact same issue.
Hi,
I really appreciate this library, as it provides an excellent starting point for my own project, which is to create a MIDI message filter. I intend to instrument EZ_USB_MIDI_HOST on my Adafruit Feather RP2040 with USB Type A Host, connect a MIDI device to the USB Type A Host connector on the Feather and a PC with a software synthesizer on the USB Type C connector on the Feather.
However, I can not even make the given example, e.g. EZ_USB_MIDI_HOST_PIO_example.ino run as expected.
My development environment
Things that work as expected
Compilation and upload of EZ_USB_MIDI_HOST_PIO_example.ino with modification in
setup1()
, e.g.Serial monitor in Arduino IDE output diagnostic strings, incl. diagnostics regarding incoming MIDI messages, e.g.
Things that do NOT work as expected
Once the connected MIDI device does not send MIDI events for more than ~ 3 seconds, the Arduino software EZ_USB_MIDI_HOST_PIO_example.ino stops handling MidiInCallbacks, e.g. onNoteOn, onNoteOff, but also onMIDIdisconnect, etc.
The MIDI device cannot be hot-plugged, i.e. it must be connected to the USB Type A port before Feather is powered up (which is less important for now but might be an issue as well).
How to proceed
Thanks, Sören