SD cards and pullups
Thric
Posts: 109
So i've been looking into SD cards and I've seen most objects say that pullups are needed on 6 of the pins. However, I've read on the forums that these pullups aren't really needed and the objects work any ways. I was wondering which idea is true, and if pullups are not required what do I do to the non connected pins (the 4 not connected to the propeller)? Can they be allowed to float?
I'm asking this because I've tried two different setups and it seems like the pullups are required, yet some say the are not and I'm not sure why.
Thanks
I'm asking this because I've tried two different setups and it seems like the pullups are required, yet some say the are not and I'm not sure why.
Thanks
Comments
With oc pins you don't have this problem. These are only driven low by the devices and defaulted to high by the pull-up.
For the propeller you could do some changes to make the SD driver work without pullups for DI/CLK by setting the pins high instead of switching to input-mode. But are you really in the need of saving this huge amount of money? ;o)
I'm using FSRW 2.6 and when I try to run mount.explicit_mount(...) it returns -100 when a SD card is present and -1 when it isn't.
I'm trying to avoid adding resistors because of space for now, just making sure I test everything before committing to adding the pullups.
Thanks
Seems like the pullups aren't required and i just had to run through the solder joints again! Those micro SD card socket joints are hard to reach :P.
Thanks for all the help and suggestions!
1. Pullups reduce power usage when the pins float. But not much.
2. A pullup should be on the /CS pin to ensure the SD card remains inactive (and this will reduce power consumption on other pins too)
3. Since the prop will drive DI, CLK and effectively /CS, they do not really require pullups (see 2. above because before the [prop runs its code /CS will be tristate so the pullup should be there, but does work without if you keep the pin driven)
3. IIRC a pullup should be on DO since this can be tristate out from the card. However, I also read that the cards have their own internal pullups now anyway - quite high but there.
Until recently,I have always put 10K pullups on the 4 pins DI, DO, CLK, /CS and left the other 2 floating. I can confirm that pullups on /CS and DO only also works and I have read others have only used a pullup on /CS. Obviously the other 2 pins are 3v3 and gnd and dont require pullups.
Ah! card detection, possibly also to keep the card deselected at insertion. And it can be turned off/on by a software command. Some documents emphasize that the resistor is on by default. It is too bad all this information is such a closely guarded secret. If you want to use it for card detection, you'd have to leave off your own pullup resistor, and maybe use a very weak pulldown instead. Has anyone tried that?
The SD physical layer specification does not have much to say about pullup resistors, except that they should be used to prevent excessive current from floating inputs. That applies especially to pins 8 and 9 on the card (the ones on opposite ends), which are not used in SPI mode on the Propeller.
This got me thinking about my assumption that the default state of the pins is high, so I hooked it up to the 'scope. I was mistaken. So long as the card is mounted, the DO, DI and SCK pins stay low during periods of card inactivity. Only CS is is high during those periods, and then goes low when the card is being accessed. When the card is un-mounted, released, the DO is tri-stated and can be pulled high by the external resistor. But it looks like SCK and DI driven from the Propeller stay at the low level (FSRW). This matters in super-low power systems, because you don't want current wasted in pullup/down resistors. In those systems you want to turn the card power off completely, but sometimes that is not possible. So that is a reason to leave pullups off of DI and SCK.
Here are the measured values of the pull-ups on CS:
Sandisk 4GB HDSC 70kΩ
Transcend 2GB SD 20kΩ
Transcend 2GB µSD 45kΩ
PNY 4GB SDHC 20kΩ
Panasonic 16MB SD 45kΩ (yes, MB not GB--an really old card)
A small sample, but none lacked it. It is weak but would normally suffice to keep the card deselected, and it could (as the SD spec suggests) be used as part of a card present detection scheme.
On the other lines of those SD cards, there were no pullups, at least none heavier than the order of of 10+ MΩ of leakage current.
-- DO output line from the chip is tri-stated when chip select is high, as it must be for it to play nice on an SPI bus with other slaves. It will float if it does not have an external pullup and no other source drives it.
-- DI and SCK inputs to the SD are are controlled by the master, in our case the propeller. Under FSRW those lines are also tri-stated to high impedance when the SD card is deselected. A programmer might choose to leave those prop pins either high or low instead of input in order to avoid having to install an external resistor.
I think the answer to the OP is that the cards can be expected to work well without pullups, but anyone designing a commercial product should put them in.
I think some of the very old cards needed them, but any within the last couple years should be fine.
Instead of pull-ups, you can use the four 10k resistors for card detection without using any more pins...
Check out my PSM schematic to see how...
If the pull-up is turned off with software, does it come back again when power is cycled?
The spec, the current "simplified" version 3.01 does not state emphatically that the pullup on CS\ shall be turned on by default. Thus I wanted to test a few. I have a copy of the full (not "simplified") earlier version 1.0 of the spec, and it does not say either. Peter, have you ever run across one that did not have the pullup enabled?
I don't know the answer to the question about whether it would come back on automatically after being turned off, but my guess is that it is a non-volatile eeprom setting. I don't know why one would want to turn it off. I is certainly a nice option for card detection and would avoid having to implement a separate pin to the CD switch.
On the down side, the pullup is weak. Suppose the next pin over is running PWM at the same time that a card access is happening. Coupling could induce an error, but I don't think I have ever had a problem with that using 10k pullups.
As for card detection, see Kye's driver. It uses 2 series 10K pullups. The junction goes to the card detect switch to ground. So it changes the pin from pulled up to pulled down. Not sure whick pin this is on. He does the same for write protect, but this is not available on microSD cards - too small.
Full size SD cards still have the manual WP slider though. I think my 2-resistor scheme is still a good way to detect that without using extra pins...
It is NOT so simple.
Some cards need all resistors some NOT.
BUT For not confusing SD in commands mode it is better to have all 6 installed --->
That for Not confusing SD if You work in SPI else 4-Bit's mode.
On my end I work on 4-Bit's mode driver that why I know what it need's
BTW Happy New Year - havent seen you on msn lately (mainly because I have not been on much).
I don't need reverse engineering as I have original data sheet to 4-Bit's mode with all needed info to build driver's.
BUT I'm not sure of license if it is free.
Ps. My MSN is always ON so write to it -- If I'm with computer I answer directly else answer as fast I'm coming home.
I've tested a lot of them and haven't found one yet...
If I knew there were some newer SD cards around that needed pullups, I'd change my current plans to leave them off...
The pull-up on the CS line is built-in to the card and guaranteed to be connected, so why add one externally when this gives you no advantage and only means that you can no longer use the CD detect from CS method? The card cannot be "inadvertently" activated even if you were to pull the CS low as you still need to issue a command sequence anyway.
It makes it soooo much easier to sloder, just slide the plastic part fwd and it hinges up for easy access to the pins.
The solder points on the metal shell were a little off on one of them but does make life easier.
I am sure a lot of you have already found it.