Arduino RP2040 must forced bootloader after the upload (on macos with platformIO)

After i upload the code into the arduino, i get the notification that the device has disconnected improperly. Eventhought the code get uploaded into the arduino, the arduino will not be identified anymore. The only way to make it identifiable again is to factory-reset the board, following this guide https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference#forcing-bootloader. Moreover this problem dosen't seem to happen with the arduino IDE.

Thank you in advance, any help is appreciated.

So can you tell us under what conditions does this occur?
What are you using to program the RP2040?

Are you using an Arduino framework and if so which one?

i'm using platformIO to program it.

Sorry I am not familiar with that system.

It sounds like you are programming your code into the Ram of the Pico and not the flash memory.

From This link

Make sure the USB cable is not plugged into your Pico. Press the BOOTSEL button and hold it down while plugging the USB cable into the Pico. Once the USB cable is attached, release the BOOTSEL button.

The Pico should enumerate as a storage device named RPI-RP2 on your computer.

Navigate into your build folder. Copy blink.uf2 (unfortunately, copying files from within VS Code does not work--you will have to do it from a file explorer window). Paste the file into the top level of your RPI-RP2 drive.

Then the code should start every time you power up the Pico RP2040.

No problem, yes i tried this and it makes my arduino i identifiable again but the after i upload the code again i get the same problem again. I think i will compile it with platformIO and upload it using the Arduino IDE

The problem was that i was using int main and not void loop and void setup.

That is a good one. I didn't know that. Thanks for sharing.

Np, the odd thing is that hte code gets uploaded and it works using int main. Maybe the Arduino changes operating mode.

The two Arduino frameworks do install a boot loader. I use the Earle Philhower framework for my Pico RP2040 work for the Arduino.

https://arduino-pico.readthedocs.io/en/latest/install.html#installing-via-arduino-boards-manager

This describes how this is "set" the first time it is used by selecting the appropriate serial port. I have found once you do that all is fine.

I have not used the Mbed framework in anger.

I indeed use the mbed core.

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