1. 程式人生 > >SD卡用arduino操作的各種方式

SD卡用arduino操作的各種方式

SD CARD MODULE and STACKABLE SD CARD SHIELD

(This Module is available here: CLICK) See the SCHEMATIC DIAGRAM here:
The SHIELD version is available here: CLICK

Overview:

SD Cards work only at 3.3V and both the power and I/O levels must be accommodated. The module shown here uses FETs for level shifting and a 3.3V regulator for power when operating from 5.0V . A switch allows the module to be used with Arduinos / YourduinoRoboRED or Minis etc. running at 3.3V. We have tested the YourDuinoRoboRED with it's power jumper set to 3.3V and the SD card module set at 3.3V and it works well.

This module also has a MicroSD socket on the back side, and we have tested 2Gb and 4Gb MicroSD cards plugged in there. They worked OK with the SdFAT library. These cards are formatted FAT32 and SD/HC.

NOTE: It is recommended to format SD cards to be used, with
Panasonic's formatter, available here:
The SdFAT Library also includes a sketch that can format cards well.

NOTE: There are many variables in getting SD cards to work well with Arduino. Some SD cards work fine, some do not. See ABOUT DIFFERENT SD CARDS below. If you have good or bad experiences with different modules or shields, or SD cards, please email
[email protected]
and we will try to incorporate your learning here.

ITEAD-SD-5-3v3-500.jpgUSE WITH ARDUINO/YourDuino 328 or UNO versions:


The Arduino hardware pages on the official site shows the following pin names:
*SPI:
10 (SS) "Slave Select"
11 (MOSI) "Master Out Slave In"
12 (MISO) "Master In Slave Out"
13 (SCK) "System Clock"

To clarify this: to connect this module you must connect:
(Arduino Pin) - Module Pin
10 (SS) to CS
11 (MOSI) to DI
12 (MISO) to DO
13 (SCK) to CLK

and G to GND and + to 5V
AND.. Switch the switch to 5V for any Arduino running on 5V.

USE WITH ARDUINO/YourDuino MEGA versions:


The Arduino hardware page for Arduino Megas shows this pinout, so needed connections are:
SPI:
50 (MISO) to DO
51 (MOSI) to DI
52 (SCK) to CLK
53 (SS) to CS

and G to GND and + to 5V
AND.. Switch the switch to 5V for any Arduino running on 5V.

These Mega pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.

SD-Quickstart.jpgTESTING THE MODULE AND SD CARDS:


To Test your module and test some SD cards, start with the SdFAT library, which has many test and troubleshooting software sketches in it's Examples folder. After you have copied the SdFAT folder to your libraries folder, load the QuickStart sketch as shown on the right. If you can't see this, you don't have the SdFAT library copied into your libraries folder.

Get the SdFAT Library (latest one at top) HERE:
SdFAT is a large but fully-featured library:
SdFAT
is an Arduino library that supports FAT16 and FAT32 file systems on standard and high capacity SD cards. SdFat Now supports long file names.
SdFat supports file creation, deletion, read, write, and truncation. SdFat supports access to subdirectories, creation, and deletion of subdirectories. Use of SdFat is illustrated by a large number of examples in the SdFAT/examples directory. SdFAT now supports Arduino 1.X

TEST your SD Card Module or shield:

Check: Your connections as above: Caution: they are not in exact sequence order. Be sure.
Upload QuickStart to your Arduino/YourDuino.
Start Serial Monitor.
Follow the instructions. You need to put your cursor in the box at the top of the Serial Monitor to be able to type things to run the program.
You should see this on the Serial Monitor Screen:
SD chip select is the key hardware option.
Common values are:
Arduino Ethernet shield, pin 4
Sparkfun SD shield, pin 8
Adafruit SD shields and modules, pin 10
The default chip select pin number is pin 10

Enter the chip select pin number: 10 [YOU ENTER THIS. 10 for our module. ]

[A GOOD CARD WILL GIVE YOU THIS KIND OF RESPONSE:]

---------------------( COPY )--------------------------
Card successfully initialized.
Card size: 4089 MB (MB = 1,000,000 bytes) [This is a 4Gb SD/HC card]
Volume is FAT32, Cluster size (bytes): 32768

Files found (name date time size):
MISC/ 2012-04-26 22:10:40
DCIM/ 2012-04-26 22:10:40
152_PANA/ 2012-04-26 23:36:40
P1520541.JPG 2012-04-26 23:36:42 2941193
P1520542.JPG 2012-05-02 03:41:14 3053950
P1520575.JPG 2012-05-21 15:05:24 3653436

Success! Type any character to restart.
-----------------( END COPY )----------------------

ABOUT DIFFERENT SD CARDS:

Some SD cards work fine, some do not. You may have to try a few..
Most cards have good SPI read performance but cards vary widely in SPI write performance. Write performance is limited by how efficiently the card manages internal erase/remapping operations. The Arduino cannot optimize writes to reduce erase operations because of its limited RAM.

SanDisk cards generally have good write performance. They seem to have more internal RAM buffering than other cards and therefore can limit the number of flash erase operations that the Arduino forces due to its limited RAM.
Some Dane-Elec cards have a write speed that is only 20% as fast as a good SanDisk card.

NOTE: QuickStart runs SD cards at 1/2 the maximum possible speed. We have not been able to get any cards to run at Maximum speed.

OTHER SD CARD LIBRARIES:

If you have things working OK and need to minimize the size of the library loaded on the Arduino with your application you can:

Get the "TinyFAT" Arduino Software Library here:
You can find the latest version of the library at http://www.henningkarlsen.com/electronics
The 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 your filenames compliant with the old 8.3 standard. The SD card should be connected to the SPI-pins on your Arduino. Pin connections are available in the documentation in the download.
NOTE: This library worked well with a 1GB SD card that was formatted FAT16. This library will NOT work with larger cards that are formatted FAT32.

Get the smaller fat16lib Here:
NOTE: Were unable to get this library to work with the 1Gb FAT16 card that worked with TinyFAT.

The Arduino FAT16 Library is a minimal implementation of the FAT16 file system on standard SD flash cards. The class implementing the library, Fat16, supports read, write and file creation.
Fat16 is derived from the Arduino Print base class so files can be written using print() and println().

Fat16 only allows access to files in the root directory and only supports short 8.3 file names.

轉載地址:https://arduino-info.wikispaces.com/SD-Cards

相關推薦

SDarduino操作各種方式

SD CARD MODULE and STACKABLE SD CARD SHIELD (This Module is available here: CLICK) See the SCHEMATIC DIAGRAM here:The SHIELD version is

Android五種資料儲存方式之SQLite資料庫儲存 載入SD資料庫 sql操作 事務 防止SQL注入

資料庫 前言 資料庫儲存 資料庫建立 內建儲存資料庫 外接儲存資料庫 編寫DAO 插入操作 更新操作 刪除操作 查詢操作

Android 的ListView操作例項,檔案管理器SD的讀取操作

檔案管理器SD卡: 實現效果: 點選後的效果: 下面來具體實現步驟: 檔案管理器顯示樣式,來設定佈局。 建立專案對Androidmanifest修改: 一、編寫activity_main.xml: <LinearLayout xmlns:android="ht

Android呼叫系統相機拍照並儲存到SD的兩種實現方式

1.呼叫照相機時通過putExtra的方式直接指定儲存路徑 String FilePath = "/sdcard/pic/"; File file = new File(FilePath); file.mkdirs();// 建立資料夾 Intent intent

intent開啟各種檔案 開啟sd路徑 開啟系統目錄...

在其他類中呼叫MyIntent類中的方法,例如: Intent it = MyIntent .getHtmlFileIntent("/sdcard/tutorial.html");//對應你的檔名 startActivity( it ); //可用於獲取開

SD操作【安卓8】

roo extern 檢查 return tdi 程序 equal 針對 ron 讀寫SD卡   Context類的openFileInput和openFileOutput方法都是針對應用程序的數據文件夾進行的文件操作,由於手機的ROM容量有限,因此這種操作有一定局限性。

安卓開發:sd操作

use AS con AI string extern toast path 沒有 1.向sdcard中寫入數據: 發現向/mnt/sdcard路徑寫數據會報錯,原因:沒有開啟相應權限 解決:配置文件中加入 <uses-permission android:

FATFS在SD裏寫一串數字

就會 info http src 需要 alt bsp 字符串 都是 用FATFS寫SD卡,需要把數組的各個位取出來,變成字符串,然後才能寫進去,,如果直接寫就會出現亂碼 還有一點要註意,就是 要寫進去的東西如:pzu和pv1都是指針,,,,把一個指針指向數組之後,才能寫,

android 操作SD上的檔案

(1)說明:操作SD卡上的檔案須要增加下面許可權  在SD卡上建立和刪除檔案許可權  <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>

Android SD簡單的檔案讀寫操作

Android SD卡簡單的檔案讀寫操作   最近有這樣的需求,把每次統計到的資料,以txt形式儲存到手機SD卡或是手機記憶體中,遇到一些問題,記錄下來。   首先如果要在程式中使用sdcard進行儲存,我們必須要在AndroidManifset.xml檔案進行下

使用ArduinoSD模組記錄資料並匯出到Excel

在本篇文章中,我們將學習如何基於Arduino開發板使用一個SD卡模組。同時結合DS3231實時時鐘模組,我們將製作一個數據記錄儀的示例,在示例中,我們將溫度感測器的資料儲存到SD卡中,並將這些資料匯入到Excel中以製作圖表。   Arduino SD卡模組 首先讓我們來看看SD卡模組。它適

SD/iNand操作指令movi

1、SD卡/iNand操作指令movi (1)開發板如果用SD卡/EMMC/iNand等作為Flash,則在uboot中操作flash的指令為movi(或mmc) (2)movi的指令都是movi read和movi write一組的,movi read用來讀取iNand到DDR上,movi

訊為4412使用SD方式執行應用程式

在UBUNTU下已經編寫了一個原始檔,裡面內容如下: #include<stdio.h> int main(int argc, const char *argv[]) { printf("hello world!\n"); return 0; }   編寫

第5天SD操作

第5天SD卡操作 SD卡操作 一.手機記憶體圖 2.SD卡介紹: 三.程式碼 SD卡操作 一.手機記憶體圖 2.SD卡介紹: 1.一般手機檔案管理 根路徑 /storage/emulated/0

Android6.0執行時許可權-sd許可權處理方式

我們的app一般都會需要快取和一些圖片的儲存,當然我們的目錄可以是自己的私有目錄, getExternalCacheDir 或者 getCacheDir 是不需要許可權的,但是如果需要在sd卡下儲存呢,此時需要 WRITE_EXTERNAL_STORAGE 許可權.實際上

Arduino SD庫不能正常初始化SD的解決方法

用SD卡模組,長相和UNO一樣的那種直接插上 如圖 呼叫SD庫的官方例子不能初始化。 解決辦法 1.就是將IDE更新到最新的,現在我用的是cc的1.6.10不能正常,更新到1.6.12就可以了,大家說1.6.10有很多問題 2.在setup函式里加上pinMode(10,O

Arduino Uno SD模組 (四)刪除檔案

實現效果 本次實現的是刪除上一篇新增的LSLAB.txt 檔案 效果圖?沒有啦,都刪掉了哪裡還有 . . . . . . . . . . . . . . 還是有的 BOM表 Arduiino Uno *1 SD卡模組  *1 SD卡   *1 調線若干 接線

Android Studio SD訪問許可權及asserts資料夾下的檔案操作

Android Studio SD卡訪問許可權 1、在 AndroidManifext.xml 中新增如下程式碼 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&

STM32F4——SD相關操作

一、簡介:     SD卡從MMC基礎發展而來,一種記憶裝置,廣泛用於便攜裝置,SD卡按容量分為:SD卡(0~2G)、SDHC卡(2~32G)和SDXC卡(32G~2T)。對於SD的使用過程中相應引腳

來獲取sd和系統/data分割槽的使用情況,包括:總的空間大小、可用空間、已空間

package com.schogini.dhcp; import java.io.File; import android.content.Context; import android.os.Environment; import android.os.StatFs;