Pages: [1]   Go Down
Author Topic: Small SDCard library  (Read 4671 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 652
Posts: 50868
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Leeds, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Paul
Logged

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1673
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

SdFat16 works great. You can download it here
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

SF Bay area
Offline Offline
Sr. Member
****
Karma: 3
Posts: 274
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1673
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 75
Posts: 7303
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

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

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1673
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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? smiley-sad
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 smiley-sad
Hope you could help.
Thank you!
Logged

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1673
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much! It works!
Logged

Pages: [1]   Go Up
Jump to: