run on mbed-os6.6.0

NumSD Card pinModule pinPin NamePort NameSPI
1CD/DAT3CSD10PB6-
2CMD/DISDID11PA_7MOSI
3VSS1GNDGND--
4VDD3.3V3V3--
5CLKCLKD13PA_5SCLK
6VSS2GNDGND--
7DAT0/DOSDOD12PA_6MISO
8DAT1----
9DAT2----

電源+/-を含め合計6本の結線で接続します。
Nucleoシリーズは、ボード上のLED(プログラムでLED1)がD13に接続されSPIモード設定時にSCLKとなる構成が多いので、LED1制御を止める必要があります。

For DISCO-F769NI
https://os.mbed.com/users/kenjiArai/code/DISCO-F769NI_BD_SD_Card_Control/
For DISCO-F469NI
https://os.mbed.com/users/kenjiArai/code/DISCO-F469NI_BD_SD_Card_Control/

Revision:
3:4d7be22641c1
Parent:
0:342895df3f8f
Child:
4:6d6ea85642ed
--- a/FatFs_Mon/mon.cpp	Tue Jun 04 11:25:49 2019 +0000
+++ b/FatFs_Mon/mon.cpp	Sat Aug 17 03:29:11 2019 +0000
@@ -2,12 +2,13 @@
  * mbed Application program for the mbed
  *  FatFs Check program / monitor part
  *
- * Copyright (c) 2015,'18 Kenji Arai / JH1PJL
+ * Copyright (c) 2015,'18,'19 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  https://os.mbed.com/users/kenjiArai/
  *      Created:    May        5th, 2015
  *      Revised:    June      14th, 2015
  *      Revised:    April      7th, 2018
+ *      Revised:    August    17th, 2019
  */
 
 /*
@@ -62,7 +63,6 @@
 
 // from ffconf.h
 #define _VOLUMES    1
-#define FF_USE_LFN  0
 
 #if !defined(FF_FS_RPATH)
 #define FF_FS_RPATH 0
@@ -101,16 +101,12 @@
 FIL File1, File2;           // File objects
 FATFS_DIR* Dirx;
 FILINFO Finfo;
-#if FF_USE_LFN
-//inside of FILINFO
-char Lfname[512];
-#endif
 DWORD AccSize;              // Work register for fs command
 WORD AccFiles, AccDirs;
 
 //  ROM / Constant data --------------------------------------------------------
-char *const monmsg0 = "Start monitor program for FatFs File System\r\n";
-char *const monmsg1 = " <Please press any key to start the monitor>";
+const char *const monmsg0 = "Start monitor program for FatFs File System\r\n";
+const char *const monmsg1 = " <Please press any key to start the monitor>";
 
 static const char HelpMsg0[] =
     "dir   <full_pass>\r\n"
@@ -212,11 +208,6 @@
     PUTS(monmsg0);
     PUTS(monmsg1);
     crlf();
-#if FF_USE_LFN
-    // no needs because FILINFO structure is changed
-    Finfo.lfname = Lfname;
-    Finfo.lfsize = sizeof Lfname;
-#endif
     for (;;) {
         DEBUG_LINE
         PUTC('>');
@@ -446,16 +437,7 @@
             if (FF_FS_RPATH && Finfo.fname[0] == '.') {
                 continue;
             }
-#if FF_USE_LFN
-            //fn = *Finfo.lfname ? Finfo.lfname : Finfo.fname;
-            if (Finfo.altname[0] == 0) {
-                fn = Finfo.fname;
-            } else {
-                fn = Finfo.altname;
-            }
-#else
             fn = Finfo.fname;
-#endif
             if (Finfo.fattrib & AM_DIR) {
                 AccDirs++;
                 *(path+i) = '/';
@@ -931,13 +913,13 @@
             for (;;) {  /* 2nd parameter is not given (interactive mode) */
                 switch (p3) {
                     case DW_LONG:
-                        PRINTF("%08X 0x%08X-", p1, *(DWORD*)p1);
+                        PRINTF("%08X 0x%08X-", (unsigned int)p1, *(unsigned int*)p1);
                         break;
                     case DW_SHORT:
-                        PRINTF("%08X 0x%04X-", p1, *(WORD*)p1);
+                        PRINTF("%08X 0x%04X-", (unsigned int)p1, *(WORD*)p1);
                         break;
                     default:
-                        PRINTF("%08X 0x%02X-", p1, *(BYTE*)p1);
+                        PRINTF("%08X 0x%02X-", (unsigned int)p1, *(BYTE*)p1);
                 }
                 ptr = Linebuf;
                 get_line(ptr, sizeof Linebuf);
@@ -1092,22 +1074,22 @@
 
     if (xatoi(&ptr, &p1)) {
         t.tm_year       = (uint8_t)p1 + 100;
-        pc.printf("Year:%d ",p1);
+        pc.printf("Year:%ld ",p1);
         xatoi( &ptr, &p1 );
         t.tm_mon        = (uint8_t)p1 - 1;
-        pc.printf("Month:%d ",p1);
+        pc.printf("Month:%ld ",p1);
         xatoi( &ptr, &p1 );
         t.tm_mday       = (uint8_t)p1;
-        pc.printf("Day:%d ",p1);
+        pc.printf("Day:%ld ",p1);
         xatoi( &ptr, &p1 );
         t.tm_hour       = (uint8_t)p1;
-        pc.printf("Hour:%d ",p1);
+        pc.printf("Hour:%ld ",p1);
         xatoi( &ptr, &p1 );
         t.tm_min        = (uint8_t)p1;
-        pc.printf("Min:%d ",p1);
+        pc.printf("Min:%ld ",p1);
         xatoi( &ptr, &p1 );
         t.tm_sec        = (uint8_t)p1;
-        pc.printf("Sec: %d \r\n",p1);
+        pc.printf("Sec: %ld \r\n",p1);
         seconds = mktime(&t);
         set_time(seconds);
     } else {