SD specification v2.0 specifies four detection methods.
Method 1 senses Dat3 line (Pin1 of the SD Card). This method is not used in Xylon applications as it requires a defined pullup/pulldown scheme that we cannot usually control in the FPGA and because it depends on the PCB. As Xylon provide the IP itself to customers which build their own PCB we avoided this method.
Method 2 (Polling the card) uses a polling mechanism that consists of periodically sending commands (SEND_OP_COND) to the card until a response is received from the Card.
Method 3 (Using the card detection switch) is the easiest option as logiSDHC has a dedicated card detect input signal (sd_cd_n) that is usually provided by the SD Card connector. In this mode interrupt handler together with the logiSDHC SW driver can issue an interrupt to the CPU when a card is plugged into the connector.
Method 2 (Polling the card) and Method 3 (Card detection switch) are methods that is used the most. logiSDHC SW driver and Xylon reference applications use a poling mechanism where they wait for the card detect pin to assert. You can find this in the logiSDHC SW driver “logiSDHC_initCard” function.
Method 4 is based on sensing the Vss on the connector. This method requires external circuitry so this method is not used for the same reason as stated under Method 1.
For more information on the above mentioned methods please refer to SD Memory Card Application Notes Relating to SD Physical Specification.