What is the SD Dectect Pin on the FEZ Panda II?

I am currently using FEZ_Pin.Digital.SD_Detect and that doesn’t seem to be working. It always reads a high whether I have the card inserted or not. I read on the specs that the Panda II has an SD Dectect pin but not mention of what the pin designation is. Thanks for any help in advance.

Try this:

    public class Program
    {
        public static void Main()
        {
            // Blink board LED

            bool ledState = false;

            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);

            InputPort sdDetect = new InputPort((Cpu.Pin)FEZ_Pin.Digital.SD_Detect,true,Port.ResistorMode.PullUp);

            while (true)
            {
                bool sd = sdDetect.Read();

                Debug.Print(sd.ToString());
                // Sleep for 500 milliseconds
                Thread.Sleep(500);

                // toggle LED state
                ledState = !ledState;
                led.Write(ledState);
            }
        }

    }

You should see True while there is no card and then it will switch to False as soon as card is inserted.

http://www.tinyclr.com/forum/topic?id=3406.

http://www.ghielectronics.com/downloads/FEZ/Panda_II/FEZ_Panda_II_sch.pdf

Well, according to the schematic and the link that Mike so graciously supplied (I gave up after two pages of search results - that post is over a year old), what I have should work.

Here is my code:


        public void Run()
        {
            // Set the SD detect pin
            var sdDetectPin = new InputPort((Cpu.Pin)FEZ_Pin.Digital.SD_Detect, true, Port.ResistorMode.PullUp);
            var sdExists = sdDetectPin.Read() == false;
            if( !sdExists )
            {
                // wait 5 seconds and try one more time
                Thread.Sleep(5000);

                sdExists = sdDetectPin.Read() == false;
            }

            if( !sdExists )
            {
                Fault(ErrNoSdCard);
            }
    }

This incorrectly identifies the sd card as inserted when it’s not. Basically the pin always reads false. I also double checked the enum value of FEZ_Pin.Digital.SD_Detect and it matches the pin for CDN on the schematic. Could I have a defective board? It’s causing an exception in my code which halts my program.

@ Sohimo. I have tried your code as is and it properly detects sd card.

What is the revision letter on your board. Mine is Rev C?

@ Architect My board is a Fez Panda II Rev D. I bought it from SparkFun so I don’t know if it’s their design or if they are reselling. I’ll check with them to see if this is their design and maybe there is a different pin I need to listen on. Thanks for the help so far.

You are welcome. The only thing I can think of is that it has different SD connector that doesn’t not do anything with SD pin.

May be GHI will shed some light on what is different between Rev C and Rev D and if SD Detect supposed to work on Rev D.

SD detect is on the same pin as before. The pin is the first one on the connector just by the power connector. Can you measure it with volt meter to check if it is changing?