I checked off another item on list, the RTC works as expected. The code snippet sets the RTC, then displays the date time in the debug window. Of course you have to manually enter the correct information. I wonder if there is a simple way of getting the info off the PC, and setting the RTC that way?
[CODE]
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
namespace SetClock
{
public class Program
{
public static void Main()
{
bool timeValid = false;
// Enter the correct date and time
if (timeValid == false)
RealTimeClock.SetTime(new DateTime(2011, 11, 1, 8, 19, 0, 0));
// year,month,day,hour(0-23),second,millisecond
Utility.SetLocalTime(RealTimeClock.GetTime());
I am using the program below to test the SD card program, and I get this error:
An unhandled exception of type âSystem.IO.IOExceptionâ occurred in Microsoft.SPOT.IO.dll
I am not sure what to make of this error, any ideas.
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.IO;
namespace Test
{
class Program
{
public static void Main()
{
// ...
// SD Card is inserted
// Create a new storage device
PersistentStorage sdPS = new PersistentStorage("SD");
// Mount the file system
sdPS.MountFileSystem();
// Assume one storage device is available, access it through
// Micro Framework and display available files and folders:
Debug.Print("Getting files and folders:");
if (VolumeInfo.GetVolumes()[0].IsFormatted)
{
string rootDirectory =
VolumeInfo.GetVolumes()[0].RootDirectory;
string[] files = Directory.GetFiles(rootDirectory);
string[] folders = Directory.GetDirectories(rootDirectory);
Debug.Print("Files available on " + rootDirectory + ":");
for (int i = 0; i < files.Length; i++)
Debug.Print(files[i]);
Debug.Print("Folders available on " + rootDirectory + ":");
for (int i = 0; i < folders.Length; i++)
Debug.Print(folders[i]);
}
else
{
Debug.Print("Storage is not formatted. Format on PC with FAT32/FAT16 first.");
}
// Unmount
sdPS.UnmountFileSystem();
}
}
}
Yes,and yes. I am still getting the exception error. I am going after the low hanging fruit first, that is why it may seem that I am jumping around. For instance, I looked at the FEZ Touch code, and it will take me awhile to absorb what is there, same thing with the RTC / NTP.
Once I verify that all the parts that I have in the kit are working, then I will start with some kind of larger project which will take me deeper into the code.
A tentative project that I have in mind is a temperature data logger. That should entail using a tempSensor, RTC, SD card, and maybe the light sensor. I was hopping to make it a remote project, but I am not sure that I can get an XBee module to work with the Panda II setup.
I can not see what is causing the exception error. When I start the program it goes through the rebooting, closes the debug window, shows that it is âreadyâ, pauses for a second, and then throws up the error window. Even when I stop the debugging, the debug window does not open back up.
When I close the error window, it shows a big window:
No source available
No symbols are loaded for any call stack frame.The source code cannot be displayed.
So, as I pressed F5 the code line turned yellow, and as I steeped through the program, all of the lines were yellow. What does the yellow signify? I guess something should of turned up red?
Here are the last few lines that appeared in the output window.
The debugging target runtime is loading the application assemblies and starting execution.
Ready.
When I get the exception error window, it has a break or continue button. So far I have been hitting the break. This time I hit the continue, and it opened up the output window:
Uncaught exception
Done.
Waiting for debug commandsâŚ
The program â[2] Micro Framework application: Managedâ has exited with code 0 (0x0).
@ Rajesh, I only showed the last few lines of what was in the output window. But I did step through all of it, and there was no exception in there. The exception does show up when I use the continue button.
I found a code snippet in the CODE section, I think it is called SDtest.cs, and it worked. Now I have verified that the SD is functional. So far the tempSensor is a little disappointing in terms of accuracy, otherwise everything seems to be working.
I have a problem with the SD card. I use the same code as r_sad ORIGINALLY posted in forum and if SD card is not inserted I get the exception at the line
sdPS = new PersistentStorage(âSDâ);
But if a 2Gb SD (I also tried a 4Gb SD) is inserted, I get the following messages:
The debugging target runtime is loading the application assemblies and starting execution.
Ready.
The thread ââ (0x2) has exited with code 0 (0x0).
Getting files and folders:
Storage â\SDâ is inserted.
Getting files and folders:
Name of Volume is SD
Serial number of Volume is 0
Total Size of Volume is 0
Storage is not formatted. Format on PC with FAT32/FAT16 first.
Storage â\SDâ is ejected.
Both cards were formatted on a WiNXP SP3 system and directories and files therin copied to the SD card.
I have updated the USBizi from the TinyCLR support page at Support â GHI Electronics during the past week.
Microsoft .NET Micro Framework 4.1 SDK as well as
GHI NETMF v4.1 and .NET Gadgeteer Package Oct. 7, 2011
The last did a firmware upgrade and I have chosen the USBizi ( for my Panda 2 board.
Other solutions using LCD, RTC, PWM and more work ok.
I am stuck! hope someone can help. SD card is inserted correctly (can only go one way as far as I can see.
A friend´s FEZ PANDA 2 with my code works fine and he can see that the card is ok.
I think he is still using the previous version of USBizi on his board (could not yet confirm from him)