Pages: 1 [2]   Go Down
Author Topic: (SOLVED) SFE microSD Breakout woes ...  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Aha, reading SD.cpp I see this:
Code:
boolean SDClass::begin(uint8_t csPin) {
  /*
    Performs the initialisation required by the sdfatlib library.
    Return true if initialization succeeds, false otherwise.
   */
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
         root.openRoot(volume);
}

Changing that to read
Code:
return card.init(2, csPin) &&
... instead fixed the problem.
Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Tom, on that TXB0104 ... can you suggest a DIP equivalent?  I do all of my prototyping on breadboards before I create an SMD final board ... so I need something in DIP form ... or I'll have to create a breakout for the TXB0104 ...
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 72
Posts: 1642
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The begin() function calls card.init() with SPI_HALF_SPEED:

Code:
boolean SDClass::begin(uint8_t csPin) {
  /*

    Performs the initialisation required by the sdfatlib library.

    Return true if initialization succeeds, false otherwise.

   */
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
         root.openRoot(volume);
}

Which means it is running too fast. In Windows, if you open the following file (it is slightly different on Mac):
<arduino directory>/libraries/SD/SD.cpp

You will find the begin() function declaration, just change the SPI_HALF_SPEED to 2.

As for the TXB0104, there are breakout boards available ready soldered:
http://www.adafruit.com/products/395 (This is actually the 8 channel version, TXB0108)
http://www.nanocore12.com/products/details/27/4/accessories/breakout-board,-level-shifter,-3v/5v,-14-pin-wide-dip.html (4 channel TXB0104)
Logged

~Tom~

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I changed SD.cpp, however rather than specifying 2, I changed it to SPI_QUARTER_SPEED and called it a day.  It works.  smiley

Thanks for the links!
Logged

Pages: 1 [2]   Go Up
Jump to: