Cerbuino Net - SD Formatting and Watch dog Timmer

Hello Everyone.

I have a solution that make use of SD card when the internet connection is down.
But in some cases, the sd card need to be formated, and so i used the following code:

pStoreI is a Volume info initialized this way:

 pStoreI = VolumeInfo.GetVolumes()[0];

The problem that i´m facing, is that i am using the watch dog timmer

I´ve created a method

 public static void FormatSD()
 pStoreI.Format("FAT", 0);

And even openning a thread, the process stops on the line “Format” and the watch dog reset my microcontroler.

Is there a way to format the SD card without block the process, and trigger the WTD?

Thank You.


I don’t think this will be simple. I suspect this is because the code for formatting does not relinquish any time to the framework so running as a thread does nothing to help keep concurrent operations (like WDT keep-alive threads) active. If I was smarter I would dig into the code for the storage format in the framework, and look for releasing time out to the framework; but that’s not really going to get you anywhere either since you’re then going to need to compile a custom firmware or put a bug request in and have that make it’s way into the framework in use. So I suspect you’re just going to have to look to stop the watchdog and then re-enable it post format.

1 Like

Hi jamesjsj,

The SD is rely on Native code,So there is no possibility to Continue the process when formatting SD.

And once the WDT enabled,It will be disabled by only the Reset.
So its better to enable the WDT after format the SD.

1 Like

@ Brett - Thanks!
I´ll see if i can create a routine that enables WDT only after the SD Card is formated

@ YuvaRaja - Thanks!
I´ll see if i can create a routine that enables WDT only after the SD Card is formated