Check if sd card is present

Is there a proper way to know if sd card is present or not ?
I have try that, but maybe I miss a cleaner method:

        private bool IsSdPresent()
        {
            var storageController = StorageController.FromName(STM32H7.StorageController.SdCard);
            try
            {
                storageController.Open();
                storageController.Close();
            }
            catch (InvalidOperationException)
            {
                return false;
            }

            return true;
        }

Good question. This is on our to do list. I think it is an issue on GitHub.

For now you can try to mount or use the card detect feature on the connector it available. Which board are you using?

I’m using Fez Duino, I don’t think there is a card detect feature for this board.

Sure there is. Take a look at the schematic. There is a small pad next to the connector. Add a wire to one on of the GPIOs

1 Like

Isn’t it connected to boot0 (CDN1) ?

It shouldn’t be! They are separate

1 Like

I believe TH TP were connected. But I should have read under label : CDN1 and B1 are separate indeed. Sorry.

Good. You scared me for a minute!