run on mbed-os6.6.0
Num | SD Card pin | Module pin | Pin Name | Port Name | SPI |
---|---|---|---|---|---|
1 | CD/DAT3 | CS | D10 | PB6 | - |
2 | CMD/DI | SDI | D11 | PA_7 | MOSI |
3 | VSS1 | GND | GND | - | - |
4 | VDD | 3.3V | 3V3 | - | - |
5 | CLK | CLK | D13 | PA_5 | SCLK |
6 | VSS2 | GND | GND | - | - |
7 | DAT0/DO | SDO | D12 | PA_6 | MISO |
8 | DAT1 | - | - | - | - |
9 | DAT2 | - | - | - | - |
電源+/-を含め合計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/
Diff: FatFs_Mon/mon.cpp
- 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 {