CardInfo works but ReadWrite doesn't.

Greetings,

I am having a really difficult time convincing my Arduino UNO R3 to talk to an SD card. I have tried two different SD card readers, one for micro and the other for full size devices. In both cases I can get CardInfo to successfully read the card, but the ReadWrite example fails.

With the microSD, the ReadWrite example corrupts the card. With the full sized device, the file is successfully created, but nothing gets written to it.

Has anyone else had this experience, and managed to solve it?

Peter.

It maybe too high SPI speed....

#ifndef Sd2Card_h
#define Sd2Card_h
/**

  • \file
  • Sd2Card class
    /
    #include "Sd2PinMap.h"
    #include "SdInfo.h"
    /
    * Set SCK to max rate of F_CPU/2. See Sd2Card::setSckRate(). /
    uint8_t const SPI_FULL_SPEED = 0;
    /
    * Set SCK rate to F_CPU/4. See Sd2Card::setSckRate(). /
    uint8_t const SPI_HALF_SPEED = 1;
    /
    * Set SCK rate to F_CPU/8. Sd2Card::setSckRate(). /
    uint8_t const SPI_QUARTER_SPEED = 2;
    /
    *
  • Define MEGA_SOFT_SPI non-zero to use software SPI on Mega Arduinos.
  • Pins used are SS 10, MOSI 11, MISO 12, and SCK 13.
  • MEGA_SOFT_SPI allows an unmodified Adafruit GPS Shield to be used
  • on Mega Arduinos. Software SPI works well with GPS Shield V1.1
  • but many SD cards will fail with GPS Shield V1.0.
    */
    #define MEGA_SOFT_SPI 0

change MEGA_SOFT_SPI 0 to 1 or 2 in Sd2Card.h

Regards,

Graham