Page 1 of 1

Hard hang on accessing the filesystem

Posted: Sat May 01, 2021 7:05 pm
by royk
Hi all

I'm seeing this problem where if I have an interrupt driven task and then try to access the filesystem on a pi pico, it just hangs. This behaviour is explained here https://www.raspberrypi.org/forums/view ... 6&t=310648 with code examples and some comments and a member of that forum confirming the same error is in official micropython as that distributed by the raspberry pi foundation. I don't know the guts of micropython, being merely a user, so I don't really know what to do about it. Can anyone in here help out?

thanks

roy

Re: Hard hang on accessing the filesystem

Posted: Sat May 01, 2021 7:41 pm
by Roberthh
I can replicate that with the my own build, using the script below based on the script in the cited forum:

Code: Select all

from machine import Pin, Timer
import uos, time

led = Pin(25, Pin.OUT)
timer = Timer()

count = 0

f = open("afile", "w")
f.write("This is a file\n")
f.close()

def blink(timer):
  global count; count = count + 1
  led.toggle()

timer.init(freq=4, mode=Timer.PERIODIC, callback=blink)

while True:
    uos.rename("afile", "bfile")
    time.sleep(0.1111)
    uos.rename("bfile", "afile")
    time.sleep(0.1111)
    print("count =", count)

It runs typically up to count=5 and then stops.

Edit: This is worth raising an issue at the git repository https://github.com/micropython/micropython

Re: Hard hang on accessing the filesystem

Posted: Sat May 01, 2021 9:16 pm
by royk

Re: Hard hang on accessing the filesystem

Posted: Sun May 02, 2021 6:40 pm
by Roberthh
Please let the title of that isseu start with 'rp2:', which makes it better visible. You can edit the title.