Raspberry Pico - uf2 files fail to start when connecting power

This is a bit of a follow on from my previous post with some specific findings, my issue is uploading code to a Pico or Pico W and then it automatically runs when power is added, in my case this is not happening.

I can create code and it runs successfully on the Pico whilst connected to Arduino 2.1.1 running on a Mac M2, the Blink example is the same. Disconnecting it from the MAC and connecting a power supply I would expect and hope that the code would automatically start but it does not.

As a result of the above I have used the BOOTSEL and loaded the flash_nuke.uf2 to reset the Pico and the Pico appears as a flash drive. I have found my weather_lorawan_app.ino.uf2 and dragged it to the flash drive which as expected reboots and disappears.

Three key points:
1 - When power is applied from external power supply the code does not run.
2 - When power is applied from the MAC USB port and the Arduino IDE 2.1.1 is NOT loaded my code does not run.
3 - When power is applied from the MAC USB port and the Arduino IDE 2.1.1 IS loaded and the weather_lorawan_app not loaded my weather_lorawan_app.ino.uf2 is running.

I can confirm if my weather_lorawan_app.ino.uf2 is running as the Serial Monitor is displaying output and I also have an OLED display that when working, temperature data is displayed.

I have used a Pico, Pico W and various cable to trouble shoot the issues, am I missing something very simple here?

What do you expect to happen to you Serial.print() output when Serial has no usb port to output to?

If you have used

while (!Serial) {
...

in your code, remove it because it hangs waiting for a connection that will not go through.

Regards

1 Like

Thanks both as soon as the issue Serial.print was mentioned I then remembered the while… loop I had added which I removed and now the code is working.

Yes obvious and basic but won’t make that mistake again.

This results in my code starting which great but the other serial device I’m connecting to fails as not present when not connected to PC. I’m guessing this relates to serial port config changing when serial monitor is and isn’t present more research required.

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