Libelium microSD module and duemilanove hassle...

Quote "Only SdFat works. I got it to work by changing card.init = (true) in the SdFatInfo code. So I assume all my other failures have to do something with the Libelium board being accessed at 8 MHz, which seems to be too fast."

I have been struggling with the Arduino Mega and just about every SD card library for over a week, until I tried your hack. The SdFatInfo example worked perfectly, so I though, why not do the same to all other examples. It turns out that the TRUE or 1 is an argument for the function Sd2Card::init(uint8_t slow), so if slow is true, the code runs just fine. I checked deeper into the function, and pretty much the only time this argument is used is in this statement:

// if !slow set SPI frequency to f_OSC/2
if (!slow) SPSR |= (1 << SPI2X);

apparently it has to do with the clock frequency for the SPI interface, so I choose to remain ignorant and comment out this line to:

// if !slow set SPI frequency to f_OSC/2
if (!slow) SPSR |= (1 << SPI2X);

And, voila, every example now works like a charm. I don't know yet if this will come around and bite me, so if anyone can come up with a better way to explain this, i'd greatly appreciate it.

figassis