Main Site Documentation

ChipworkX Internal File System: Problem with Access


#1

Hi, everyone!

I’m trying to work with the Internal File System of the ChipworkX (//NAND). Although I
can mount the internal File System as a new PersistentStorage instance, I was unable
to do much else…

I played with this for quite a while, and observed the following related problems:
(–> btw, upon receiving the ChipworkX, I immediately upgraded the Firmware. Took some time,
but quite educational for me, and very smooth. So, I thought that was not the problem…)

  1. When I asked whether the Volume is Formated, the response was False. So, I thought this
    was a bit unpromising…

  2. When I ran my code on the ChipworkX, I could confirm that there is in fact
    a Directory under \ called \NAND, and could confirm that it is the root.
    However, when I tried to change directories to NAND, by several methods
    I got an IOException. ???

  3. Not too surprisingly, attempts later on in the code (still in ), to create a StreamWriter instance (along with a new file) without switching directories
    also generated an Exception, which expected, at that point.

  4. Also, an attempt to Format(0), while preserving the directory structure, was also unsuccessful…
    (runs into an Exception). I tried that right before my attempt to change directories, but no luck.

Here is my code:

   
            internalFS = new PersistentStorage("NAND");
            internalFS.MountFileSystem();

            // Here is where I get a 'False' regarding volume formatting:
            Debug.Print("Internal File System Formatted? " + VolumeInfo.GetVolumes()[0].IsFormatted);

            // Next, I just check to determine the current directory:
            Debug.Print(Directory.GetCurrentDirectory()); // The current directory is /, so that seemed
                                                                              // inconsistent with the False result               
                                                                              // regarding volume formatting...

            // Next, I checked to confirm the root directory (\NAND):
            string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
            Debug.Print(rootDirectory);

            // Next, I checked for subdirectories of \:
            string[] myDirectories = Directory.GetDirectories(Directory.GetCurrentDirectory());
            foreach (string s in myDirectories) 
                    Debug.Print(s);
            
            // Next, I tried to change directories to the root (2 methods; both yield an Exception):
            string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
            //Directory.SetCurrentDirectory( rootDirectory );
            Directory.SetCurrentDirectory(@ "\NAND");

Either way I try it, this SetCurrentDirectory() request yields an IOException:

Exception System.IO.IOException - CLR_E_DIRECTORY_NOT_FOUND (1)

#### Message: 
#### System.IO.Directory::SetCurrentDirectory [IP: 001c] ####
#### FileInputOutputOperationsEx.Program::Main [IP: 006d] ####

A first chance exception of type ‘System.IO.IOException’ occurred in System.IO.dll
An unhandled exception of type ‘System.IO.IOException’ occurred in System.IO.dll

BTW, if I try to Format(0) at //**, I also get an IOException…

The normal output, prior to the Exception, is below, and is pretty much as expected:

Internal File System Formatted? False

\NAND
\NAND

So, the ROOT definitely exists…I just am unable to set directories to it. Not surprisingly,
I cannot create a file in , so I did not include that code above.

This is my first time trying to access NAND, so…perhaps I am making a simple mistake,
somewhere?

Any advice about this would be very much appreciated!

– John


#2

The internal NAND storage needs to be formatted first, see this post: http://www.tinyclr.com/forum/18/1912/