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:
- 4:6d6ea85642ed
- Parent:
- 3:4d7be22641c1
- Child:
- 6:7f8bc932cede
--- a/FatFs_Mon/mon.cpp Sat Aug 17 03:29:11 2019 +0000 +++ b/FatFs_Mon/mon.cpp Tue Dec 24 10:30:40 2019 +0000 @@ -8,7 +8,7 @@ * Created: May 5th, 2015 * Revised: June 14th, 2015 * Revised: April 7th, 2018 - * Revised: August 17th, 2019 + * Revised: December 24th, 2019 */ /* @@ -119,7 +119,7 @@ "x extend commands mode\r\n" "q Return to main\r\n" "t Show current time or Adjust time\r\n" - " e.g. t 18 3 28 14 48 20 -> 2018-03-28 14:48:20\r\n" + " e.g. t 19 12 24 10 11 12 -> 2019-12-24 10:11:12\r\n" "? Help/You know the command\r\n" "\r\n"; @@ -292,6 +292,30 @@ } } +uint32_t get_data_file_size(const char *const file_name) +{ + BYTE res; + //const char *file_name ="acc_data.txt"; + + if (Dirx == NULL){ + Dirx = new FATFS_DIR; + } + char p = NULL; + res = f_opendir(Dirx, &p); + if (res) { + put_rc((FRESULT)res); + return 0; + } + for(;;) { + res = f_readdir(Dirx, &Finfo); + if ((res != FR_OK) || !Finfo.fname[0]) break; + if (strcmp(Finfo.fname, file_name) == 0){ + return Finfo.fsize; + } + } + return 0; +} + static void extended_mon( char *ptr ) { PUTS(HelpMsg1);