6 years, 1 month 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

5 years, 1 month 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?

The SDFileSystem works on the KL25Z, I have many projects using this. You need to show your code that you are having a problem with, then we can help you. But first make sure you have the latest file versions of the SDFileSytem and Mbed.

posted by Paul Staron 15 Feb 2015
6 years, 1 month ago.


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.


6 years, 1 month 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:


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() {
    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!");
    printf("Goodbye World!\n");