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

SD Card Data Logging

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



Joined: 21 Sep 2006
Posts: 6

View user's profile Send private message

SD Card Data Logging
PostPosted: Thu Sep 21, 2006 9:13 am     Reply with quote

Hi,

I've just wired up my SD card to my PIC in SPI mode an am about ready to try sending data to it.

It seems from everything I've read that the SD cards like sending and getting information in 512 byte chunks. I'd like to save 40 bytes of data everytime I go through the main loop; is there an easy way to do this instead of logging a 512 byte buffer? Maybe sending 40 data bytes and then (512-40) null bytes, and then increment some pointer by 40 spaces?

Also, how long does it take to perform write and read (512 bytes) operations take while working in SPI mode?

Thanks!
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: SD Card Data Logging
PostPosted: Thu Sep 21, 2006 10:47 am     Reply with quote

jgrauer wrote:
It seems from everything I've read that the SD cards like sending and getting information in 512 byte chunks.


SD cards can read as little as a byte at a time however they MUST write in 512 bytes blocks aligned on a 512 byte boundary

Quote:
I'd like to save 40 bytes of data everytime I go through the main loop; is there an easy way to do this instead of logging a 512 byte buffer?


No

Quote:
Maybe sending 40 data bytes and then (512-40) null bytes, and then increment some pointer by 40 spaces?


The trick is to use a PIC with plenty of memory such as PIC18F4620 and variants with 3900 bytes of RAM.

Quote:
Also, how long does it take to perform write and read (512 bytes) operations take while working in SPI mode?


You need to check the datasheet because there is no short answer.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
ktallevi



Joined: 17 Dec 2005
Posts: 58

View user's profile Send private message

SD Card
PostPosted: Thu Sep 21, 2006 11:45 am     Reply with quote

You may want to check out DOSonaChip, it takes care of the FAT16/32 overhead for you and gives you a nice DOS-style interface over a UART or SPI connection.

http://chipdos.com/modules.htm

Might simplify life for you, good luck.
Pyrofer



Joined: 13 Sep 2006
Posts: 16

View user's profile Send private message

PostPosted: Fri Sep 22, 2006 4:22 am     Reply with quote

DOSonAChip can be bought pre-mounted with SD socket on a module from
www.sparkfun.com
Im not affiliated with them in any way, but they do some cool stuff.
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