Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 11th December 2008, 09:36 PM   #1
Default SPI\SD Card Query

Hi All,

When accessing an SD Card in SPI mode should I pull up the unused contacts on the card?

I havent found a definitive answer to this one - I have seen circuits which demonstrate using pullups and some that don't bother.

What do you recommend?

Thanks in advance.

Mark
UTMonkey is offline  
Old 11th December 2008, 09:42 PM   #2
Default

Quote:
Originally Posted by UTMonkey View Post
Hi All,

When accessing an SD Card in SPI mode should I pull up the unused contacts on the card?

I havent found a definitive answer to this one - I have seen circuits which demonstrate using pullups and some that don't bother.
YES. The used ones should be pulled up as well. It's in the documentation somewhere.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 11th December 2008, 09:50 PM   #3
Default

Hi Futz,

Long time no hear - hope your keeping well.

I am building an SPI\SD Card circuit from scratch, I am favouring the attached circuit which uses resistors as 3.3v level shifters.

How would I "Pull up" these?

Regards

Mark
Attached Thumbnails
SPI\SD Card Query-th_mmc.png  
UTMonkey is offline  
Old 11th December 2008, 09:56 PM   #4
Default

Quote:
Originally Posted by UTMonkey View Post
I am building an SPI\SD Card circuit from scratch, I am favouring the attached circuit which uses resistors as 3.3v level shifters.

How would I "Pull up" these?
I'm not much of an electronics expert, but I would guess you would make those voltage dividers pull up by making the high side resistor a bit weaker than the low side one?

But don't quote me on that. Now someone will give you a better answer and I'll learn something.

Chances are it'll work fine without pullups on the lines you're using, but I don't know for sure.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 11th December 2008 at 09:59 PM.
futz is offline  
Old 12th December 2008, 01:22 PM   #5
Default

to pull them high i would put 3 resistors (4.7k) from the TOP of the divider to the to 5v.

Or just make sure those pins stay HIGH when not in USE.

Last edited by AtomSoft; 12th December 2008 at 01:22 PM.
AtomSoft is offline  
Old 20th January 2009, 08:34 PM   #6
Default

Hi Jason.

Sorry for not replying sooner

Quote:
to pull them high i would put 3 resistors (4.7k) from the TOP of the divider to the to 5v.
I am not sure what that means, I don't see how those 3 resistors would allow give a high 3v when there is a 0volt output on the 5v line and then drop low when the 5 volts output is high.

Warning, i am very slow at picking up electronics theory....

Mark

Last edited by UTMonkey; 20th January 2009 at 08:35 PM.
UTMonkey is offline  
Old 20th January 2009, 08:42 PM   #7
Default

Don't pull them up, SPI is not tristate for the active device. You'll mess up the simple voltage divider. I2C requires pullups.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is online now  
Old 20th January 2009, 09:00 PM   #8
Default

Thanks Bill, not really sure I understand your "tristate" statement - perhaps I really should get my hands on a 74XX245 as most of the examples suggest (which has pullups on the 3v bus side which is confusing).

Just correct me if I am wrong but would the difference between a circuit which uses pullups and a circuit that does'nt mean that i should alter the CKE CKP appropiately (active high vs active low)?

Did that last paragraph make any sense????


Regards

Mark
UTMonkey is offline  
Old 20th January 2009, 09:09 PM   #9
Default

The pins are driven from both the master and slave in 3 wire SPI mode.
Since your microcontroller is the master clock its SDO and SCK pins are 0-5V drivers and the SD cards SDO is driven not open collector.

The only real problem will be if your micro has Schmidt trigger inputs on SDI as 3.3V will probably be too low for that input.

A neat chip is the 74VC1T45 for level translation, or a 74HCT125 or a MOSFET may work.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is online now  
Old 20th January 2009, 09:12 PM   #10
Default

Thanks Bill - the Micro is a PIC 18f2550.

Mark
UTMonkey is offline  
Old 20th January 2009, 09:20 PM   #11
Default

Then it's going to need a boost on the SDI pin. The 74HCT125 is common and it works for SPI. The resistor bits are fine for the SDK, SDO and CE outputs from the PIC.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is online now  
Old 20th January 2009, 10:14 PM   #12
Default

UTMonkey, may I ask what resources you are using in your project? I too want to interface an SD card and a PIC, but have only been reading the application notes.
MrJammin is offline  
Old 21st January 2009, 12:30 PM   #13
Default

Mr Jammin,

just a 18f2550 on a breadboard using (or attempting to use) hardware SPI to an SDCard (powered by 3.3v) via resistors forming a potential divider to convert 5v outputs to 3v.

There are loads of resources and threads on this site which are really useful.

The problem I am having is at the reset stage of the SD card (the very beginning), the SPI module does report receiving data but it is either 0xC0 or 0xE0 when it should be 0x01.

I am trying to rule out whether the potential dividers are at fault or perhaps is should take the more robust approach and use level shifters (74x125, 74x245).

Mark

Last edited by UTMonkey; 21st January 2009 at 12:35 PM.
UTMonkey is offline  
Old 21st January 2009, 12:33 PM   #14
Default

Quote:
Originally Posted by blueroomelectronics View Post
Then it's going to need a boost on the SDI pin. The 74HCT125 is common and it works for SPI. The resistor bits are fine for the SDK, SDO and CE outputs from the PIC.
Thanks BIll, so the upshot is that my PD's may not be at fault but the MISO line could do with a lift?

Regards

Mark
UTMonkey is offline  
Old 21st January 2009, 12:33 PM   #15
Default

Did you put a level shifter on the PIC SDI pin or is it directly connected to the SD card?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is online now  
Reply

Tags
card, query, spisd

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
IR Query yori Electronic Projects Design/Ideas/Reviews 2 7th January 2008 02:58 PM
query savnik Micro Controllers 17 24th June 2007 01:30 PM
LNB query jeevan772006 Electronic Projects Design/Ideas/Reviews 5 11th December 2005 12:17 PM
amp query monkeytree Electronic Projects Design/Ideas/Reviews 12 19th October 2005 07:27 PM
smart card.....or Xphone card circuit bogdanfirst General Electronics Chat 4 23rd September 2003 12:14 AM



All times are GMT. The time now is 03:24 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker