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

Hang when accessing filesystem if using timers/interrupts #7204

Open
rkarlsba opened this issue May 1, 2021 · 3 comments
Open

Hang when accessing filesystem if using timers/interrupts #7204

rkarlsba opened this issue May 1, 2021 · 3 comments

Comments

@rkarlsba
Copy link

rkarlsba commented May 1, 2021

Hi all

I have an rpi pico loaded with micropython and I have this issue detailed on the links below

https://www.raspberrypi.org/forums/viewtopic.php?f=146&t=310648
https://forum.micropython.org/viewtopic.php?f=21&t=10430

It is reproducable on current micropython by others and it seems to be a bug. Please help :)

@robert-hh
Copy link
Contributor

robert-hh commented May 2, 2021

A short script causing that error is below:

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()
try:
    uos.remove("bfile")
except:
    pass
    
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's not limited to timer callbacks. The same happens when using the sample script from #6957 with soft interrupts.

@peterbeadle
Copy link

I can confirm it is reproducible with a differet code base. I'm having issues with both pin interrupts and timers causing random hangs when writing to internal flash or external flash card on spi. Coder works fine (PID controller runs for days) without flash writes.

@iabdalkader
Copy link
Contributor

I think this was fixed with #7683

tannewt pushed a commit to tannewt/circuitpython that referenced this issue Dec 2, 2022
return to using python 3.x for builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants