I've been aware of SD card SPI interfaces needing some 10K pullups. I'm just trying to understand the reason for the pullups.
My logic is that before the SPI host is running, the pullups provide a HIGH logic to prevent any SPI device from receiving random noise and act on them like they were data (or command in case of SD cards).
If that is the case, why not just having one pullup on CS pin and not the rest?
OK if the SPI host starts up before SPI device, then it may want to talk to the device. And if the MISO is not pulled up, it will read some random stuff and think it's data. So that requires MISO to have a pullup.
Could someone critique my above logic and explain why MOSI and SCK would need pullups? Thanks.
Well, the SD card has an internal nominal 50K pullup resistor on its pin that receives the CS line. So that line will be high anytime the card is inserted and powered up. But I believe all three Arduino SPI output lines are configured as output high or low, and if that's the case there should be no need for pullups on them.
I think it's only MISO that I've seen legitimate reports of it not working without a pullup. MISO has to go tri-state anytime its CS isn't asserted, and some SD card makers may have decided to just make that output open collector to meet that requirement. I think it would be safe to have a pullup on MISO just so you don't have to worry about what brand your card is. But for major brands, it might well work just fine without the pullup.
For my SD card projects, I put a pullup on MISO, but not the other lines. So far, everything has worked with that arrangement.
One thing that might change all of that is if you ever use MMC cards. I don't know what the spec is on those.
Great! Thanks. So far no good reasons for pullups on SCK or MOSI yet.
MOSI: 0 votes
MISO: 2 votes
SCK: 0 votes
CS: 1 vote (or 1.5?)
I'm thinking, if arduino's SS pin is pulled low, it may cause arduino to act as SPI slave and that would require pullups on both SCK and MOSI to prevent problems.
The 'SanDisk SD Card. Product Manual. Version 2.2' says that;
"The extended DAT lines (DAT1-DAT3) are input on power up. They start to operate as DAT lines after the
SET_BUS_WIDTH command. It is the responsibility of the host designer to connect external pullup resistors to
all data lines even if only DAT0 is to be used"
Dat1 and Dat2 are not used in SPI mode, and neither is connected to the header of the typical SD module. And I don't think any module I've seen bothers to pull them up. Dat0 is MISO, and Dat3 is CS, which is driven by the MCU. So I think we're still back to needing a pullup on MISO.
On my custom boards, I use cd74HC4050 powered from 3.3V to buffer SCK, MOSI, CS (with a pullup resistor on the input) to create 3.3V to the SD card. DataOut from the SD card is buffered with 74HC125 with gate controlled by CS. Seems to work well, keeps SD card off the MISO bus when it is not selected so ICSP programming is not impacted. The card's CS is also High until the processor takes control of it.
And then I use the extra gates of the '4050 and '125 for other things as well.
I've been using SanDisk SD cards. They seem to be larger capacity every time I buy a batch of 25 or 50. I think the latest are 32GB, altho I am using less than 2GB to store up to 256 256K .hex files. (about 67.1 million bytes).
liuzengqiang:
Could someone critique my above logic and explain why MOSI and SCK would need pullups? Thanks.
You asked a question about 'SD cards' but can you clarify if you are actually using some unknown SD Module ?
The pullup requirements for an 'SD Card' and an SD module are different ..............
I guess in practice, not using pullups on any of the pins may just work. Wonder if there is a standard for pullups. I'm considering a large build so it's not going to be sd cards, sd nand IC instead.
To answer srnet's question, here is the relevant information on the sd IC I'm using. It's not a breakout board, an IC with LGA8 packaging. So I guess the CMD and DAT lines either all have internal pullups of 10-100kohm, or all require pullups of that range. Except for DAT3, which has pullup inside. This is probably the CS pin, which is the most crucial pullup. I'll have to find out with their tech support. If you multiply 10kohm with 10pF, you get a time constant of 0.1us, which is hardly matching the 25MHz/50MHz operating frequency. Am I missing something?