Panda II does a USB reset when I eject or insert an SD card

I am having some difficulty with getting an SD card to work. Actually, it works okay in one of my Panda II’s as long as I don’t eject it. I have looked at the reset and power pins with a scope and they appear to be fine. The reset line is not being pulled low, but the device acts as if it were. I have tried this with just USB power, with a 5V power adapter (which normally works fine) and even a 9V power adapter. If I eject and insert quickly, I can see the Panda II is no longer in the list of devices on my PC. If I leave it either in or out, the Panda II shows up again. I have no problem doing this with my CANxtra. The behavior is the same (on the Panda II) with a program that is trying to use the SD card or not. I get the same results with two different SD cards that can both be read by the Panda II (but the CANxtra doesn’t like one of them).

Any ideas?

That sounds like current draw on the VREG is causing the voltage to drop and a brownout happens, but it is weird that it happens on eject (when I would NOT expect there to be an added current draw).

Well, I have three Panda II boards and two different types of SD cards. One is a SanDisk 2GB, the other a noname 4GB one. The 4 GB one did not work in my CANxtra, however, it did work in two of my Panda II’s. The SanDisk one worked fine in the two Panda IIs that worked and in the CANxtra. I spent some time troubleshooting the problem and discovered that there must have been a cold solder joint on the SD card holder in the Panda II that did not work, since it is now functional (as long as I don’t hot plug the SD card).

While it is easy to blame bad SD cards and bad power supplies for all problems, it seems to me that FEZ’s are very sensitive when it comes to SD cards and don’t deal with minor issues that they probably should be able to handle.

Now that I have a SD card that works in my CANxtra and other ones that work in my Panda II’s, I can probably make my project work. But, not being able to remove and replace the SD card in the Panda II is a limitation that I would rather not have.

So, the question for GHI is the Panda II supposed to be able to handle inserting an SD card while the Panda II is running?

Here is the sample code I have been using:


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

using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.IO;

namespace FEZ_Panda_II_SD_Test
{
    public class Program
    {
        public static void Main()
        {
            PersistentStorage sdPS=null;

            do
            {
                try
                {
                    // ...
                    // SD Card is inserted
                    // Create a new storage device
                    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(DateTime.Now.ToString() + " 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(DateTime.Now.ToString() + " Storage is not formatted. Format on PC with FAT32/FAT16 first.");
                    }


                    Thread.Sleep(2000);
                    // Unmount
                    sdPS.UnmountFileSystem();
                    sdPS.Dispose();
                }
                catch
                {
                    Debug.Print(DateTime.Now.ToString() + "  Ooops, it seems there is no SD card.");
                    Thread.Sleep(5000);
                    if (sdPS != null) sdPS.Dispose();
                }
            } while (true);

            Thread.Sleep(Timeout.Infinite);
        }
     }
}


This is just the Panda II with a 9V supply. I even tried using a bench supply set at 5V piped into the 5V line and at 3.3V piped into the 3.3V line. On one Panda II everytime I insert the card it resets the device. On the other two, only sometimes when it is on the power supply does it reset. I have tried adding a .1uf and a 10mf cap, but none of these have helped the board that resets always. Based on my results it certainly seems flakey.

Any other ideas?

Known problem, please browse http://www.tinyclr.com/forum/2/3277/ to get a work arround.

Have Fun :wink:

Thanks for the tip. I did try adding caps, but they were just plugged into the headers and must have been too far away to be effective enough. I will try that and see if it works.

I was able to add one 10mf cap on c3 on one board and found that with the 4GB noname card it no longer resets. However, after too much plugging and unplugging the slot no longer latches. Luckily if I hold the card at just the right location it still works.

I was not able to get a 2nd cap mounted on the SD card slot. The pin spacing is too close for my soldering iron’s tip (which is pretty small, but not small enough by today’s standards).

My SanDisk 2GB card will still reset the Panda, but I see no issue with the power line to the SD card when I look at it with my Tek 2246 scope (100MHz). The supply looks fine as far as it shows. I did a little research and it seems that these SD cards can draw upto 100ma while writing, so it is possible it is a very subtle supply problem that the microprocessor sees, but the scope doesn’t show.

I looked at the schematic for the CANxtra (which does not have this issue even when just running from the USB supply), but then it has a 220mf cap on the 3.3V line and another one on the 5V line, so it seems that it is much better decoupled and maybe 10mf is not really enough.

At this point I am somewhat frustrated. It seems FEZ’s really aren’t all that easy. My CANxtra doesn’t like the 4GB card and my Panada II’s don’t like the SanDisk 2GB cards. And now I have a broken SD card holder. Oh well, it was a learning experience.