You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importboardimporttimeimportdigitalio# variablesforever=1# main programdefmain():
heartbeat_toggle=Falseprint("Hello")
boardled=digitalio.DigitalInOut(board.GP25)
boardled.direction=digitalio.Direction.OUTPUTout0=digitalio.DigitalInOut(board.GP0)
out0.direction=digitalio.Direction.OUTPUTwhileforever:
heartbeat_toggle=not (heartbeat_toggle)
boardled.value=heartbeat_toggle# toggle the LEDout0.value=heartbeat_toggle# toggle GPIO0time.sleep(0.1)
main()
Behavior
Hello, seeing an issue with the official 7.0 release of CircuitPython on Pi Pico.
It seems to handle power-cycling quite badly.. the chances are high that when a user plugs/unplugs a battery or controls a power switch, that the user's code.py could be wiped from Flash. There's at least a 200msec window where this happens.
Also, it takes a very long time (just over 3 seconds) for the code.py to start executing.
I only investigated because it happened several times to me within a week, just connecting/disconnecting a Battery with LDO regulator, and noticing my code was gone.
To test it, I stripped down my code.py to just an LED blink program, and then applied power under control of a script to switch the power on/off on the VSYS pin. It seems to only be an issue in 7.0. I tried the older 6.2 release and that behaves as expected, with a 1-second delay before code.py execution. I could not get that version 6.2 to fail with power cycling at 100msec increments between 100msec and 1 seconds. However with version 7.0, the startup time is just slightly over 3 seconds and I tried power cycling version 7.0 and between 2.8 seconds and 3.0 seconds the code gets wiped. I recorded a private unlisted YouTube video here showing the issue:
CircuitPython 7.0 startup time to execute code.py is unusually long (just over 3 seconds), and if a power-cycle occurs just before then, at 2.8-3.0 seconds, then the code gets wiped and the default code.py runs. The user code is permanently gone and then needs transferring again via USB.
The period 2.8-3.0 seconds might sound very specific, but I randomly got the problem to occur by just plugging a battery + LDO voltage regulator on/off the Pico board, occurring for me several times within a week just by accident.
I have tested with two Pi Pico boards, and they both had the same issue.
Also, the 3-second delay before code.py execution will cause issues because kids are not expecting to wait so long between pushing a power button on, and using their Pi Pico projects. That then causes a high probability that they will power-cycle within that time, a bit like pressing a button on a TV remote repeatedly if it doesn't respond in the expected time.
Additional information
Using release 6.2 resolves the issue (startup time is reduced from 3 seconds to 1 second, and the code wiping issue has not been observed).
The text was updated successfully, but these errors were encountered:
Hi @dhalbert thanks for the response! Release 6.3 seems fine too. With release 6.3, the code.py startup time is slightly longer than release 6.2. Startup time is about 350 msec longer with release 6.3 compared to the approx 1-second startup time of release 6.2.
I tried power-cycling at 1.2, 1.3, 1.4 and 3.0 second intervals with release 6.2, and there was no code-wiping observed.
I think this is because we are writing more info to boot_out.txt, but the code that checks to see whether boot_out.txt needs rewriting is not taking that new info into account. So boot_out.txt is being rewritten on every hard reset. That rewrite delays for 1.5 seconds, which would explain the longer boot time. The rewrite also explains the wiping: if you remove power in the middle of the write, it will corrupt the filesystem. I'll work on a fix.
CircuitPython version
Code/REPL
Behavior
Hello, seeing an issue with the official 7.0 release of CircuitPython on Pi Pico.
It seems to handle power-cycling quite badly.. the chances are high that when a user plugs/unplugs a battery or controls a power switch, that the user's code.py could be wiped from Flash. There's at least a 200msec window where this happens.
Also, it takes a very long time (just over 3 seconds) for the code.py to start executing.
I only investigated because it happened several times to me within a week, just connecting/disconnecting a Battery with LDO regulator, and noticing my code was gone.
To test it, I stripped down my code.py to just an LED blink program, and then applied power under control of a script to switch the power on/off on the VSYS pin. It seems to only be an issue in 7.0. I tried the older 6.2 release and that behaves as expected, with a 1-second delay before code.py execution. I could not get that version 6.2 to fail with power cycling at 100msec increments between 100msec and 1 seconds. However with version 7.0, the startup time is just slightly over 3 seconds and I tried power cycling version 7.0 and between 2.8 seconds and 3.0 seconds the code gets wiped. I recorded a private unlisted YouTube video here showing the issue:
https://youtu.be/eG4jziJHroE
Description
CircuitPython 7.0 startup time to execute code.py is unusually long (just over 3 seconds), and if a power-cycle occurs just before then, at 2.8-3.0 seconds, then the code gets wiped and the default code.py runs. The user code is permanently gone and then needs transferring again via USB.
The period 2.8-3.0 seconds might sound very specific, but I randomly got the problem to occur by just plugging a battery + LDO voltage regulator on/off the Pico board, occurring for me several times within a week just by accident.
I have tested with two Pi Pico boards, and they both had the same issue.
Also, the 3-second delay before code.py execution will cause issues because kids are not expecting to wait so long between pushing a power button on, and using their Pi Pico projects. That then causes a high probability that they will power-cycle within that time, a bit like pressing a button on a TV remote repeatedly if it doesn't respond in the expected time.
Additional information
Using release 6.2 resolves the issue (startup time is reduced from 3 seconds to 1 second, and the code wiping issue has not been observed).
The text was updated successfully, but these errors were encountered: