I tried SD card Read Write test. Result is success.

Dependencies:   SDFileSystem mbed

/media/uploads/ImageWriter/img_4903.jpg I tried SD card read/write test.

I use Nucleo-F411RE and Aitendo's 2.2inch TFT display with SD card interface.

http://www.aitendo.com/product/7277

This test is not use TFT display. Only use SD card interface.

/media/uploads/ImageWriter/img_4862.jpg

/media/uploads/ImageWriter/img_4865.jpg

Micro SD adaptor type.

/media/uploads/ImageWriter/img_4903.jpg

/media/uploads/ImageWriter/img_4904.jpg

Files at this revision

API Documentation at this revision

Comitter:
ImageWriter
Date:
Fri Apr 17 13:26:24 2015 +0000
Commit message:
SDCard Read Write test

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 96613601cfb9 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Fri Apr 17 13:26:24 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/mbed/code/SDFileSystem/#7b35d1709458
diff -r 000000000000 -r 96613601cfb9 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 17 13:26:24 2015 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+ 
+ 
+//Create an SDFileSystem object
+//SDFileSystem sd(PA_7, PA_6, PA_5, PA_15, "sd");// MOSI, MISO, SCK, CS
+SDFileSystem sd(D11, D12, D13, D10, "sd");// MOSI, MISO, SCK, CS
+Serial pc(USBTX, USBRX);
+ 
+int main() {
+//    pc.baud(19200);
+    pc.baud(9600);
+    for(int i=5; i>0; i--) 
+    {
+        pc.printf("Wait %i seconds..\r\n",i);
+        wait(1);
+    }
+    pc.printf("Initializing\r\n");
+    
+    //Mount the filesystem
+ 
+//    sd.mount();
+    
+    //Perform a write test
+    pc.printf("\nWriting to SD card...");
+    FILE *fp = fopen("/sd/sdtest.txt", "a+");
+    
+    wait(2);
+    if (fp != NULL) {
+        fprintf(fp, "We're writing to an SD card!");
+        fclose(fp);
+        pc.printf("success!\n");
+    } else {
+        pc.printf("failed!\n");
+    }
+ 
+    //Perform a read test
+    pc.printf("Reading from SD card...");
+    fp = fopen("/sd/sdtest.txt", "r");
+    if (fp != NULL) {
+        char c = fgetc(fp);
+        if (c == 'W')
+            pc.printf("success!\n");
+        else
+            pc.printf("incorrect char (%c)!\n", c);
+        fclose(fp);
+    } else {
+        pc.printf("failed!\n");
+    }
+ 
+    //Unmount the filesystem
+//     sd.unmount();
+}
\ No newline at end of file
diff -r 000000000000 -r 96613601cfb9 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 17 13:26:24 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file