Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 9 months ago.
How to make a text file on sd card
PIN define 1.SD_D2(PC10) 2.SD_D3(PC11) 3.SD_CMD(PD2) 4.VDD 5.SD_CLK(PC12) 6.GND 7.SD_D0(PC8) 8.SD_D1(PC9)
Using DEMO code "SDFileSystm_HelloWorld"
include file
compile result
How to solve it???
If I don't like the text file,how to del it(I know the file name)??
Question relating to:
2 Answers
8 years, 9 months ago.
never forget that the pin names are defined differently for different processors, never use a sample program without checking the pinout
to remove a file look at http://www.cplusplus.com/reference/cstdio/remove/
8 years, 9 months ago.
The error message is pretty clear to me: p5, p6, p7 , p8 are not defined! You should replace them with correct pin names in order to make it work!
SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name)
- The pin defines you have selected are for the SDIO peripheral which is not supported by this SDFileSystem libray. This library uses the SPI, so you should connect your SD card to some SPI pins in order to use this library.
- SD_D2 (NC)
- SD_D3 (CD)
- SD_CMD(MOSI)
- VDD
- SD_CLK (CLK)
- GND
- SD_D0 (MISO)
- SD_D1 (NC)
- for example you could connect it to SPI1:
- SD_D2 (NC)
- SD_D3 (Any_Pin)
- SD_CMD (PA_7)
- VDD
- SD_CLK (PA_5)
- GND
- SD_D0 (PA_6)
- SD_D1(NC)
and then call
SDFileSystem(PA_7, PA_6, PA_5, Any_Pin,"sd")
You can choose any pin you want for CS.
Look at the Nucleo pinout for other SPI options