FEZ Panda II new user problem

:slight_smile:

A graphics system is a little complex for everything to be that simple. However NETMF makes it as simple as we can get.

Try this

One the same project rename Main() to something like Main1()

Create a new Main method as

public static void Main()
{
            InitGraphics();
            double temperature = 23.44;
            fezTouch.DrawString(0, 0, temperature.ToString(), FEZ_Components.FEZTouch.Color.Green, FEZ_Components.FEZTouch.Color.Black, bannerFont);
}

Run it to see a print of the double.

Is this a good start ?

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());

        // Display the Date/Time
        DateTime DT;
        DT = RealTimeClock.GetTime();
        Debug.Print("Current Date/Time: "+ DT.ToString());
    }

}

}
[/CODE]

You can use read the time from a NTP server and set the RTC time.

Look at :

http://code.tinyclr.com/project/305/ntp-time-adjustement-for-wiz5100/

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();
        }
    }
}

What happened to the RTC / NTP attempt ? You seem to be moving from one thing to another :slight_smile:

[ol]Did you format the SD card as specified in the documents ?
Did you insert the SD card into the Panda correct ?[/ol]

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.

Is this line throwing the exception ?

 sdPS.MountFileSystem();

Do you have another SD card to try ?

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.

Click on the following line to set a break point;

 sdPS.MountFileSystem();

You can do this by clicking on the line and pressing the F9 key - you should see a red icon displayed indicating a break point.

Press F5 to run the program. The execution should stop at the breakpoint and show a yellow highlight. Press F10 key to advance to the next line.

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.

‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\mscorlib.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Native.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Graphics.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.System.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.USBHost.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.IO.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Users\Ray\ProgDev\FEZ panda\testSD\testSD\bin\Debug\le\testSD.exe’, Symbols loaded.
The thread ‘’ (0x2) has exited with code 0 (0x0).
The program ‘[3] Micro Framework application: Managed’ has exited with code 0 (0x0).

All above is normal, loading assemblies then program finishing and exiting.

But, when I run the program using debug, it still throws up an exception error. The last time it even restarted VS C# express, which surprised me.

Your reply doesn’t show any exceptions.

Restarted VS ? That is strange.

Your output does not show any exception or you did not copy paste everything.

For exception msg related to mount / unmount SD Card, this will explain:

http://netmf.codeplex.com/workitem/80

“…because the SD card is removed before it got a chance to raise the event…”

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 am away from my workstation right now. I will test your code later and try to see what to do.

Hold on.

There should be no problem running this code.

Did you add a reference to GHIElectronics.NETMF.System.dll ?

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.

‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\mscorlib.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Native.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.IO.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Net.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.System.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.IO.dll’
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Documents and Settings\N TRUTER\my documents\visual studio 2010\Projects\FEZ Panda II SDCardTest1\FEZ Panda II SDCardTest1\bin\Debug\le\FEZ Panda II SDCardTest1.exe’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\FEZPanda_II_GHIElectronics.NETMF.FEZ.dll’

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)

Please any help will be so greatly appreciated!!!