The "enable write status" command has to be sent before "write status" command to unlock memory area.
Fork of SST25VF by
Diff: main.cpp
- Revision:
- 0:1633dfa4b768
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jan 15 13:51:16 2012 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" +#include "SST25VF.h" + +#define w() wait_us(7) +DigitalOut sr(p21); + +SPI spi(p5,p6,p7); + +SST25VF sram(spi,p21); + +int main() { + + char buff[128]; + + wait(0.2); + + + sram.write((long) 0, 'o'); + sram.write((long)1, 'n'); + sram.write((long)2, 'e'); + sram.write((long)3, '\0'); + for (long int address = 0; address < 4; address++) { + buff[address] = sram.read(address); + } + printf("\noutput1 = %s\n", buff); + + sram.write((long)128, "Hello world!",12); // need separate address space here + + sram.read((long)128, buff, 12); + buff[12]='\0'; + + printf("output2 = %s\n", buff); + + +} \ No newline at end of file