Hi,
Using MPy 1.17, stm32F405
I have a program that will do some os tasks on the flash memory such as renaming and moving files and directories. After this, it issues:
os.sync()
pyb.hard_reset()
In some rare cases, it won't reboot as the file system became corrupted.
So is it possible that os.sync() is still in running when the hard reset occurs?
In other wordsk, is os.sync() a non-blocking task?
is os.sync a non-blocking?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: is os.sync a non-blocking?
Almost all corruption issues are due to this problem.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: is os.sync a non-blocking?
So a possible solution is to insert some delay (more than 10ms) after os.sync()?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: is os.sync a non-blocking?
If the problem is as per my FAQ quoted above, the only solution is to disable MSC mode. The files can be accessed from your PC using tools such as mpremote and rshell.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: is os.sync a non-blocking?
Thanks. Now it makes sense.
The FAQ link was difficult to see on my browser.
The FAQ link was difficult to see on my browser.