I have some experience with Arduino but am not a C++ expert and am interested in using the mbed USBAudio class to send audio from the Pico to a PC. I found some examples and made them work, but I think the author maybe did not properly handle the USB port, because after playing USB audio both ways the Pico always showed up as “mbed Audio” in Device Manager rather than as a serial port. I could compile new programs that didn’t use the USBAudio class but was unable to upload them because at the end of the compile the Pico would appear as a new USB Storage Device and the following error message would be displayed:
rp2040load 1.0.1 - compiled with go1.15.8
.ERROR: Could not open ‘C:\Users\user\AppData\Local\Temp\arduino_build_664182/test_pico.ino.elf.uf2’
the selected serial port
does not exist or your board is not connected
There is indeed no uf2 file, but there is an elf file in the Pico build directory and I have a utility called elf2uf2 that I can use to make a uf2 file that I can then drop on the Pico USB storage device which will accept it and run the new code. As an example, I dropped a “blink” example this way and the Pico indeed starts blinking. But it’s obviously a cumbersome process.
I even tried a brand new factory-fresh Pico board but when I plugged it in it came up as a USB memory device without holding down the boot sel button instead of as a serial device. So of course the serial upload could not work when I tried sending the blink program to it because there’s no serial port available. Connecting the blank Pico to USB while holding down the boot sel button makes it appear as a USB storage device as it should but for some reason plugging it in without pressing boot sel does the same thing now, instead of showing up as a serial device. Prior to these experiments the expected functionality worked fine.
I’ll paste the verbose errors below. It can’t find COM9 because there is nothing at COM9 in device manager, although a different Pico board did use that port.
I first thought the USBAudio experiments had locked up the USB port but uploading is impossible after uninstalling it and even rebooting the PC. Something seems to be wrong with the mbed Pico support environment and while I realize this is probably on the fringe of this board’s focus, I’d certainly appreciate any suggestions about how to fix it.
I think you are in the wrong place. You need to understand how it works. ARM Mbed is no responsible for any target (whole implementation of drivers and all around) that responsibility is on developer/creator/owner of that specific target. In this case Arduino.
Arduino boards that are running on Mbed were added by Arduino for Arduino not for Mbed in general. Arduino boards does not meet requirements to be Mbed Enabled Boards, especially because of different variant of code uploading.
How you can see in this pull request, RP2040 never passed Mbed’s test that are necessary for official release. So in MbedOS release officially does not exist any target like that. Arduino does not use Mbed OS 1:1, it is wrapped in some patches and necessary implementation for RP2040 are probably in this patches.
So if you are not able to follow these steps, then you probably need visit an Arduino forum/github
Thanks very much for taking the time to reply. I wasn’t aware of any of that history and understand that this is an Arduino issue. I did actually post the same issue on the R-Pi Pico forum but as seems to often be the case, 78 views and 0 replies. I’ll continue to pursue those avenues of support, thanks.
Yes, hold down the BOOTSEL button while powering on to enable the USB storage device. Then in Arduino IDE choose and upload one of the default examples DigitalReadSerial (found in 01. Basics folder). This should clear the issue.
If that fails, the go and find one of the precompiled uf2 pico examples from the raspberry pi pico github folder and drag and drop that into the ESB storage device to clear out the USB settings.
Thanks for your suggestion, unfortunately it doesn’t fix the problem. Since the Pico board comes up as a USB storage device with or without the BOOTSEL button down, I can’t upload via serial. However an elf file is created, that I converted to uf2 using elf2uf2, and when I drop that onto the Pico USB storage folder, it accepts it. Next time I attach to USB it enumerates as a USB Serial Device as it’s supposed to, but at the end of the Arduino IDE compile process that port is closed and the USB Storage Device drive letter pops up - again making serial uploading impossible.
The Pico will run any uf2 I drop onto it but something is causing the device to be reset just as BOOTSEL does, which causes the Arduino to see it as a storage device and serial uploading is aborted.