Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh CircuitPython install on Pico can't edit code #9935

Open
byteit101 opened this issue Jan 4, 2025 · 3 comments
Open

Fresh CircuitPython install on Pico can't edit code #9935

byteit101 opened this issue Jan 4, 2025 · 3 comments
Labels
bug rp2 Both RP2 microcontrollers
Milestone

Comments

@byteit101
Copy link

CircuitPython version

Adafruit CircuitPython 9.2.1 on 2024-11-20; Raspberry Pi Pico with rp2040
Adafruit CircuitPython 9.1.4 on 2024-09-17; Raspberry Pi Pico with rp2040

Code/REPL

print("My Hello World!")

Behavior

Neither Mu nor the file manager can save this code to the pico.
I carefully followed https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython-programming-basics and I fail at the step Save the file. The drive is read-only!

Googling around, it looks like boot.py is misconfigured, except that I don't have boot.py in the CIRCUITPY drive
Attempting to use the boot.py lines in the terminal, I get:

import storage
storage.remount("/", readonly=True)
Traceback (most recent call last):
File "", line 1, in
RuntimeError: Cannot remount '/' when visible via USB.

Googling this leads to results of "edit your boot.py file", which the documentation doesn't explain how to do when I can't save files!

This is an extremely terrible first-time user experience because following the documentation leads to a non-working pico.

Description

No response

Additional information

I've tried a few versions of circuitpython, and I've even reformatted the drive a few times with

>>> import storage
>>> storage.erase_filesystem()

Nothing has affected this issue

@byteit101 byteit101 added the bug label Jan 4, 2025
@byteit101
Copy link
Author

I was finally able to get a writable CircuitPY drive by using the flash_nuke.uf2 and reinstalling circuitpython.

@dhalbert
Copy link
Collaborator

dhalbert commented Jan 4, 2025

Where did your RPi Pico come from, and it is the standard one?

@dhalbert dhalbert added this to the Support milestone Jan 4, 2025
@byteit101
Copy link
Author

byteit101 commented Jan 4, 2025

It's my usual test one, I think I originally got it at digikey?
It's had a variety of C/C++ sdk programs loaded on it before, as well as one micropython when I first got it.

Some more details because I was very tired last night:
Once I loaded CircuitPython on it, the drive showed up with the default files. I was also trying to follow https://learn.adafruit.com/mp3-playback-rp2040/pico-i2s-mp3 at the same time. I mounted circuitpy and tried dropping the pin-detector example (and possibly the wav file, I don't recall exactly) from that page into the drive. My file manager gave me an error, and the drive unmounted. I remounted the drive, now not called circuitpy, and now with only one file (boot_out.txt)
A this point, trying to transfer the wav, the mp3, or any .py files lead to it stalling and erroring out after some time (something about unable to transfer file).

I opened up the REPL, and eventually found this:

>>> os.listdir()
['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'boot_out.txt']
>>> import microcontroller
>>> microcontroller.on_next_reset(microcontroller.RunMode.UF2)
>>> microcontroller.reset()

This was when I downgraded the first time, and loaded a new Circuitpython version. As that didn't fix the issue, eventually I found and executed:

>>> import storage
>>> storage.erase_filesystem()

This got back the drive name and default contents, but now I still couldn't transfer files. At some point I tried doing it via the terminal, which was when I realized it was read-only:

$ sudo mount /dev/disk/by-label/CIRCUITPY /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.

At the end, things didn't timeout, but fail immediatly

@tannewt tannewt added the rp2 Both RP2 microcontrollers label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rp2 Both RP2 microcontrollers
Projects
None yet
Development

No branches or pull requests

3 participants