Persistent Storage - Always unmount and dispose?

Hi all, first post!

Quick question regarding the PersistentStorage object. I am writing a logging application which will be writing various information to a text file located on my SD card at regular intervals.

The question is, do I need to UnMount the SD card after each write or can I just mount the card once on application startup and then leave it mounted?

Regards
Adrian

It should be mounted once the card is inserted (or at startup if already inserted) and unmounted when the card is removed.

Great, thanks for the reply. In our environment the SD card should never be removed unless the device is powered down so shouldn’t be an issue.

In this case, a flush on the filestream after each write should keep the data intact (in case of a power loss or other things).

Another quick question regarding PS, can I have both the SD card and the USB mounted at the same time? I just tried the following code from the beginners guide:

static void DeviceConnected(USBH_Device device)
{
Debug.Print(“USB Mass Storage detected…”);
usbPS = new PersistentStorage(device);
usbPS.MountFileSystem();
}

and it threw an exception when trying to initalize the new PersistentStorage object using the ‘device’ var.

Scratch that, for some reason it’s not detecting my WD passport drive as a Mass Storage device.

You should be able to have both mounted at the same time.
You should only mount it if it’s a mass storage device. How many times does the DeviceConnected(USBH_Device device) gets triggered?