Hi,
I'm using IDE1.8.19 on Linux. I have install Earl Howel's Pico drivers ver 3.7.2
I have several chinese pico 2040s. I can't get a serial port to connect to and cannot download code to the device.
In board selection I was using Pi Pico, I then also tried Generic Pico, both to no avail.
In the IDE I just see /dev/ttyS0 and S1. IDE cannot connect.
Resetting /dev/ttyS1
Converting to uf2, output size: 152064, start address: 0x2000
Scanning for RP2040 devices
No drive to deploy.
An error occurred while uploading the sketch
One device seems to be preloaded with some kind of "blink" example. When I connect with the boot switch depressed it does not blink and on red led stays lit up. This seems to indicate it gets the message but I do not see any extra devices. lsusb shows nothing and IDE does not show any other new ports.
I have three such boards ( not identical ) and same issue, so it seems I'm doing something wrong.
I received my first RP2040 based board just a couple of days ago. I added it to basket to get a Temu order for some clothing items over the minimum. Very cheap! It is a clone of Waveshare RP2040 Zero.
I was concerned at first. The board immediately appeared as a USB storage device and not as a Serial device. So I was not sure how I could upload code from the IDE. There was no Port available to select.
So I took a leap of faith and hit upload. It just worked: there was a sound indicating that the USB storage device was disconnected, various messages flashed up in the IDE messages box and the upload process started and quickly completed. The code ran as expected. Simples!
I have not had much further time this weekend to explore my new board, but so far, so good.
Thanks. I don't really have any reason to think all three of these devices orders from different vendors ( two are visible different layout) are all faulty. I'm pretty sure it me doing something wrong since I never used pico before.
OK, part of this was a cable problem. It looks like my usbA to usbC cable was a charging cable, though that is not visible from the outside. I borrowed a data cable and now I do see a new USB device on lsusb:
ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Ah, I just remembered that is not Pi Pico !
The other device does get a mass storage device ID 2e8a:0003 Raspberry Pi RP2 Boot
The mass storage has an index.htm and a text file containing this:
UF2 Bootloader v3.0
Model: Raspberry Pi RP2
Board-ID: RPI-RP2
But same IDE error when I try to download code to it.
Uploading Sketches
To upload your first sketch, you will need to hold the BOOTSEL button down while plugging in the Pico to your computer. Then hit the upload button and the sketch should be transferred and start to run.
Next section:
Uploading the First Sketch
The first time you upload a sketch to a board, you’ll need to use the built-in ROM bootloader to handle the upload and not a serial port.
So two different methods for "first sketch". It goes on to say:
Hold the BOOTSEL button while plugging in the board.
Select Tools->Port->UF2 Board from the menu.
Upload as normal.
I did the BOOTSEL thing and it now seem set in boot mode as expected. When I plug the device in, I do see a new device on the computer : RPI-RP2 , however there is NO " UF2 Board" in the ports menu. Just ttyS0 and ttyS1 as I said before.
Or manually copy the UF2 to the RPI-RP2 drive. Use the IDE Sketch -> Export compiled Binary option to get the UF2 file into the same directory as the INO file. Drag-n-drop the UF2 file on the RPI-RP2 drive.
When I do a manual copy of the *uf2 file, the mass storage device disappears and I get virtual comms port in the IDE : /dev/ttyACM0 .
That is now available to IDE Monitor and I see the serial output from the I2C scanner example I was trying to test.
However, if I replug the device I'm back to square one, no virtual device, no comms port etc. I have to use the Boot button again, get a virgin mass storage device copy the sketch again.
This is great step forward from nothing at all, where I was, but is all very hacky and unstable.
Not much use if I need to flash the board each time I plug it in.
You need to read the documents for this because there is an option you have to click after the first download so that the drivers "remember" the serial connections through a power cycle.
Select the appropriate serial port shown in the Arduino Tools->Port->Serial Port menu once (this setting will stick and does not need to be touched for multiple uploads). This selection allows the auto-reset tool to identify the proper device to reset. Them hit the upload button and your sketch should upload and run.
I did select the port in order to use IDE Monitor but it did not stick.
I do not read anything about an option I need to click as well. Where is that described?
I just power cycled it, without pressing BOOTSEL, if that is what you are asking.
It does now boot to the scanner program each time which is getting more usable. Not sure what made the difference but at some point I added udev rules I found somewhere. This may or may not be significant.
This is now usable, though I still cannot flash it from the IDE. I have to do the export as uf2 and, reboot with the BOOT btn to reinstall the bootloader and then manual file UF2 copy.
That is a lot of wasted time for what should be automatic.
If I try to flash from IDE , I see this output:
Resetting /dev/ttyACM0
Converting to uf2, output size: 148992, start address: 0x2000
Scanning for RP2040 devices
No drive to deploy.
An error occurred while uploading the sketch
Board at /dev/ttyACM0 is not available
You can only flash it with a uf2 file if you do the holding down of the boot button while applying power thing.
When I use it, the previous sketch runs as soon as it is powered up. Not sure where it is going wrong for you, but I use a Mac so maybe that makes a difference. I don't know?
I tried power on with BOOT button, I see a mass storage device appear: RPI-RP2
I try to download the sketch, it compiles but then fails to transfer. Msg as above.
Sketch uses 56628 bytes (2%) of program storage space. Maximum is 2093056 bytes.
Global variables use 10884 bytes (4%) of dynamic memory, leaving 251260 bytes for local variables. Maximum is 262144 bytes.
Resetting /dev/ttyACM0
Converting to uf2, output size: 148992, start address: 0x2000
Scanning for RP2040 devices
No drive to deploy.
An error occurred while uploading the sketch
Where does the temporary uf2 file go to ? It is not in the same location as when I do the export thing.
Ah ! I've found the problem. I turned on verbose messages and it did not show the error but it did show where the uf2 was going.
Then it clicked. I run arduino IDE as a different user and when the auto-mount detects the mass storage device it gets mounted with write access for the login account only.
If I try to copy the uf2 file as the IDE user it fails to get write permission.
Anyway that is something I can fix locally.
What is this UF2 thing, is it just a binary like elf? Once it's copied it seems to blow off the vfat of the mass storage device.
Correct, that mass storage device is where you drop the uf2 file.
It is the only way to load a uf2 file. When I am programming the Pico in C that is exactly what I do. However, that is mainly when I am using the Raspberry Pi to program in C. You can do the same thing on an Arduino if you use other tools like Visual Studio.
I recommend you down load and read the PDF "Getting started with Raspberry Pi Pico" from the Raspberry Pi's web site.
However when you say:-
Is again what will happen because you are in the mass storage mode and you can't upload code in this mode.