[Solved?] SD Card Shield - FileLogger Library

I can’t append to a file using the FileLogger library with the SD Card Shield.
My problem is listed here

Try to use the 3.3V for power supply and test if the power pin of SD card has a 3.3V level input.

See the topic in arduino.cc you posted ,it seems that the library don’t support the SD card which you use now.

Make sure your card is SDHC or SD/MMC. use SPI mode to read a SDHC is more complex than SD/MMC.

  1. need to decide the card is SD/MMC or SDHC
  2. SDHC CSD structure is different from SD/MMC
  3. SDHC read/write use the BLOCK for a unit and the SD ues Byte .

And if some card which initialize cost more time than normal that the code will fail in initalization.

The card I am using, as mentioned in the Arduino topic, is this one and SDHC cards from the same brand are marked like this so unless the label is wrong I have an SD Card.
I am using the library which is provided on the product page but I have also used the library directly obtained from the author as well.

the SD/MMC driver of this library just support the sector which 512Byte . If you just format you SD card to FAT but don’t format the sector to 512Byte the library can not support.

Window’s format utility won’t let me format (“format F: /FS:FAT /A:512”) the 2GB SD Card with a byte sector of that size, bought a 1GB Fujifilm SD Card but same problem. I tried using Linux’s mkdosfs which appeared to format the card using that sector size but it didn’t make seem to make a difference when I used the library with the SD Card Shield.
Interestingly enough if I format the 1GB SD Card using Window’s format via cmd.exe (Not GUI utility) using “format F: /FS:FAT” and place the empty data.log once more, it manages to get past the area it was stuck at but then gets stuck (or just takes too long, left it for about 10 minutes) within findLastCluster(), nanofat.cpp.
Surely it shouldn’t be this difficult to set this up.

Try this again:
1 fomat your 1G SD card to FAT use the windows tool.
2 Dowload the fileloger library and demo code to your Arduino.
3 sent the “W” to Arduino use the serial monitor of IDE.
4 see the responses on the serial monitor , the first time it may be " Result: Fail initializing"
5 sent the “W” again until respons is “OK” .

for some card I have to try 3 times it return OK and then you can use it as normal. I don’t know why specifically but it must be the code error.

That’s what I did initially but I’ve tried it again, these are the steps I followed.
1: Formatted the 1 GB SD Card with FAT, no volume label and default allocation size.
2: Copied an empty “data.log” file to the SD Card.
3: Switched shield to 3.3V (Though I also tried D9)
4: Changed MEM_PW in example code to 9 (Though I also tried leaving it at 8)
5: Uploaded example code with fresh FileLogger library from Product Page (Also tried library from Author)
6: Tried sending ‘W’ every few seconds for about 3 minutes, all resulted in “Result: Fail initializing”

What SD Card (size and brand) do you use with this shield? Which platform (Arduino/Seeeduino etc.) do you use with the shield?

I use the Kingston 1G and 256M card to test this library.

If it still not work that may be you must to find another library for your card or modify the library even write the operation code yourself.

The /A:512 does not specify a sector size of 512 bytes. This specifies the allocation size, which is also known as the cluster size. A cluster is made up of many sectors. Any SD card of 2GB or less, or SDHC cards should use a sector size of 512 bytes. SD cards larger than 2GB often use sector sizes that are larger than 512 bytes, and are not supported by many of the open source libraries.

Then how do I specify the sector size using the Windows utilities and why didn’t it work with mkdosfs?

the size of each sector be decide by the BLOCK_LEN register of the SD card controller and not by the PC. And the size of sector is do with the size of SD card. Because the addressing number is limited and if want to addressing more capacity you must to increase the unit capacity for each address : the sector size.

Tried increasing block size, unfortunately my poor Arduino didn’t have enough memory. Also, that didn’t answer my question on how to format the SD Card with a suitable sector size for the library default of 512.

I’ve given up, I suggest anyone buying the SD Card Shield to not bother until someone actually writes decent code for it.

Hello.

I found the way out:the FAT16 supports blocks of 512 bytes only for sizes up to 64MB.

So, I partitioned my 1GB SD card with one partition of 64MB (yes, I know, I wasted a lot of space) and then I was able to format it with

format f: /fs:fat /a:512

Then Filelogger works like a charm.

Bye

I have no idea what I did but I had some free time and decided to take another crack at it, unzipped another copy (Same copy I’ve been using) formatted the 1GB SD Card (One of the ones I’ve been using) with fat16 (No special options) using Linux and created a 1 byte file to append to, compiled and uploaded the example code to the Arduino and tada, long behold it works.

I have no idea what I did but it’s never worked till now.

code.google.com/p/arduino-filelogger/

May be you could submit your problem here~ : code.google.com/p/arduino-filelogger/issues/list