TinyFileSystem.Format crash with extended Flash memory (QSPI) in 2.2.0.6

Hi,

I use a FezDuino for a commercial development.
I’m having a big problem today with the new firmware update 2.2.0.6100.

The code below (from your example) no longer works :

const int CLUSTER_SIZE = 1024;

var tfs = new TinyFileSystem(new QspiMemory(), CLUSTER_SIZE);
            
if (!tfs.CheckIfFormatted()) {
    //Do Format if necessary 
    tfs.Format();
}
else {
    // Mount tiny file system
    tfs.Mount();
}

The ‘Format()’ or ‘Mount()’ methods crash and I then have to erase all memory and reload the firmware with TinyCLR Config to reconnect again my board.

I updated Visual Studio 2022 and installed the new TinyCLR OS 2.2.0.6000 extension.

What happened since the last librairy update that could do this ?
Thanks in advance

I had a few problems after updating to 2.2.0.6, this is now working for me…

    // A simple class to avoid repetition in trying to open/format our TFS - DAV

    public static class TinyFS {
        const int CLUSTER_SIZE = 256;
        private static TinyFileSystem tfs = null;
        public static TinyFileSystem GetTFS()
        {
            if (tfs == null)
            {
                tfs = new TinyFileSystem(new QspiMemory(4 * 1024 * 4), CLUSTER_SIZE);
                if (!tfs.CheckIfFormatted())
                {
                    //Do Format if necessary 
                    tfs.Format();
                }
                else
                {
                    // Mount tiny file system
                    tfs.Mount();
                }
            }
            return tfs;
        }
    }

// Read WiFi configuration from "flash" (now tfs) on boot..

        public static void OnBoot()
        {
            try
            {
                var tfs = GetTFS();

                if(tfs.Exists(WifiFile)) {
                    WifiHints wifiHints = (WifiHints)Reflection.Deserialize(tfs.ReadAllBytes(WifiFile), typeof(WifiHints));

                    // found our hints
                    Globals.Wifi_AP_Index = wifiHints.AP_Index;
                    Globals.Wifi_Server_Index = wifiHints.Server_Index;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("FlashWiFi::OnBoot Failed: " + ex.Message);
            }
        }

Thanks for your answer.

I tried changing CLUSTER_SIZE value and QspiMemory size settings as you mentionned but without success…

Each time the first execution formats TFS then the program stops.
After that the board connects and disconnects alternately and it is impossible to start a new debug run.

The only solution is to connect in bootloader mode then “Erase All” and flash the GHI firmware again…
(Edit : with the APP button I can program again my board without erase and flash firmware)

Before update I used a CLUSTER_SIZE = 2048 and a new QspiMemory size = 2 * 1024 * 1024

PS : I specify that I test this program every time on several FezDuino boards

did it work 2.2.0.5?

Yes it did.

As I mentioned I just updated the whole TinyCLR system to 2.2.0.6.
I haven’t changed anything in our application 2.2.0.5

we will take a look.

We are not able to reproduce the issue. We have tested on SC20260 and SC20100, no issue found. Format and mount are just fine.

The QspiMemory class we took from our doc.

Is there any other configuration?

Hi,

I have made a lot of tests with 3 FezDuino boards and finally the issue is always present on only one.
I don’t understand why the last week at least 2 boards could not format or mount the TFS…

Format and mount are fine with 2 boards. I try different QspiMemory size and it is ok.
I use a CLUSTER_SIZE = 2048 and memory size = 2 * 1024 *1024 (2Mo).

However with the 3rd board Format or Mount crash. I try to erase all memory (in extended deployment too) without success. I believe the external flash is corrupted…
Wouldn’t it be possible to erase or format it differently?

But on the 3rd board, does version 2.2.0.5xxx work ?

Out of 5 FezDuino boards, I already have 2 cards broken. By reprogramming them :

  • one is no longer recognized at all by TinyCLR Config (even in boot loader mode)
  • on the other I can no longer access the flash memory in version 2.2.0.5xxxx as well as in 2.2.0.6xxx…

While my application has already worked on these 2 boards.
I don’t quite understand what I’m doing wrong…