SDFileSystem for mbed platfrom
SDFileSystem for mbed platfrom
0
Components
Hardware componentsW5500 Ethernet Shield with MicroSD Slot
x 1
LPC824 Xpresso
x 1
Project description
This post shows how to use SDfile System on W5500 Ethernet Shield for mbed platfrom.
SDFile System
A library to allow SD Cards to be accessed as a filesystem, using a SPI interface
SDFileSystem @developer.mbed.org/handbook
This library supports: ? Fat12/ FAT16 / FAT32 ? SD / SDHC cards up to 32Gb
HW ? W5500 Ethernet Shield with MicroSD Slot

- ARM mbed compatible operation
- Arduino Pin-compatible
- Ethernet (W5500 Hardwired TCP/IP chip)
- MicroSD Slot
- Ethernet port
- I2C I/F
- UART I/F
W5500 Ethernet Shiel Pin Map

- SPI Bus support Arduino and mbed platfrom
MOSI MISO SCK D11 D12 D13 MOSI(ICSP-4) MISO(ICSP-1) SCLK(ICSP-3) - SPI_CS and SD_CS pins are allowed to select as below,
- SPI_CS : D8 / D9 / D10
- SD_CS : D4 / D5 / D6
SW1 ? SDFile System for LPC824 Xpresso (mbed platform)
- LPC824 Xpresso
- http://developer.mbed.org/platforms/LPCXpresso824-MAX/
- D6 is used for SD_CS, because D4 and D5 are PWM out.

|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 |
/**? import SDFiles System Library **/#include "mbed.h"#include "SDFileSystem.h"/*for LPC824 Xpresso */SDFileSystem sd(D11, D12, D13, D6, "SD"); // the pinout on the mbed Cool Components workshop boardint 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 writen");????}????fprintf(fp, "Hello fun SD Card World!");????fclose(fp); ????printf("Goodbye World!n");} |
SW2 ? SDFile System for FRDM-KL25Z (mbed platform)
- FRDM-KL25Z
- http://developer.mbed.org/platforms/KL25Z/
- D4 and D5 are used for SD_CS, because D6 is PWM out.

|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 |
/**? import SDFiles System Library **/#include "mbed.h"#include "SDFileSystem.h"/*for FRDM-KL25Z */SDFileSystem sd(D11, D12, D13, D4, "SD"); // the pinout on the mbed Cool Components workshop boardint 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 writen");????}????fprintf(fp, "Hello fun SD Card World!");????fclose(fp); ????printf("Goodbye World!n");} |
Demo.
Notice:?SD card name?shoud be same variable in sd(mosi, miso, clk,?“SDname”).
* Serial terminal
* Check SD card by using card reader
* Confirm?stdtest.txt
