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.
10 years, 9 months ago.
how to use a SD card on kl25z
I want to put a SD card on Kl25z, but there is no hardware interface on such small board. Does any one know how to plug and connect the SD with the main processor.
3 Answers
9 years, 9 months ago.
Hi I have tried compiling the library file SDFileSystem.h, and particularly the FATFileSystem.h appears to be problematic and returns error when I attempt to compile them.
Does anyone know why is that?
10 years, 9 months ago.
Hi,
I wonder why are you asking this question, when later just by minutes, you point us to the SD card component where connection between SD card breakout board and MCU pins is drawn.
You either buy regular breakout board and connect it to the KL25Z headers with cables or there are some arduino compatible boards with sd card slot which would occupy then all KL25Z headers.
Regards,
0xc0170
10 years, 9 months ago.
Or you can simply solder some wires on a SD mini adapter and use SD micro (that works for me). The image of pinout is here:
http://www.bot-thoughts.com/2010/02/logging-data-to-sd-cards.html
And then you can use the code below:
SD Hello World from cookbook
#include "mbed.h" #include "SDFileSystem.h" SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd"); // the pinout on the mbed Cool Components workshop board Serial pc(USBTX,USBRX); int main() { pc.baud(115200); printf("Hello World!\n"); mkdir("/sd/mydir", 0777); FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); if(fp == NULL) { error("Could not open file for write\n"); } fprintf(fp, "Hello fun SD Card World!"); fclose(fp); printf("Goodbye World!\n"); }