Go Down

Topic: SD.begin() returns false (Read 1 time) previous topic - next topic


What board type are you trying to run this on? I ask because the default SS signal name is on different pin number for mega boards Vs 328 based boards.



I wouldn't assume, then, that 10 is the correct pin.

Im sorry. I thought that the chipselect pin is necesary for all communication via SPI.

I have an Arduino Uno R3 with an ATMEGA 328.

My wiring is this:
10 - CS
11 - MOSI
12 - MISO
13 - SCLK

I tried all other pins (2 - 9) for the CS pin as well.


Hey marian, I don't know if you got this to work already or not but I ran into the same problem and figured out (through the help of others on this board) what's going on and more importantly, how to fix it.  The short of the story is that it's communicating too fast at different stages within the SD library and therefore failing.  The best solution is to edit the SD.cpp file.  Look for a line that reads:
Code: [Select]
if (!card.init(SPI_HALF_SPEED, chipSelect)) { and change that to say
Code: [Select]
if (!card.init(SPI_QUARTER_SPEED, chipSelect)) {

That will fix the error you're seeing.

Also, remember that you need to drive the card reader at 3.3V.  If you're connecting it to an Arduino running at 5V, you need a signal level converter for all four lines, MOSI, MISO, SCK, and SS.  Failing to do that will result in burned up SD cards.


The line in my SD.cpp looks like this:
Code: [Select]
  return card.init(SPI_HALF_SPEED, csPin, mosi, miso, sck) &&
         volume.init(card) &&

SPI_HALF_SPEED is never used at any other point in SD.cpp.
I changed it to QUARTER but the error still occurs.

My SD module has a +5V pin as well as a 3.3V pin. Do I still need to provide a 3.3V signal if I supply the 5V pin with 5V?


I can't tell what the 5V or 3V3 pins are for.  The eBay page claims it can use one or the other.  It looks as if there's a regulator on board so I'm assuming that the 5V is being regulated down to 3V3.  What I don't see however are the signal lines being properly converted.  If the SD module is indeed working at 3V3, then you must convert the signal lines as well.  Without any kind of datasheet or schematic for that module, you are on your own to figure it out.

I have SFE's microSD breakout, which runs at 3V3.  So in order to communicate with a 5V Uno, I used an LLC to translate the signals from 5V to 3V3 and back.  3V3 from the Uno to the breakout board.  The LLC gets powered on one side with 5V and the other with 3V3.  It works as expected.

Changing of the SD.cpp as you indicated, is correct by the way.  It should read:
Code: [Select]
return card.init(SPI_QUARTER_SPEED, csPin, mosi, miso, sck) &&
         volume.init(card) &&

I'm getting some proper buffers in the next few days at which point I will try and see if things will run at HALF speed, or maybe even FULL speed.

Go Up