Go Down

Topic: Small SDCard library (Read 5073 times) previous topic - next topic

fishermans

Hello

Is there anybody hwo knows a small library for SDCards?
My program is to big so I can't use the arduino library.
I found "filelogger" but it runs not on my arduino 1.01.
I make all changes and get no compiler errors but I only
get an initialisation error.

Can anybody help me?

PaulS

Quote
Is there anybody hwo knows a small library for SDCards?

The limit on the size is the fact that SD cards are written to in blocks of 512 characters at a time.

Quote
Can anybody help me?

Get a Mega.

fishermans

It's not always meaningful to take the biggest prozessor  :)
The 328 is better for normal layouts and 10kb memory only
for logging is unacceptable for my applikation.

countrypaul

Exactly which library are you using? If using the SD try switching to SDfat (leaner faster and better supported).

Paul

fat16lib

You might want to look at my Fat16 library http://code.google.com/p/fat16lib/downloads/list.

It's smaller than my SdFat library but only supports FAT16 on standard SD cards.

Constantin

SdFat16 works great. You can download it here

fishermans

I try the library and it works really good. Thank you very much for help.
The library save over 5 KB space.

doughboy

is it correct that you can only have 2GB max partition size with fat16?

fat16lib

The SD standard requires FAT16 formatted cards to be 2GB or less.

The standard requires SDHC cards, 4GB - 32GB, to be formatted FAT32.

liudr

fat16lib. Thanks for the library. I will try your library too. I just started using SD card and am using SD library from adafruit. I can't find manual to the library. Your library is documented with doxygen. Awesome!

With adafruit SD library, the sample write code takes 1.1KB of SRAM.

https://github.com/adafruit/SD

DenJS

Hello!

Try to get work sdfat16 with Arduino Ethernet with no luck :( init return error.
Meanwhile SD and sdfat16/32 are working good! Any ideas?
Thanks!

fat16lib

Format a Standard SD card, 2GB or less with SdFotmatter https://www.sdcard.org/downloads/formatter_3/.

Change line 187 of the fat16info.pde example to:
Code: [Select]
  if (!card.init(0, 4)) {
This selects full SPI speed and pin 4 as chipselect.

Run the fat16info example and post the output.

Post your the init code for Fat16 and any output.

DenJS

Hello!

Okay, I've made some magic gestures:

1. Arduino Ethernet board with inserted microSD card (SanDisk, 2GB, formatted with SDFormatter)
2. fat16info.pde with if (!card.init(0, 4)) {
3. Result is:


Fat16 version: 20111205
FreeRam: 1261

type any character to start
card.init failed
SD error
errorCode: 1
errorData: 0

type any character to start


And next test:

1. Same Arduino Ethernet board with same microSD card.
2. SdInfo.pde (from sdfat16/32 library) with const uint8_t SdChipSelect = 4;
3. And result is:

SdFat version: 20121203

type any character to start

init time: 12 ms

Card type: SD2

Manufacturer ID: 0X3
OEM ID: SD
Product: SU02G
Version: 8.0
Serial number: 1408082784
Manufacturing date: 6/2010

cardSize: 1977.61 MB (MB = 1,000,000 bytes)
flashEraseSize: 32 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0X6,135,3858489
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT16
blocksPerCluster: 64
clusterCount: 60281
freeClusters: 60281
freeSpace: 1975.29 MB (MB = 1,000,000 bytes)
fatStartBlock: 136
fatCount: 2
blocksPerFat: 236
rootDirStart: 608
dataStartBlock: 640

type any character to start


What I'm doing wrong with fat16 library? :(
Btw, I tried 4 Arduino boards with same result, except one which has custom bootloader with TFTP support, here is result of fat16info.pde:

Fat16 version: 20111205
FreeRam: 1261

type any character to start

init time: 237

Manufacturer ID: 3
OEM ID: SD
Product: SU02G
Version: 8.0
Serial number: 1408082784
Manufacturing date: 6/2010

Card Size(blocks): 3862528

Partition  Table:
part,boot,type,start,size
1,0,6,135,3858489
2,0,0,0,0
3,0,0,0,0
4,0,0,0,0

FAT Volume info for partition: 1
Volume is FAT16
clusterSize: 64
clusterCount: 60281
fatCount: 2
fatSize: 236
totalBlocks: 3858489

Root Directory:
name     ext att size

Done

type any character to start

And same board with SdInfo.pde:

SdFat version: 20121203

type any character to start

card.init failed
SD errorCode: 0X1
SD errorData: 0X0

type any character to start


That's really odd for me :(
Hope you could help.
Thank you!

fat16lib

Looks like the Ethernet controller is causing the problem.  It's chip select is pin 10 which is also SS for 328 Arduinos.  In SdFat I set SS as an output and set it high.  SD.h also is based on SdFat so it's O.K.  In Fat16 I only make SS an output so it will be low.

To disable the Ethernet controller put his before the line with card.init().
Code: [Select]

  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);


I will add this to Fat16.  The Ethernet shield didn't exist when I wrote Fat16 so I didn't make SS high when it was not chip select.

DenJS

Thank you very much! It works!

Go Up