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
main.cpp
- Committer:
- llumpu
- Date:
- 2012-10-27
- Revision:
- 0:42f27224d4d7
File content as of revision 0:42f27224d4d7:
#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
}
}
little llumpu