FAT FS corrupted with leading FF ... FF in directory and files.



  • I recently had problems with FAT corruptions. I had WLAN started as STA in boot.
    In main I started LTE for ntp and syslog, appending to a log file(open append, write,close) a few times along the way.
    I added bt.start_scan, bt.get_adv() before starting LTE.
    The boot.log, main.log and /flash directory got 0xFF written as first 0x87(?) bytes.
    After os.format('/flash') and removing get_adv() this problem did not occur.

    Rearrainging the sequence and adding wlan.deinit before bluetooth is working OK.

    Can anyone corroborate this behavior?
    I can make failing code available if you want.
    Might this be fixed since 1.20.2.rc2? (I cannot upgrade to rc6 see https://github.com/pycom/pycom-micropython-sigfox/issues/430 )

    os.uname()
    (sysname='GPy', nodename='GPy', release='1.20.2.rc2', version='v1.11-605f40f on 2020-02-04', machine='GPy with ESP32', pybytes='1.3.1')



  • please mind, that you have to wait to shutdown until all write operations are done. Sadly there is no flush feature, so you have to guess the timings and wait by your own.

    Normally only short messages are written. So a sleep of 1-2 seconds after the last write before a deepsleep will be secure. And don't forget to close the file, which also contains write operations.


Log in to reply
 

Pycom on Twitter