SD&MMC Card Module Double Side

From ElecFreaks
Jump to: navigation, search

Introduction

This SD/MMC card double side breakout, is allowed you to breakout the mircSD/SD/MMC socket to a standard 2.54mm-pin header. We used SPI Mode interface.

The module can work with 5V or 3.3V power supply, and both 5V/3.3V IO operation level. It can be controlled directly by a wide range of microcontrollers. Perfect for breadboarding and the likes. Board comes fully assembled and tested as shown.

Note:If you use 3.3V power supply, please switch to 3.3V side.

Dimensions: 31 x 45 mm


Model: BK_SD_03


BK DoubleS SDcard 04.jpgBK DoubleS SDcard 01.jpg

Schematic

Download

Specification

Pin definition and Rating

Pin # Pad Type Description
SCK 1 CMOS input with weak internal pull-up Serial Clock
MISO 2 CMOS output,tri-stable with weak internal pull-up Serial data Out
MOSI 3 CMOS input with weak internal pull-up Serial data in
CS 4 CMOS output,tri-stable with weak internal pull-up Chip Select
VCC 5 VCC Integrated 5V(+)supply with on-chip linear regulator output within 3-5V
GND 6 VSS Ground

Usage

Hardware Installation

Before the begin, you need a SD card memory, and formatted to FAT16(recommend) or FAT32. And you can get the SD Card from our store.

SDPost-format.jpg


There are two Arduino library for test these SD Card module. One is the SD library allows for reading from and writing to SD cards, e.g. on the Arduino Ethernet Shield. It is built on sdfatlib by William Greiman. The library supports FAT16 and FAT32 file systems on standard SD cards and SDHC cards. It only supports one open file at a time and only uses short 8.3 file names.

The other library supports FAT16 formatted SD cards up to 2GB in size. 4GB FAT16 formatted SD cards might work, but is untested. Long filenames are not supported. Keep you filenames compliant with the old 8.3 standard. It called TinyFAT (Arduino SD Library)

There we used TinyFAT for testing White SD card module. The demo will create a textfile, and fill it with 1MB of text. The file will be named ‘BIGFILE.TXT’. If the file already exists it will first be deleted.

SD card must be connected to the SPI port of your Arduino. he IO connect to Arduino as below:

3V3 – 3.3V , GND – GND,     CS – D10(SS),     MOSI – D11,     MISO – D12,     CLK – D13

SDPost-W03.jpg

Programming

Includes important code snippet. Demo code like :

//
// This program is a demo of the writeLn()-function.
//
// This demo will create a textfile, and fill it with 1MB
// of text. The file will be named 'BIGFILE.TXT'. If the
// file already exists it will first be deleted.
//
// SD card must be connected to the SPI port of your Arduino.
//
// Remember to select 115200 baud in the Serial Monitor.
//

#include <tinyFAT.h>
#include <avr/pgmspace.h>

 byte res;

char *verboseError(byte err)
{
   switch (err)
   {
   case ERROR_MBR_READ_ERROR:
     return "Error reading MBR";
     break;
   case ERROR_MBR_SIGNATURE:
     return "MBR Signature error";
     break;
   case ERROR_MBR_INVALID_FS:
     return "Unsupported filesystem";
     break;
   case ERROR_BOOTSEC_READ_ERROR:
     return "Error reading Boot Sector";
     break;
   case ERROR_BOOTSEC_SIGNATURE:
     return "Boot Sector Signature error";
     break;
   default:
     return "Unknown error";
     break;
   }
}

void setup() {
   // Initialize serial communication at 115200 baud
   Serial.begin(115200);
   Serial.println();
   // Initialize tinyFAT
   // You might need to select a lower speed than the default SPISPEED_HIGH
   res=file.initFAT();
   if (res!=NO_ERROR)
   {
     Serial.print("***** ERROR: ");
     Serial.println(verboseError(res));
     while (true) {};
   }

   Serial.println("This demo will create a textfile, and fill it with 1MB of text.");
   Serial.println("The file will be named 'BIGFILE.TXT'. If the file already exists it will first be deleted.");
   Serial.println();
   Serial.println("***** Send any character to start *****");
   while (!Serial.available()) {};
   Serial.flush();

   if (file.exists("BIGFILE.TXT"))
     file.delFile("BIGFILE.TXT");

   file.create("BIGFILE.TXT");

   res=file.openFile("BIGFILE.TXT", FILEMODE_TEXT_WRITE);
   if (res==NO_ERROR)
   {
     for (int cc=0; cc<1024; cc++)
     {
       for (int i=0; i<8; i++)
       {
         file.writeLn("01234567890123456789012345678901234567890123456789
         0123456789012345678901234567890123456789012345678901234567890123456789012345");
       }
       if (((cc+1)%16)!=0)
         Serial.print(".");
       else
         Serial.print("|");
      if (((cc+1)%64)==0)
      {
        Serial.print(" ");
        Serial.print(cc+1, DEC);
        Serial.println(" KB");
      }
     }
     file.closeFile();
   }
   else
   {
     switch(res)
     {
       case ERROR_ANOTHER_FILE_OPEN:
         Serial.println("** ERROR: Another file is already open...");
         break;
       default:
         Serial.print("** ERROR: ");
         Serial.println(res, HEX);
         break;
     }
   }
   Serial.println("***** All done... *****");

}  

void loop()
{
}

The result as blow:

SDPost-W01.jpg

SDPost-W02.jpg

Support

If you have questions or other better design ideas,

Version Tracker

Revision Descriptions Release
v1.2 Initial public release date

Bug Tracker

Bug Tracker is the place you can publish any bugs you think you might have found during use. Please write down what you have to say, your answers will help us improve our

products.

Resources

How to buy

Click here to buy: http://www.elecfreaks.com/estore/sd-mmc-card-module-double-side-bk-sd-03.html

See Also

Other related products and resources.

Licensing

This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are

licensed under GPL/LGPL, see source code files for details.

External Links

Links to external webpages which provide more application ideas, documents/datasheet or software libraries