Page 1 of 1
main.py isn't running when Pico connected to external power
Posted: Wed Mar 03, 2021 4:03 pm
by ssfel
I think I'm missing a step somewhere. Can't get Pico to run when it isn't being powered by the micro-USB.
Have a main.py to blink the on board LED. Trying to power it by connected 5 VDC to VSYS. I'm using Thonny with the Micropython interpreter to save the program onto the Pico. Program just doesn't seem to be running at all.
Is there a guide somewhere or a simple tutorial that anybody can link me where the Pico isn't being powered through the USB port? I think I must be missing something
Thanks in advance
Re: main.py isn't running when Pico connected to external power
Posted: Wed Mar 03, 2021 6:51 pm
by dhylands
That seems to work fine for me.
I created main.py with the following:
and blinky.py with
Code: Select all
from machine import Pin, Timer
led = Pin(25, Pin.OUT)
tim = Timer()
def tick(timer):
global led
led.toggle()
tim.init(freq=2.5, mode=Timer.PERIODIC, callback=tick)
I verified that powering up via USB worked. Then I disconnected the USB cable and connected VSYS and GND to a 5V source and the blinky program is running.
Re: main.py isn't running when Pico connected to external power
Posted: Wed Mar 03, 2021 8:58 pm
by Roberthh
Since you are using Thonny: Are you sure that you really copied the main.py file to the board? Just running the files with Thonny dos nto copy it permanently to the boards file system.
Re: main.py isn't running when Pico connected to external power
Posted: Wed Mar 03, 2021 10:08 pm
by HermannSW
I used rshell to copy files onto Pico MicroPython flash filesystem (cp main.py /pyboard).
Today I copied boot.py and main.py, and both get executed, on powering as well as on soft reboot:
https://www.raspberrypi.org/forums/view ... 3#p1830113

Re: main.py isn't running when Pico connected to external power
Posted: Mon Mar 08, 2021 10:25 am
by ssfel
Roberthh wrote: ↑Wed Mar 03, 2021 8:58 pm
Since you are using Thonny: Are you sure that you really copied the main.py file to the board? Just running the files with Thonny dos nto copy it permanently to the boards file system.
At the moment I'm doing;
Save As --> Raspberry Pi Pico --> "main.py", save
Is that correct?
Re: main.py isn't running when Pico connected to external power
Posted: Thu Mar 11, 2021 8:09 am
by aivarannamaa
ssfel wrote: ↑Mon Mar 08, 2021 10:25 am
At the moment I'm doing;
Save As --> Raspberry Pi Pico --> "main.py", save
This should do.
Does it start running again when you reconnect USB? Can it be powering issue?
Re: main.py isn't running when Pico connected to external power
Posted: Thu Mar 11, 2021 6:37 pm
by fdufnews
Can you post your main.py?
Are you sure, you are not missing any import or pin setting in your software?
Re: main.py isn't running when Pico connected to external power
Posted: Fri Mar 18, 2022 3:17 pm
by reiska
Hi,
i have faced the same problem as ssfel. Unfortunately none of the suggestions has been helpful.
At least for my application I found a workaround:
I start main.py as usual having the pico connected via an USB cable. Then connect an external 5V source to VSYS. Now I can unplug the USB connection and the pico continues to run.
Any better solution is still welcome.
Re: main.py isn't running when Pico connected to external power
Posted: Fri Mar 18, 2022 3:43 pm
by karfas
As @roberthh did suggest:
Don't trust thonny or any fancy, colorful gui.
Verify that main.py is really on the device using pyshell or the like. You can also check with a small uPy program whether main.py is really where it belongs (next to boot.py).