View previous topic :: View next topic |
Author |
Message |
jgrauer
Joined: 21 Sep 2006 Posts: 6
|
SD Card Data Logging |
Posted: Thu Sep 21, 2006 9:13 am |
|
|
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
|
Re: SD Card Data Logging |
Posted: Thu Sep 21, 2006 10:47 am |
|
|
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
|
SD Card |
Posted: Thu Sep 21, 2006 11:45 am |
|
|
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
|
|
Posted: Fri Sep 22, 2006 4:22 am |
|
|
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. |
|
|
|