WIZ820io & Micro SD Card Adaptor 101 - sanity check?

Status
Not open for further replies.

r4space

New member
Hi,

I'm brand new to Teensy and just wanting to sanity check something:

I've plugged together a Teensy 3.2 and the WIZ820io & Micro SD Card Adaptor.

Am I understanding the description correctly - that the arduino std SD libraries should just work out of the box with this setup?

I've tried the raw Arduino CardInfo example exactly as is and my own shorter version just checking the SDcard with the begin function (see below) but the serial output in both is always just that there's something wrong - the first card check doesn't work.

**********Serial output
Ping initialization failed. Things to check:
* is a card inserted?
* is your wiring correct?
* did you change the chipSelect pin to match your shield or module?
****************

So my sanity check question is just - should this work (in which case my physical connections somewhere are wrong - any suggestions for debugging) or is there something else to change in the code?

Much thanks!


Code:
#include <SD.h>
#include <SPI.h>


const int ledPin = 13;
const int chipSelect = 4; 

void setup() {

  //Setup
  Serial.begin(9600); //USB is 12Mbps
  Serial.print("\nInitializing system");
  pinMode(ledPin, OUTPUT);
 
  //Recommended Initialisation for teensy WIZ820io & Micro SD Card Adaptor
  pinMode(9, OUTPUT);
  digitalWrite(9, LOW);   // reset the WIZ820io
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);  // de-select WIZ820io
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);   // de-select the SD Card


  if (!SD.begin(4)) {
    Serial.println("Ping initialization failed. Things to check:");
    Serial.println("* is a card inserted?");
    Serial.println("* is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
   Serial.println("Wiring is correct and a card is present."); 
  }

}

void loop() {

  blip(1000); 
 
}

void blip(int len){
  digitalWrite(ledPin, HIGH);
  delay(len);  
  digitalWrite(ledPin, LOW); 
  delay(len);  

}
 
Give SdFat a whirl. It has increased compatablity with more cards.
Just boot up one of the examples and see what happens
 
Last edited:
Thanks, gave it a go but I still get "Initialization failed"... So starting to guess I've got my wiring wrong somehow

So just again - do people in the know agree - this setup should just work out of the box if wired correctly: Teensy3.2+Wiz adaptor + std SD or SdFat libraies in TeensyDuino 1.6.5 (No instructions for installing TeensyDuino1.6.6)

i.e are there any pin configurations beyond the defaults needed?
 
Last edited:
Pin 13 is already in use by the SPI bus. You can't use it as ledPin.

I had to add

Code:
  while (!Serial) {
    ; // wait for serial port to connect.
  }

to make the code compatible with my sd card adaptor (I don't have the WIZ820io & SD card adaptor)



Code:
#include <SD.h>
#include <SPI.h>



const int chipSelect = 4; 

void setup() {

  //Setup
  Serial.begin(9600); //USB is 12Mbps
  while (!Serial) {
    ; // wait for serial port to connect.
  }
  Serial.print("\nInitializing system");
 
  //Recommended Initialisation for teensy WIZ820io & Micro SD Card Adaptor
  pinMode(9, OUTPUT);
  digitalWrite(9, LOW);   // reset the WIZ820io
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);  // de-select WIZ820io
  pinMode(chipSelect, OUTPUT);
  digitalWrite(chipSelect, HIGH);   // de-select the SD Card

  Serial.print("Initializing SD card...");
  if (!SD.begin(chipSelect)) {
    Serial.println("Ping initialization failed. Things to check:");
    Serial.println("* is a card inserted?");
    Serial.println("* is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
   Serial.println("Wiring is correct and a card is present."); 
  }

}

void loop() {
 
}
If this code fails, there is probably something wrong with the electrical connection. Maybe a bad solder joint?
 
Rocking, thanks, that's got it working!

And credit to the teensy board! - it survived 2 re-soldering jobs while I assumed I'd wired it up wrong ;P
 
Status
Not open for further replies.
Back
Top