Getting Adafruit micro SD SDIO breakout board to work with Photon 2

Hello, I hope I am posting in the right spot. If not I apologize.

I have a photon 2 that I am trying to program to interface to an Adafruit micro SD, SDIO breakout board, Overview | Adafruit MicroSD SPI or SDIO Card Breakout Board | Adafruit Learning System, and it is not working. I am using the SdFat library from here, SdFat | Reference | Particle.

I have the following connections:
Board -> Photon 2
3V -> 3.3V
CLK -> D17(SCK)
SO -> D16(MISO)
SI -> D15(MOSI)
CS -> D18(S3-SS)

The test I am running is the loopback test in the library as follows:

// This is a simple SPI loop-back test.
//
// Connect SD_MISO to SD_MOSI
//
// Modify these defines for your configuration.
#define SD_SPI SPI
#define SD_MISO MISO
#define SD_MOSI MOSI

#include "SPI.h"
void setup() {
  uint8_t rx, tx;
  Serial.begin(9600);
  while (!Serial) {
    yield();    
  }
  //Serial.println(F("\nType any character to start"));
  //while (!Serial.available()) {
 //   yield();
  //}

  Serial.print("Begin, SD_MISO: ");
  Serial.print(SD_MISO), Serial.print(", SD_MOSI: ");
  Serial.println(SD_MOSI);
  pinMode(SD_MISO, INPUT_PULLUP);
  pinMode(SD_MOSI, OUTPUT);
  digitalWrite(SD_MOSI, HIGH);
  if (!digitalRead(SD_MISO)) {
    Serial.println("Error: SD_MISO not HIGH");
    goto fail;
  }
  delay(3000);
  digitalWrite(SD_MOSI, LOW);
  if (digitalRead(SD_MISO)) {
    Serial.println("Error: SD_MISO not LOW");
    goto fail;
  }
  pinMode(SD_MISO, INPUT);
  pinMode(SD_MOSI, INPUT);

  // Modify if SD_SPI.begin has arguments and use this style SdFat begin call:
  // sd.begin(SdSpiConfig(CS_PIN, USER_SPI_BEGIN | <other options>, &SD_SPI));
  SD_SPI.begin();

  // Start with a 400 kHz clock.  Try full speed if success for 400 kHz.
  SD_SPI.beginTransaction(SPISettings(400000, MSBFIRST, SPI_MODE0));
  tx = 0;
  do {
    rx = SD_SPI.transfer(tx);
    if (tx != rx) {
      Serial.print("Error rx: 0x");
      Serial.print(rx, HEX);
      Serial.print(" != tx: 0x");
      Serial.println(tx, HEX);
      SD_SPI.endTransaction();
      goto fail;
    }
  } while (tx++ < 255);
  SD_SPI.endTransaction();
  Serial.println("Success!");
  return;

fail:
  SD_SPI.endTransaction();
  Serial.println("Is SD_MISO connected to SD_MOSI?");
  Serial.println("Are SD_MISO and SD_MOSI correct?");
}
void loop() {}

And this is the output:

Serial monitor opened successfully:

Begin, SD_MISO: 16, SD_MOSI: 15

Error: SD_MISO not LOW

Is SD_MISO connected to SD_MOSI?

Are SD_MISO and SD_MOSI correct?

Hi and welcome to the community!
What deviceOS is your device using? There has been a reported error on SPI on DeviceOS 5.7 and 5.8, so you might want to try an earlier version if your device is using either.

I believe you can use this tool:

Best

Hello, I went back to DeviceOS 5.6 which is the highest OS listed that will work with the photon 2

Hi,
I'm not clear if that improved the situation.
Cheers

I think the SPI loopback test code is intended to be used by just connecting MISO to MOSI, not connected to the actual SD card reader. I can't see how that test would ever pass on a real SPI device.

Sorry. Before I tried working with the SD breakout board I had gone back to version 5.6. So no it did not improve the situation.

Okay I will try out some of the other examples.