Closed ATMakersBill closed 3 years ago
I'm suspecting this could be Windows 10 related, I'll try testing it too.
Also tested with the simpler code from this project instead https://learn.adafruit.com/adafruit-macropad-rp2040/macropad-midi
Same issues
I am not able to reproduce the error when testing on Windows 10
probably similar to #4190
update: other user has issue with win10 as well, so maybe it is slightly different
I chatted with @ATMakersBill last night about the details of this, and gave him some more recent builds to try, which did not help. It does sound like #4190. I have seen #4190-like symptoms on Ubuntu Linux 20.04 without using MIDI at all, with a quiescent connection, while doing some audio testing.
It is merely the connection that is broken. I can reconnect CDC and resume where I left off.
@jedgarpark Try https://www.onlinemusictools.com/webmiditest/ as Bill did and leave it quiescent (don't press any keys) for 5-10 minutes. Then turn the encoder and see if you see any MIDI messages. If not, then it has quietly disconnected.
So... perhaps this will help - I think this might be an interaction problem between the CP code (or maybe TinyUSB) and the Dell hardware/firmware/drivers. I noticed on #4190 that the user was on a Dell XPS. I am testing on my Dell Inspiron 7506 2n1 and getting the issue consistently. On the same machine, I tested a Behringer Control Surface (hardware MIDI device) and it ran continually all night without problem. I also moved the Macropad to my wife's MSI laptop and IT ran all night continuously without a problem.
So perhaps the Dell driver is sending some USB control message (like @hathach suggests in #4190) that we are not handling correctly? I have other CP and TinyUSB-compatible hardware here (lots, actually) if there's anything you folks would like me to test. I thought I'd put a basic CP script that sends MIDI Note Down/Note UP every few seconds on a spare Feather M4? Would you rather I try Arduino/TinyUSB?
@dhalbert I left it quiescent for 10 minutes on a Windows 10 PC (not a Dell, my son's DIY gaming rig) without problems. I also left it overnight on my MacBook Pro without any problems.
I am working on rp2040 suspend/disconnect detection since I think it may be the cause. The problem is I couldn't reproduce the issue on my local machine. Though I made an cpy with usb debug message enabled (in the other issue). @ATMakersBill would you mind trying it out (you will need to hooked its gpio0,1 to FTDI/CP210x for the log).
I have enabled the tinyusb log output to UART @115200 baudrate. It print out all the usb information with level 2 and level 3. Would you mind using this for testing on your device, then post your log as attached filed here for analysis (since it print out quite a lots specially msc communicate very frequent). pico-debug-level.zip
Originally posted by @hathach in https://github.com/adafruit/circuitpython/issues/4190#issuecomment-886409558
@ATMakersBill I tried my best to update tinyusb to address this issue. However, since all my PC cannot reproduce the issue. Would you mind trying this out again. zip contains uf2 for for pico and macropad with multiple debug level (0, 2, 3) . 0 is no debug just for verifying (in case debug log accidentally resolve it by slowing down cpu) Note: pico uart tx is GPIO0, macropad, uart tx is GPIO20 (SDA in qtstemma connector). Looking forward to your feedback.
I tried the Ableton demo program on a Dell Optiplex 3020 (WIndows 10) and a 7010 (Ubuntu 20.04) and was not able to reproduce the problem. These have similar motherboards. In both cases I was not using a USB hub. So either it seems very specific to certain USB controllers or else there is some OS-related issue that is not present all the time.
@ATMakersBill We've changed a number of things and this issue is likely fixed. I'm closing now but will reopen if you test and find that it is still an issue. Either way, I don't want to block 7.0.0 on this.
CircuitPython version
Code/REPL
Behavior
I have been using this code to send MIDI events that can then be used for controlling OBS Studio (using the obs-midi plugin) or other systems. I have tested only on Windows 10.
This code sends Note On/Off when the keys on the Macropad and CC events when the encoder is rotated.
An easy way to view them is to use https://www.onlinemusictools.com/webmiditest/
After a few minutes (especially of inactivity), the events will stop. I have looked into several things with info below.
Description
I have connected to the REPL using Mu and even after the MIDI stops being sent, the REPL still shows the debugging output being printed such as ... CC 21 CC 22 CC 21 CC 20 ... When turning the encoder.
After the MIDI is no longer connected, you can Control-C into the REPL and it will usually be in the debouncer code... when you Control-D to restart the board it runs fine but never sends MIDI events over USB again until you hit the hardware Reset button.
Interestingly, if you break into the REPL while the software IS sending MIDI messages, and then hit Control-D to restart the code it DOES still work. So it seems something is causing the USB connection to fail without stopping the Python code from running. Perhaps something in TinyUSB?
Additional information
No response