cannot write to CIRCUITPY anymore

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
konkas
 
Posts: 1
Joined: Sat Jun 30, 2018 4:18 am

cannot write to CIRCUITPY anymore

Post by konkas »

I have bought a Metro M4 Express board (beta).
After updating the bootloader (Replace and Protect the Bootloader update) I cannot write any python file to CIRCUITPY anymore.
It is now a "read-only filesystem"
I have tried to erase everything with the "Metro_M4_QSPI_Eraser.UF". It didnt help at all.
I have installed Circuit Python 3.0.0rc0
My operatingsystem is Ubuntu 18.04.

What can I do?

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

Post by danhalbert »

The eraser program doesn't work properly, sorry -- we changed how to talk to the flash chip and the program was not updated. However, there's a simpler way. Connect to the board with a serial connection (the "REPL"), and type:

Code: Select all

import storage
storage.erase_filesystem()
That will erase and reformat CIRCUITPY. More details here: https://learn.adafruit.com/welcome-to-c ... ive-issues

User avatar
skymind
 
Posts: 8
Joined: Tue Jun 19, 2018 9:39 pm

Re: cannot write to CIRCUITPY anymore

Post by skymind »

Hello,

I seem to have run into this same issue as well, forgot to unmount the partition before unplugging. My Metro Express M0 now has a read-only CIRCUITPY filesystem as well.

I tried reinstalling the latest version of CircuitPy, which I had just upgraded previously (2.3.1). Sadly, this did not fix the CIRCUITPY partition.

I tried to access the REPL via Mu and use those commands to wipe the filesystem, but I don't seem able to type anything into the serial prompt. Also, my TX/RX LEDs don't seem to be blinking at all. How do I enter those commands? Am I missing something?

Thanks.

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

Post by danhalbert »

If you have a main.py or code.py, you need to type ctrl-C at the REPL before you can get to the prompt. DId you try that? Also, if you were previously running 2.3.1, maybe reinstall that if you still can't get to the REPL. Both 2.3.1 and 3.0.0 have `storage.erase_filesystem()`.

User avatar
skymind
 
Posts: 8
Joined: Tue Jun 19, 2018 9:39 pm

Re: cannot write to CIRCUITPY anymore

Post by skymind »

Thanks for the reply danhalbert,

I did not know about the CTRL-C command. I will use that approach in the future if this happens again. In the meantime though, while reading the docs, I found the alternative help for reformatting the drive with the "erase files" documented here; https://learn.adafruit.com/welcome-to-c ... ive-issues

I have used the one for the Metro M0 Express, and then reinstalled the .uf2 image for CircuitPy 2.3.1. I now have regained access to the CircuitPy partition with write permissions.

However, all directory structure seems to be absent; the only thing on CIRCUITPY now is "boot_out.txt". Can you please advise me on how to get back/re-install the default directory structure? (I understand that CIRCUITPY was completely erased, but I was under the impression that the .uf2 image would restore the default files. If that's not the case, I'm trying to find documentation explaining where to get the default files from again, but am so far not finding a clear answer.)

Thanks.

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

Post by danhalbert »

You probably want to reinstall the library package ("lib" folder). Read here about downloading it, unzipping it, and copying it to CIRCUITPY: https://learn.adafruit.com/welcome-to-c ... ary-bundle

User avatar
skymind
 
Posts: 8
Joined: Tue Jun 19, 2018 9:39 pm

Re: cannot write to CIRCUITPY anymore

Post by skymind »

Oh, so the Adafruit CircuitPython Library Bundle basically contains everything important? If so, I'll install that and probably should be set.

Where do I find the original main.py demo script though, out of curiosity?

User avatar
skymind
 
Posts: 8
Joined: Tue Jun 19, 2018 9:39 pm

Re: cannot write to CIRCUITPY anymore

Post by skymind »

So, I have reinstalled the "lib" folder from the library bundle mentioned above (copied the new "lib" into CircuitPy), and I have created a new "main.py" and a new "code.py" file. In each of them I have the following demo code from the CircuitPython tutorial pages:

Code: Select all

import board
import digitalio
import time

led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)
I created these files and saved them with Mu.

However, nothing seems to be happening. The board seems to be responsive to serial commands, and I can write to the CIRCUITPY filesystem; but it seems like the .py scripts aren't being executed. I know this was working perfectly before, when I first activated the board; the script was executed immediately after Mu finished saving changes to "code.py". Have I done something wrong, or do I need to change a setting I missed?

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

Post by danhalbert »

Great!

Look in the Downloads section of the board Learn Guide. The demo files are often there. See https://learn.adafruit.com/adafruit-met ... /downloads for the Metro M0

User avatar
skymind
 
Posts: 8
Joined: Tue Jun 19, 2018 9:39 pm

Re: cannot write to CIRCUITPY anymore

Post by skymind »

danhalbert,

So, after re-importing the default "main.py" from that archive, removing my "code.py", unmounting CIRCUITPY, and resetting the board, the Metro seems to be responding to code changes automagically again. I have changed nothing else since my last post above.

If you can explain why that is, I'd like to know. Seems like there's a software trigger for that function which I'd like to be aware of.

Otherwise, looks like the board is working as intended again (at least until I break it again in some new and exciting way...). Thanks for your help!

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

Post by danhalbert »

My guess: If you were at the ">>>" prompt in the REPL window in Mu, then changes to code.py or main.py would not be run, because CircuitPython was waiting at the prompt. You can type ctrl-D to soft-reload the board, and then it will run code.py or main.py. (code.py is the first choice).

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”