Go Down

Topic: MicroSD Card Adapter errorCode: 0x20, errorData: 0x0 (Read 902 times) previous topic - next topic

soceraso



Pictures of my set up are attached. I've isolated the MicroSD Card Adapter from my project to work on identifying the problem. The SD card will not initialize.

I'm running the SDInfo.ino sketch from from the SDFat Library: https://github.com/greiman/SdFat/blob/master/examples/SdInfo/SdInfo.ino.

It outputs:

error: cardBegin failed
SD errorCode: 0X20,0X0

Is there documentation on this error code somewhere?

My first thought was the SD card format. I downloaded https://www.sdcard.org/downloads/formatter_4/, and reformatted my card but this did not work.

I ordered my SD cards from Amazon and am wondering if they are fakes. I'm picking up some more in store today. I had my project working before, and the only thing that's changed is the SD Card.

CrossRoads

Does the SD card adapter have a 3.3V regulator and 3.3V signal level adapters on it? 
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

soceraso

#2
Jan 14, 2018, 12:08 am Last Edit: Jan 14, 2018, 12:21 am by soceraso
Yes, I purchased my adapters here: https://www.amazon.com/gp/product/B06XHJJWNC/ref=oh_aui_detailpage_o02_s01?ie=UTF8&psc=1#feature-bullets-btf.

The Product Detail includes this description:

3.3V regulator circuit: LDO regulator output 3.3V for level conversion chip, Micro SD card supply;
Level conversion circuit: Micro SD card to signal the direction of converts 3.3V, MicroSD card interface to control the direction of the MISO signal is also converted to 3.3V, general AVR microcontroller systems can read the signal;

I include a picture of my card here:



Just tried a new SD card and have received the same error.


soceraso

I've tried 2/5 and get the same error. I'll open the other 3 tomorrow to see if they work.

What are the circumstances in which the SD card itself is the issue? Do I need a certain type of SD card or have to prep it in a certain way?

Am I correct in thinking my Adapter has the circuitry needed to take in 5V power?

CrossRoads

SD card formatted with code from here should work https://www.sdcard.org/, which I think you said you did.
Card looks to have the right 3.3V circuitry - unless it's being starved for current. Have you measured the 5V and 3.3V lines to see if they're at the correct levels?
Unfortunately VUSB from the USB connector cannot be accessed directly, you only get "5V" after VUSB goes thru a MBR0520 diode D1 on the bottom of the board. You may have damaged that diode, preventing enough 5V current from getting to the adapter.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

soceraso

I got the project working by using a new Nano and new SD Card Adapter. Using the original Nano with a new SD Card Adapter output the same error, and using the original SD Card Adapter with a new Nano output the same error.

I think I fried both original pieces of equipment. I'll post pictures of my original set up tomorrow. I think the problem comes from how I was powering my set up... Is there a glaring error with doing the below to remotely power the Nano and SD Card Adapter? Maybe as battery voltage dropped, the current entering Nano and SD Card Adapter got too high?







I was running this code that I adapted from Starting Electronics and ArduinoReadWrite:

/*--------------------------------------------------------------
  Program:      volt_measure

  Description:  Reads value on analog input A2 and calculates
                the voltage assuming that a voltage divider
                network on the pin divides by 11.
 
  Hardware:     Arduino Uno with voltage divider on A2.
               
  Software:     Developed using Arduino 1.0.5 software
                Should be compatible with Arduino 1.0 +

  Date:         22 May 2013
 
  Author:       W.A. Smith, http://startingelectronics.org
--------------------------------------------------------------*/

#include <SPI.h> //SPI communication for SD card reader
#include <SD.h> //SD card functions

File myFile; //variable name for File
char fileName[] = "cap.txt"; //name SD card file here

// number of analog samples to take per reading
#define NUM_SAMPLES 10

int sumA2 = 0;                    // sum of samples taken
int sumA4 = 0;
unsigned char sample_count = 0; // current sample number
float voltage = 0.00;            // calculated voltage
int n = 1; // keep measurement count
long timeNow;

void setup() {

    //pinMode(10, OUTPUT);
    //digitalWrite(10, HIGH);
 
    Serial.begin(9600);
   
    while (!Serial) {
      ; // wait for serial port to connect. Needed for native USB port only
    }
    Serial.print("Initializing SD card...");

    if (!SD.begin(10)) {
      Serial.println("initialization failed!");
      return;
    }

    myFile = SD.open(fileName, FILE_WRITE);

    // if the file opened okay, write to it:
    if (myFile) {
      myFile.print("Measurement Count, ");
      myFile.print("Voltage (V), ");
      myFile.println("Milliseconds");
      // close the file:
      myFile.close();
      Serial.println("done.");
    } else {
      // if the file didn't open, print an error:
      Serial.println("error opening file");
    }
   
    Serial.println("initialization done.");
   
}

void loop(){   
    // take a number of analog samples and add them up
    while (sample_count < NUM_SAMPLES) {
        sumA2 += analogRead(A2);
        sumA4 += analogRead(A4);
        sample_count++;
        delay(10);
    }
   
    // calculate the voltage
    // use 5.0 for a 5.0V ADC reference voltage
    // 5.015V is the calibrated reference voltage
    voltage = (((float)sumA4 - (float)sumA2) / (float)NUM_SAMPLES * 5.21 * 25.7 / 5.7) / 1024.0;

    Serial.print(voltage);
    Serial.println(" V");
   
    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.
    myFile = SD.open(fileName, FILE_WRITE);

    // if the file opened okay, write to it:
    if (myFile) {
      Serial.print("Writing to file...");
      myFile.print(n);
      myFile.print(", ");
      myFile.print(voltage);
      myFile.print(", ");

      timeNow = millis();     
      myFile.println(timeNow);
     
      // close the file:
      myFile.close();
      Serial.println("done.");
    } else {
      // if the file didn't open, print an error:
      Serial.println("error opening file");
    }

    n++;
    sample_count = 0;
    sumA2 = 0;
    sumA4 = 0;
}

ieee488

That power bank is essentially a battery which outputs 5V and has maximum current output of 1A.
That should be enough for the Arduino Nano, but I am not sure about the microSD card adapter current requirement.

Go Up