Arduino Zero MIDIUSB problem?

this is my code:

#include <Arduino.h>
#include "MIDIUSB.h"

unsigned long prevtime = 0;
unsigned long time = 0;

void controlChange(byte channel, byte control, byte value)
{
  midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
  MidiUSB.sendMIDI(event);
  // MidiUSB.flush();
}

void setup()
{
}

void loop()
{
  digitalWrite(LED_BUILTIN, LOW);
  time = millis() - prevtime;
  if (time > 50)
  {
    digitalWrite(LED_BUILTIN, HIGH);
    uint8_t value = analogRead(A0) / 8;
    controlChange(1, 1, value);
    MidiUSB.flush();
    prevtime = millis();
  }
}

I have attached my Arduino Zero to my computer via its native USB port (and a potentiometer to A0), and Windows is telling me 'A device which does not exist was specified.'
please see attached screenshot:


I can see that the builtin LED blinks correctly every 50ms , also the transmit LED is constantly lit as if it is stuck trying to transmit something ... in Arduino IDE, sketch uploads and the serial monitor work on COM6, not COM7

if I plug the Zero into my computer via the debug USB port, there will be no errors in Windows, the builtin LED blinks correctly, the transmit LED is off, everything seems to work normally

if I open any other sketch in Arduino IDE , like the blink example sketch , and flash it onto the Zero, Windows will recognize it properly when I plug it via the native USB port, and assign it to COM9...
so it looks like MIDIUSB is causing a problem with the native USB connection

Hi @carmatic. Which version of Windows are you using (e.g., "Windows 11")?

I am using Windows 11

OK. I have experienced something somewhat similar when using the HID capabilities of the Zero. In that case the solution was to delete the existing problematic driver and then force Windows to reinstall the driver. I'll provide instructions:

  1. Open Windows Device Manager.
  2. Under the "Ports (COM & LPT)" section of the device tree, you should see your Arduino board listed. Right click on it.
    A context menu will open.
  3. Select "Uninstall device" from the context menu.
    An "Uninstall device" dialog will open.
  4. Check the box next to "☐ Attempt to remove the driver for this device" in the "Uninstall device" dialog.
  5. Click the Uninstall button.
  6. Wait for the uninstall process to finish, as indicated by the "Uninstall device" dialog closing.
  7. Disconnect the USB cable of the Arduino board from your computer.
  8. Connect the Arduino board to your computer with a USB cable.
  9. Wait for a device to appear under the "Ports (COM & LPT)" section of the Device Manager device tree.
  10. If you still see a :warning: overlay on the device icon, repeat the instructions above until it appears without the :warning: icon overlay.
    I find that sometimes it takes multiple attempts to completely remove the problematic drivers from my system (perhaps there are multiple copies of them present).

two problems with your reply, "you should see your Arduino board listed" but I see 2 entries of my board, not one
furthermore, the problematic entry with the :warning: symbol in Device Manager does not appear if the Zero was flashed with a sketch which does not include MIDIUSB

that is, everything works normally in the Zero, the Arduino IDE, and in Windows.... as long as I don't use the MIDIUSB library
the main issue is:
Arduino Zero is not being detected as a MIDI device when using MIDIUSB

I don't see two in your screenshot.

Perhaps you have the "Show hidden devices" option enabled in Device Manager? When this is enabled, you will see a device for every port your board has ever enumerated to during your history of using it on Windows. The icons of the "hidden" devices will be grayed out.

You can disable the setting by doing this:

  1. Select View > Devices by type from the Device Manager menus.
  2. Open the "View" menu.
  3. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.

But even if you do see two, I don't see that it is really a "problem" with my instructions.

I understand that. I assumed you would understand that the board should be running the problematic sketch when you performed the instructions, as it was at the time of the post I responded to.

I do appreciate feedback on how I might improve the instructions I provide while supporting Arduino users here, but I get the feeling you are allowing pedantry to impede your progress here. Sometimes you must extrapolate and even improvise a bit while following instructions rather than coming to a dead halt the minute you observe some minor perceived difference between your system and what you think the instructions imply.

I fully understand that , and it is the exact issue I was hoping my instructions would fix. Did you actually perform the instructions? If so, what was the result?

Thank you for your reply, I have repeatedly uninstalled the driver for both entries in the Device Manager:


image
image
I have also checked 'attempt to remove the driver for this device' , for the non-functioning entry on COM7
but everytime I plug the Arduino Zero back in via its native port, I see the exact same thing again, and no change in the lack of MIDI functionality

I have solved the problem and MIDI is working

When you delete the drivers in Device Manager, make sure that you close the Arduino IDE first, otherwise it prevents Windows from actually deleting the drivers

1 Like

I'm glad it is working now. Thanks for taking the time to post an update with your solution.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.