"SD.h" works and "tinyFAT" not ...
hi,
i have arduino mega and shielded tft sd card.
when use "# include <sd.h> works ok ..
but when use "# include <tinyfat.h> can not open card
i tried format on windows fat(predefinition) , fat32
all libraries originals:
tinyfat --> http://henningkarlsen.com/electronics/library.php?id=37
the next code return: "unsupported filesystem"
i have arduino mega and shielded tft sd card.
when use "# include <sd.h> works ok ..
but when use "# include <tinyfat.h> can not open card
i tried format on windows fat(predefinition) , fat32
all libraries originals:
tinyfat --> http://henningkarlsen.com/electronics/library.php?id=37
the next code return: "unsupported filesystem"
code: [select]
#include <tinyfat.h>
#include <avr/pgmspace.h>
byte res;
long msstart, msend, mstotal, msavg, mshigh, mslow;
char *verboseerror(byte err)
{
switch (err)
{
case error_mbr_read_error:
return "error reading mbr";
break;
case error_mbr_signature:
return "mbr signature error";
break;
case error_mbr_invalid_fs:
return "unsupported filesystem";
break;
case error_bootsec_read_error:
return "error reading boot sector";
break;
case error_bootsec_signature:
return "boot sector signature error";
break;
default:
return "unknown error";
break;
}
}
void setup() {
// initialize serial communication @ 115200 baud
serial.begin(9600);
serial.println();
// initialize tinyfat
// might need select lower speed default spispeed_high
res=file.initfat();
serial.println(res,hex);
if (res!=no_error)
{
serial.print("***** error: ");
serial.println(verboseerror(res));
while (true) {};
}
serial.println("this program measure average time call writeln()-function takes.");
serial.println();
serial.println("***** send character start *****");
while (!serial.available()) {};
serial.flush();
if (file.exists("spdchk.fil"))
file.delfile("spdchk.fil");
file.create("spdchk.fil");
res=file.openfile("spdchk.fil", filemode_text_write);
if (res==no_error)
{
mstotal=0;
mslow=1000000;
mshigh=0;
serial.print("<");
for (int cc=0; cc<64; cc++)
{
if (((cc+1)%16)!=0)
serial.print("-");
else
serial.print("+");
}
serial.println(">");
serial.print(" ");
for (int cc=0; cc<1024; cc++)
{
msstart=millis();
file.writeln("speedcheck - random line of text.");
msend=millis();
mstotal+=(msend-msstart);
if ((msend-msstart)<mslow)
mslow=msend-msstart;
if ((msend-msstart)>mshigh)
mshigh=msend-msstart;
if (((cc+1)%256)==0)
serial.print("+");
else if (((cc+1)%16)==0)
serial.print("-");
}
file.closefile();
file.delfile("spdchk.fil");
serial.println();
serial.println();
}
else
{
switch(res)
{
case error_another_file_open:
serial.println("** error: file open...");
break;
default:
serial.print("** error: ");
serial.println(res, hex);
break;
}
}
serial.println("sample size : 1024 samples");
serial.print ("average time: ");
serial.print (mstotal/1024, dec);
serial.println(" ms");
serial.print ("highest time: ");
serial.print (mshigh, dec);
serial.println(" ms");
serial.print ("lowest time : ");
serial.print (mslow, dec);
serial.println(" ms");
serial.println();
serial.println("***** done... *****");
}
void loop()
{
}
quote
i tried format on windows fat(predefinition) , fat32
curious.
quote
the library supports fat16 formatted sd cards 2gb in size. 4gb fat16 formatted sd cards not work. long filenames not supported. keep filenames compliant old 8.3 standard.
Arduino Forum > Using Arduino > Programming Questions > "SD.h" works and "tinyFAT" not ...
arduino
Comments
Post a Comment