View previous topic :: View next topic |
Author |
Message |
diegonet
Joined: 13 Sep 2005 Posts: 4
|
TESTERS NEED! SD CARD FAT16 LIBRARY |
Posted: Sat May 06, 2006 4:43 pm |
|
|
Hi to everyone.
In my search of a good and FUNCTIONAL SD Card FAT16 library I found
one from the circuit cellar 176, autored by Ivan Sham.
This one has been write for a mps procesor, so I do the convertion's to work with a PIC microcontroller.
The connection is quite simple (I also attached a schematic of my test platform with a 18F6722).
Any other micro with 1024 bytes of RAM would be ok.
I could write and succefully read a file to the root directory of a 512 megs FAT16 card.
I dont' test the directory support.
I have problems writing a big quantity bytes of data. Small packet's are writting without problem.
So I requesting help to solve this. Also I don't have clear how the writtings are managed, as the card's
need 512 writes, do the library read a sector, update with the new data and write all the 512 bytes again?
Are this function working ok?
I believe that this could very usefull for everyone. The code is well commented, so I hope that many users would
contribute to do the finals touchups.
Thank's!
Link to files:
http://rapidshare.de/files/19805520/ByDiego.zip.html |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Sat May 06, 2006 10:18 pm |
|
|
From memory (I may be wrong) this code does not have support for subdirectories. I think you will find it was a "wet your appetite" type of article so you will check out their full stack and buy it. The code needs more than just touching up, the remaining 60% or more needs to be developed.
Writes to SD/MMC cards are in 512 bytes blocks. If you wanted to modify just a single byte of an existing sector you must read in the entire sector to ram, make the mod in the ram, and then write out the 512 byte block to the media and then update all relevant director entires (in 512 byte blocks)
If you want to be able to have several files open at a time you really need to add some additional memory to the PIC. A FRAM FM25256 is a good choice as it offers a low pin count interface (SPI) and coexists with the SD card.
In addition to the optional memory, the SD/MMC circuit needs more work:
1. It needs a level converter from the SDO of the SD/MMC card to the SDI of the PIC. If you look at the guarenteed switching level inputs for detection of a logic on on the PIC and the guarrenteed logic 1 output level from an SD/MMC card you will see you are actually out of spec. It may work in most situations - they again, it might not. One way to solve this is to put a TTL level gate in line between the SD/MMC card and the PIC.
2. The circuit shows a decoupling capacitor on the MAX232 chip but none on the PIC or on the SD/MMC card - both required decoupling.
Here is a link to a design interfacing a PIC with a SD/MMC card, a FRAM and an ENC28J60 Ethernet controller.
http://www.brushelectronics.com/download/BE_LDR_Ref_HW.zip _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Sun May 07, 2006 11:29 am |
|
|
A word of caution FAT is fully owned by Microsoft. Working with FAT in any capacity including testing without purchasing a permission from Microsoft may well be unlawful. Permissions from Microsoft can cost a maximum of $250,000. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|