first
Dependencies: SDFileSystemDMA mbed
Refer to:
https://developer.mbed.org/users/mimi3/code/SDFileSystemDMA
Caution
If your board has SRAM less than or equal to 8KB, the 'buffer' size must be set to 512 Bytes.
NUCLEO-F411RE
About 2.5MBytes/sec
NUCLEO-L152RE
About 1MBytes/sec
Diff: main.cpp
- Revision:
- 1:c39cfc31349d
- Parent:
- 0:8f297fe0c66a
- Child:
- 2:f8bd763b5584
--- a/main.cpp Fri Feb 12 13:55:01 2016 +0000 +++ b/main.cpp Fri Feb 12 15:38:38 2016 +0000 @@ -8,10 +8,11 @@ //#define CD_TYPE SDFileSystem::SWITCH_POS_NC // always instertion state //#define SPI_CLOCK_HZ ( 12 * 1000000 ) Timer timer; +Serial pc(USBTX,USBRX); SDFileSystem sd( MOSI, MISO, SCLK, CS, "sd"); //SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board - DigitalIn button(USER_BUTTON, PullUp); + char buffer[512]; #define X_MEGA_BYTE ((1)*1024*1024) /* 1Mbyte */ @@ -19,8 +20,8 @@ int base_test() { - printf("Hello World!\n"); - while(button); + printf("\nPress any key!\n"); + while(!pc.readable()); mkdir("/sd/mydirx", 0777); @@ -94,9 +95,9 @@ int main(){ /* UART Baudrate is 9600bps*/ while(1){ - printf("\nStart SD card accsess test! -- Press button"); + printf("\nStart SD card accsess test! -- Press any key"); printf("\nWriting is very slow, wait several minuts.\n"); - while(button); + while(!pc.readable()); writeTest(); readTest(); }