![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Basic fram test for spi connectivity
Dependencies: mbed
Revision 5:25197dce2db7, committed 2015-01-31
- Comitter:
- smigielski
- Date:
- Sat Jan 31 19:30:16 2015 +0000
- Parent:
- 4:a12fae0b702b
- Commit message:
- add write disable
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jan 31 09:55:39 2015 +0000 +++ b/main.cpp Sat Jan 31 19:30:16 2015 +0000 @@ -22,20 +22,23 @@ uint8_t val_register = spi.write(0x00); cs = 1; } -void enableWrite(){ +void sendCommand(uint8_t reg){ cs = 0; - spi.write(FM25CL_WREN); + spi.write(reg); cs = 1; } //Test that spi is working with fram FM25CL memory +//mosi: || 0x05 0x00 || 0x06 || 0x05 0x00 || 0x06 || +//miso: || 0x00 0x00 || 0x00 || 0x00 0x02 || 0x00 || int main() { hold=1; cs=1; while(1) { readRegister(); - enableWrite(); + sendCommand(FM25CL_WREN); readRegister(); + sendCommand(FM25CL_WRDI); wait(0.5); } }