Example program for USBMSD device (USB Flashdisk) library using AT45DBxx serial flash storage chip. Works with 2, 4, 8, 16, 32 and 64 Mbit chips within AT45DBxx
Dependencies: USBDevice USBMSD_AT45 mbed
Diff: main.cpp
- Revision:
- 0:42f27224d4d7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 27 14:37:34 2012 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +#include "USBMSD_AT45.h" + +USBMSD_AT45 Flash(p5, p6, p7, p8, 512); // Mosi, Miso, Sclk, CS, Size of block being transported over USB + // each time. Can be 512, 1024, 2048, 4096. Best is to select same + // size as AT45DBxx SRAM buffer size. If page size of flash is not + // binary 2^N (256, 512, 1024 bytes) but is 264, 528 or 1056 bytes + // before each write we read block being written to SRAM then rewrite + // part of them with data from host and write whole SRAM buffer back + // to flash. This avoids to data being rewritten in other blocks + // we actually do not write to. +int main() { + + while(1) { + + // Do something else here + + } +}