Problems with Seeebuino stalker

Hi All
I have a Seeeduino Stalker and am struggling with writing to the microSD card.
I have managed to get all other features Xbee, Clock and standard Arduino
sketches running but not the logger.

I thought the problem was the size of the microSD card 2gb so bought a couple of 128mb cards to try.

I formated the cards on Vista 1.8gb, FAT(default), 32 ,volume label stalker full format (not quick)
in notepad created file data.txt, typed the letter b, then saved it to the mictoSD card.

on the 128mb card Fat(default), allocation size 4096, did not give it a volume label, used the same notepad method.

I have been using a sketch that other from this forum developed

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1273413449

and http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267698132

added a few serial.print lines to see where it was hanging up which tells me
Tryin to open SD card…INIT FAIL

so have i got the format of the card wrong?, see anthing in the code, or any other ideas on where to go.

Hope someone can help
Cheers
Jack
[code#include “FileLogger.h” // http://code.google.com/p/arduino-filelogger/
#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library - http://www.arduino.cc/playground/Code/Time

byte start[7]= {
‘B’,‘e’,‘g’,‘i’,‘n’,0x0D,0x0A};
byte Buffer[23]; //Buffer for printing to SD card
int temp; //temp test data
time_t oldtime=0; //last time loop has ran
int result; //status of SD card write - 0 = “OK”, 1 = “Fail initializing”, 2 = “Fail appending”
unsigned long loggingRate=5; //logging rate in seconds
int length; //length of buffer string

void setup(void)
{
Serial.begin(9600); //initialize serial port
Serial.write(“Tryin to open SD card…”);
result = FileLogger::append(“data.txt”, start, 7);//Initialize the SD Card
if (result == 0) Serial.write(“OK”);
else if (result == 1) Serial.write(“INIT FAIL”);
else Serial.write(“WRITE FAIL”);

do{}while(result != 0);

// the next two lines can be removed if the RTC has been set

// setTime(10,07,0,14,5,10); // set time to 17:05:00 1 Mar 2010 (see below)
// RTC.set(now()); // set the RTC to the current time (set in the previous line)

// format for setting time - setTime(hr,min,sec,day,month,yr);

setSyncProvider(RTC.get); // the function to get the time from the RTC

}

void loop(void)
{
if( now() >= oldtime + loggingRate) //proceed with loop if loggingRate seconds have elapsed
//if(minute() != oldtime) //use this if 1 minute intervals is desired
{
oldtime = now(); //use this if loggingRate seconds is desired
//oldtime = minute(); //use this if 1 minute intervals is desired
do
{
temp=month();
Buffer[0]=(temp/10)+‘0’;
Buffer[1]=(temp%10)+‘0’;
Buffer[2]=’/’;
temp=day();
Buffer[3]=(temp/10)+‘0’;
Buffer[4]=(temp%10)+‘0’;
Buffer[5]=’/’;
temp=year();
Buffer[6]=((temp-2000)/10)+‘0’;
Buffer[7]=((temp-2000)%10)+‘0’;
Buffer[8]=’ ‘;
temp=hour();
Buffer[9]=(temp/10)+‘0’;
Buffer[10]=(temp%10)+‘0’;
Buffer[11]=’:’;
temp=minute();
Buffer[12]=(temp/10)+‘0’;
Buffer[13]=(temp%10)+‘0’;
Buffer[14]=’:’;
temp=second();
Buffer[15]=(temp/10)+‘0’;
Buffer[16]=(temp%10)+‘0’;
Buffer[17]=’ ';
temp=999;
Buffer[18]=(temp/100)+‘0’;
Buffer[19]=((temp%100)/10)+‘0’;
Buffer[20]=(temp%10)+‘0’;
Buffer[21]=0x0D;
Buffer[22]=0x0A;

length=sizeof(Buffer);
result = FileLogger::append(“data.txt”, Buffer, length); //write data to SD card
Serial.print((result?‘fail’:‘ok’));
}
while( result != 0); //repeat loop until successful write to SD card

for (int i=0; i < length ;i++) {
Serial.print(Buffer*); //Serial print buffer string to serial monitor or xBee*

  • }*
  • }*
    }
    ][/code]

Hi All Well it looks like it has to do with formating with Fat16 on a PC, and how that interacts with the library. I have now got a microSD 128mb card working by formating it on my samsung phone then put it in a an adaptor and in to the SD slot on my PC deleated the folders that the phone had created, opened up notepad created a file called data.txt typed the letter b and saved it to the microSD card so not a null data file.... and it worked... repeated the whole process with a 2GB card and that did not work. so it works sort of ... but not got a clue why, hope it helps someone else

Cheers Jack