Libelium microSD module and duemilanove hassle...

mowcius: can you post the setup an code you were using?

Sure thing.

I am using the standard code:

#include "SDuFAT.h"

// define the pin that powers up the SD card
#define MEM_PW 8

// help string to be sent to the serial port
#define HELP "H help\nL file info\nD delete\nP append string\nW init file and write\nR dump to serial\nA append text\n"

// variable used when reading from serial
byte inSerByte = 0;

void setup(void)
{
  // on my MicroSD Module the power comes from a digital pin
  // I activate it at all times
  pinMode(MEM_PW, OUTPUT);
  digitalWrite(MEM_PW, HIGH);
  
  // configure the serial port to command the card and read data
  Serial.begin(19200);
}

void loop(void)
{
  // Arduino expects one of a series of one-byte commands
  // you can get some help by sending an 'H' over the serial port
  if (Serial.available() > 0) {
    int result = 0;
    inSerByte = Serial.read();
    switch (inSerByte) {
    case 'H':
      Serial.println(HELP);
      result = 3; // special output for help message
      break;
    case 'L':
      result = SD.ls("hola.txt");
      break;
    case 'R':
      result = SD.cat("hola.txt");
      break;
    case 'W':
      result = SD.write("hola.txt");
      break;
    case 'A':
      result = SD.append("hola.txt");
      break;
    case 'P':
      result = SD.println("hola.txt","\nhola caracola");
      break;
    case 'D':
      result = SD.del("hola.txt");
      break;
    default:
      result = 2; // value for unknown operation
      break;
    }
    
    // print a status message for the last issued command
    // for help (result == 3) won't print anything
    if (result == 1) SD.printEvent(ERROR, "hola.txt");
    else if (result == 2) SD.printEvent(WARNING, "unknown command");
    else if (result == 0) SD.printEvent(SUCCESS, "hola.txt");
  }
}

I am using the jumper on 5v with the module connected to the digital pins however it also works if I change to ICSP and switch the jumper (no change to code).

I am using a 2GB microSD card (unbranded -the one I got with it) but it works with all my SanDisk cards too. This one is FAT formatted using standard windows XP formatting.

On the card I have hola.txt with 25 [ETX] characters however it seems to work with any number of the characters or just one at the end and the rest as spaces. I can see the [ETX] characters using notepad++, in notepad they come up as boxes (unknown characters).

Hope that helps,

Any more questions? Go ahead! :wink:

Mowcius