CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SDCARD -- interfacing with PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nidhimittalhada



Joined: 06 Sep 2010
Posts: 21

View user's profile Send private message

SDCARD -- interfacing with PIC
PostPosted: Thu Dec 09, 2010 3:51 am     Reply with quote

Hi all
I have to write some information on sdcard ...for persistent storage to be reffered and interpreted later.

Now I read that .SDCARD works in 2 modes sd mode and spi mode ...
which have different protocol and pin structure ...but which one should i choose for simple writing ...and why should one mode be chosen over other ...

i read that sdcard can have filesystem over it ...Should i use it with filesystem or without it .....

Can you please give me some document exaple prorgram or guidance how should i proceed
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Thu Dec 09, 2010 5:36 am     Reply with quote

Answer to second first: - will depend on what you want to do with the data. If you want it to be reasonably easy to read with a PC, then it needs a file system.
Then, if the card is 2GB or less, you can use FAT16. If over, it gets more complex, with you having wither to split the card into two smaller partitions, or use FAT32.
If 2GB, is big enough for you, then stick with FAT16. It is simpler, and faster.

SPI mode. _much_ easier to drive from a PIC. The code to control a card, and the basic file system drivers are standard items. The 'basis' comes with the compiler, _but_ there are better 'working' libraries available for small fees. Asmallri who posts quite regularly here, sells a library, including support for FAT32, and all the 'work' for talking to files done 'for you; together with example circuits for how to do the interface, on his web site. A search will find details. 'brushelectronics'.

Easiest interface, use a 3.3v PIC. Otherwise you do have to buffer the lines between the chips.

As for 'why', there are actually three modes. SPI mode - the PIC has the hardware for this, and it is a standard. Then there are two SD modes. One bit, and four bit. Two separate data channels (so extra pins needed), and the transfer format is proprietary (no hardware on the PIC) The four bit mode uses even more pins. Speed is potentially faster, but for a PIC, the limiting factor will be the speed of the chip, not the interface, and without the hardware to do the transfer for you, will end up being slower. A lot more code needed too, to handle the interface.....

Caveat, keep card sizes under 4GB, whatever your decision about a file system. There is another change in the interface for larger cards....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group