I am interfacing a 32 GB Micro SD card with a PIC32MX795F512L. I am following the examples provided in Lucio de Jasio book. In one of their example, they are using
while( !getCD()); to check if the card is present or not, but this doesn't seem to work in my case, because when I remove the card, it doesn't give any error and moves forward. Below is its code:
// SD card connector presence detection switch
int getCD( void)
// returns TRUE card present
// FALSE card not present
In the hardware,
SD-CD pin is connected to
RA15. So what is the right way of detecting the card's presence?
Above is the schematic for SD card connections.
SD-CD# pin is the pin for card detect. I am checking the voltage change on
R34, but there is no change. When the card is removed, it shows
3.5 V and when the card is inserted, it again shows
3.5 V. Am I doing something wrong or does the hardware have some problem?