understanding SD cards

23 May 2010

Hello, I'm looking to understand the working of SD cards a little better.  I noticed in Simon's code there are a few places where he is clocking the card with CS set high to initialize the card.  I cannot find a place anywhere in the SD specifications document that says this is required for initialization.  Is there someone who could tell me why we are doing this?  Thanks

23 May 2010

CS is Chip Select and is a component of the SPI interface.

It indicates to the SD Card that the data being transmitted on the SPI bus is for that device (SPI can support multiple devices on one bus)

24 May 2010

thank you for the reply.

yeah, and setting CS to low (selecting it, active low) while clocking the slave causes data to be transferred between slave and master.  It is my understanding though, that setting CS to high will deselect the chip, and therefore clocking it while it is deselected will do nothing.  Simon comments this in his code that this is some sort of initialization process, but in the SD Specifications document that he bases his code on, I cannot find any initialization process that describes this being done.  I would just like a little explanation about this if anyone has a minute.  Thanks again.