Shown looking into card
| No. | MultiMedia™ (MM) 7 pin definition: |
Secure Digital™ (SD) 9 pin definition: | No. | ||||
| SD Mode | SPI Mode | ||||||
| Name | Type | Name | Type | Name | Type | ||
| DAT2 | I/O/PP | Reserved | 9 | ||||
| 1 | Reserved | CD/DAT3 | I/O/PP | !CS | I | 1 | |
| 2 | CMD | I/O/PP/OD | CMD | PP | DI | I | 2 |
| 3 | Vss1 (Supply Voltage Ground) | 3 | |||||
| 4 | VDD (Supply Voltage) | 4 | |||||
| 5 | Serial Clock Input | 5 | |||||
| 6 | Vss2 (Supply Voltage Ground) | 6 | |||||
| 7 | DAT0 | I/O/PP | DAT0 | I/O/PP | DO | O/PP | 7 |
| DAT1 | I/O/PP | Reserved | 8 | ||||
CMD: Command / Response
DAT0...3: Data lines 0 to 3
CD: Card Detect
!CS: Chip Select (Active Low)
DI, DO: Data In, Data Out (SPI signals)
S: power supply; I: input;
O: output using push-pull drivers; PP: I/O using push-pull
drivers
OD: open drain; NC: not connected (or logic high)
SD cards evolved from MM cards, and share most pins. The SD spec added a card detection signal to pin 1, the ability to use up to 4 data bits for higher data rates, and to work in SPI mode. If buying equipment, SD is preferable to MM, SmartMedia, or XD.
The voltage range covers 3 NiCd/NiMH cells (3V6), 2-cell alkaline cells (3V), or low voltage logic (3V3), but NOT 5V.
Pins 9 and 1 to 6 are on a 2.5 mm pitch, slightly
smaller than the common 0.1" (2.54 mm) grid.
Pin 7 is 2.425 mm from Pin 6, and Pin 8 is 1.7 mm away from Pin
7.
The pin numbering for SD cards is correct, they really did put pin 9 next to pin 1.
SanDisk have documentation for their programming interface at their website, but not the software source code itself. After ringing around, it seems this is because they want between 5 and 6 thousand pounds as a licence fee and membership of the SD card organisation. They are worried that if everyone had source code to talk to the cards, then someone would eventually figure out how to break the protection. If this is so, then they are breaking one of the first rules of cryptography: A security system should not rely on people not knowing how it works. For example, anyone can find out how Chubb door locks work, but that does not tell them what shape the keys for any particular door. The Enigma machine mechanism was well understood but was useless without the right keys. Security should lie in the personal keys.
A quick web search revealed no links to any public domain code for reading SD cards. Not even for just using them as unencrypted storage devices. I have absolutely no wish to make any pirate copies of any music.
However, a look at the public specifications suggests it should not be too hard to write code to do the low-level access of reading and writing sectors.
http://www.sdcard.org/ are the official keepers of the spec, but don't have it for free download.
http://www.sandisk.com/oem_sd_memorycard.html
SPI Mode
|
SD Mode
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Figures from www.kingmax.com/product/storage/KDxxxSC.pdf,
you should double check specs for your own card.
VCC = 2V7 to 3V6
Clock rate is up to 20 MHz.
Multiple cards can share clock and power rails but not data
lines.
ABSOLUTE MAXIMUM RATINGS
The maximum rating is the limit value that must not be exceeded even for an instant. As long as you use the product within the maximum rating defined, no permanent damage will ever occur. However this does not guarantee normal logical operation.
Parameter Symbol Min. Max. Unit Note Supply Voltage VCC -0. 3 4. 6 V ESD (contact Pads) is 44KV Storage Temperature TSTG -40 85 C Pull-up resistance for CMD RCMD 10 100 kOhm Prevent bus floating Pull-up resistance for DAT RDAT Signal Line Capacitance CL 250 pF Fpp <5 MHz, 21 cards on bus 1000 pF Fpp <20 MHz, 7 cards on bus Signal Card Capacitance CCARD 10 pF Maximum Signal line Inductances 16 nH Fpp <20 MHz Pull-up resistance inside card(Pin1) RDAT3 10 90 kOhm May be used for card detection SD card
Operating Range
Parameter Symbol Min. Max. Unit Note Supply Voltage VCC 2.0 3.6 V Supply Voltage Specified in OCR Register 2.7 to 3.6 VInput Low Voltage VIL Vss-0.3 0.25x VCC V VInput High Voltage VIH 0.625x VCC VCC +0.3V V Output Low Voltage VOL 0.125x VCC V VIOL=100uA@VDD Min Output High Voltage VOH 0.75x VCC V VIOH= -100uA@VDD Min Input Leakage Current -10 10 uA Output Leakage Current -10 10 uA Minimum Supply current 150 uA At 0 Hz, 3.6 V Standby state High Speed Supply current 80 mA At 25 MHz, 3.6 V FPP 0 25 MHz CL<100 pF (7 Cards) Clock Frequency identification Mode FOD 0 400 KHz CL<250 pF (21 Cards) Clock Low time tWL 10 ns CL<100 pF(7 Cards) Clock High time tWH Clock Rise time tTLH Clock Fall time tTLH Clock Low time tWL 50 ns CL<250 pF(21 Cards) Clock High time tWH Clock Rise time tTLH Clock Fall time tTLH Input Set-up Time tISU 5 ns CMD, DAT Reference to CLK Input Hold Time tIH Output Set-up Time tOSU Output Set-up Time tOH
| Mode | I/O | Host | Language | Free | Comments | |
| MMC? | MC68230 | 8088 | Assembly | MMC Source Code: reads and writes a 16 MB SanDisk MMC | ||
| SPI | PIC SPI | PIC | 16F876 | CCS-C | MMC Source Code: code specific to Microchip PIC SPI module | |
| PICBASIC | No | MMC project | ||||
| SPI | AVR SPI | AVR | ATMega | C | /electronic-atmega-mmc | |
| AT90S8535 | Assembly | MP3 Player Project | ||||
| SPI | 8051 | 89C51 | C | MP3 player developer kit. FAT16, FAT12. |
The last link above looks the best.