G120 - SD Card limitations?

Hi All,

I’m stress testing SD Card on 4.3 and have some issues when i start fill up the SD Card (see attached screenshot). In my main application i get this error when reading my config file:


Load boot.config from µSD storage
    #### Exception System.IO.IOException - CLR_E_FILE_IO (1) ####
    #### Message: 
    #### Microsoft.SPOT.IO.NativeFileStream::Read [IP: 0000] ####
    #### System.IO.FileStream::Read [IP: 0028] ####
    #### System.IO.StreamReader::FillBufferAndReset [IP: 0031] ####
    #### System.IO.StreamReader::ReadSeekableStream [IP: 0015] ####
    #### System.IO.StreamReader::ReadToEnd [IP: 000f] ####
    #### IRC.Program::RunNextConfigThread [IP: 00b6] ####
    #### IRC.Program::Main [IP: 02ba] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll

So i created a small application to verfy :


using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using GHI.IO.Storage;

namespace SD_CARD_Stress
{
    public class Program
    {
        static GHI.IO.Storage.IRemovable MySD;
        static StreamWriter LogFile;

        public static void Main()
        {
            Debug.Print("Start");
            MySD = new SDCard();
            MySD.Mount();

            LogFile = new StreamWriter(@ "SD\Stress.log", true);

            while (true)
            {
                //write every 2.5 sec a dummy line
                Thread.Sleep(2500);
                
                //write dummy line
                LogFile.WriteLine("Dummy line...");
                Thread.Sleep(100); 
                LogFile.Flush();

                //show some activity
                Debug.Print("Dummy...");

            }
        }

    }
}

In this application i get another error when writing to a log file:


Start
    #### Exception System.IO.IOException - CLR_E_FILE_IO (1) ####
    #### Message: 
    #### Microsoft.SPOT.IO.NativeFileStream::Write [IP: 0000] ####
    #### System.IO.FileStream::Write [IP: 002a] ####
    #### System.IO.StreamWriter::Flush [IP: 0021] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll

Is there a limit that i crossed? I have checked documentation but don’t find anything there.

I would try this on usb, if similar results then post the details on the netmf codeplex.

Wel,looks like it’s not the number of files.
I created another SD with 5000 10Kb files and this is working fine.

This is still a problem for me.

I haven’t been able to find what the limit is that I’m exceeding.

It’s weird… and size matters :whistle:

5000 10kb files : no problem
100 160Mb files : error
10 1Gb files : error
1 1Gb file : error

… here we have 25 steps down

1 file 3907Kb : error
1 file 3125Kb : no problem

ok back in bussines, now add again but small file size

2 files 3125Kb : no problem
3 files 3125Kb : no problem

at this point I ADD 5 1Gb files to SD : no problem :open_mouth: :wall:

More test tomorow…

@ David@ Emrol - we will take a look and see if we can find anything.

1 Like

Can you please tell me what steps you did exactly, please?
What I am doing here is, copy some large files into SD until the free size is only few MB, then start writing with NETMF until freesize is zero.

I started simulating behavior with a 16Gb µSD and wrote 1000 dummy files on my PC and then put this back in a custom G120 pcb.

Then i get error reading configuration file during startup.

#### Exception System.IO.IOException - CLR_E_FILE_IO (1) ####
 #### Message: 
 #### Microsoft.SPOT.IO.NativeFileStream::Read [IP: 0000] ####
 #### System.IO.FileStream::Read [IP: 0028] ####
 #### System.IO.StreamReader::FillBufferAndReset [IP: 0031] ####
 #### System.IO.StreamReader::ReadSeekableStream [IP: 0015] ####
 #### System.IO.StreamReader::ReadToEnd [IP: 000f] ####

Next i started experimenting to see if number files, file size would point to an exact simulation but i’m not able to put my finger on it yet…

I’m running a write test now from 0 to 16Gb (full µSD)


            while (true)
            {
                //write every 2.5 sec a dummy line
                //Thread.Sleep(2500);
                cnt++;
                cnt2++;

                //write dummy line
                LogFile.WriteLine("Dummy line..." + cnt.ToString());
                //Thread.Sleep(10); 
                LogFile.Flush();

                if (cnt2 > 1000)
                {
                    cnt2 = 0;
                    //show some activity
                    Debug.Print("Dummy..." + cnt.ToString());
                }

            }

I have almost 35 million lines

Dummy…34530496
Dummy…34531497
Dummy…34532498

If this keeps running until SD is full i start a new test reading a file every minute while writing to SD.