Main Site Documentation

Using NAND read/write


#1

Hi,

Does anyone know how to write to NAND file system I get a error (below). I used PersistentStorage. I did a test to see if its formatted comes back false.

An unhandled exception of type ‘System.NotSupportedException’ occurred in System.IO.dll


using System;
using System.Threading;
using System.IO;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using GHIElectronics.NETMF.IO;
using Microsoft.SPOT.IO;

using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.USBHost;
using GHIElectronics.NETMF.USBClient;
using GHIElectronics.NETMF.System;

namespace ChipworkXTester
{
    public class Program
    {
        public static void Main()
        {
            PersistentStorage NandDrive = new PersistentStorage("NAND");
            NandDrive.MountFileSystem();
            string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
            File.Create(rootDirectory + @ "\test.txt");
         }
    }
}

Thanks
Nathan


#2

What line is exactly throwing the exception?
Make sure you are not running on the emulator.
The NAND need to be formatted before first use. I think this is volume.Format(“FAT”);


#3

Thanks Mike.

It fails where trying to creating directories or files

File.Create(rootDirectory + @ “\test.txt”);

I will try formatting it.

Ok it did need formatting,

VolumeInfo.GetVolumes()[0].Format("FAT", 32, true);

Many Thanks