0

cannot write to CIRCUITPY anymore
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

cannot write to CIRCUITPY anymore

by konkas on Sat Jun 30, 2018 4:26 am

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?

konkas
 
Posts: 1
Joined: Sat Jun 30, 2018 4:18 am

Re: cannot write to CIRCUITPY anymore

by danhalbert on Sun Jul 01, 2018 10:32 pm

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 | TOGGLE FULL SIZE
import storage
storage.erase_filesystem()

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

danhalbert
 
Posts: 999
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

by skymind on Sun Jul 08, 2018 10:38 pm

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.

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

Re: cannot write to CIRCUITPY anymore

by danhalbert on Sun Jul 08, 2018 10:50 pm

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()`.

danhalbert
 
Posts: 999
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

by skymind on Sun Jul 08, 2018 11:05 pm

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.

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

Re: cannot write to CIRCUITPY anymore

by danhalbert on Sun Jul 08, 2018 11:09 pm

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

danhalbert
 
Posts: 999
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

by skymind on Sun Jul 08, 2018 11:19 pm

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?

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

Re: cannot write to CIRCUITPY anymore

by skymind on Sun Jul 08, 2018 11:33 pm

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 | TOGGLE FULL SIZE
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?

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

Re: cannot write to CIRCUITPY anymore

by danhalbert on Sun Jul 08, 2018 11:34 pm

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

danhalbert
 
Posts: 999
Joined: Tue Aug 08, 2017 12:37 pm

Re: cannot write to CIRCUITPY anymore

by skymind on Sun Jul 08, 2018 11:43 pm

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!

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

Re: cannot write to CIRCUITPY anymore

by danhalbert on Sun Jul 08, 2018 11:54 pm

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).

danhalbert
 
Posts: 999
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.