Sonder Design Team / Memory25L16_fast

Dependents:   BlackBoard_Firmware_Fast_read_not_test

Fork of Memory by Sonder Design Team

Revision:
7:9d6961dcb7bb
Parent:
6:c11cb6709b8b
--- a/Memory.cpp	Thu Dec 22 22:16:11 2016 +0000
+++ b/Memory.cpp	Thu Feb 09 01:09:28 2017 +0000
@@ -110,7 +110,7 @@
     for(int i =0; i<length; i++) {
         if(address%256==0) {                //Handle start and end of pages
             _cs_mem=1;
-            wait_us(10);
+            wait_us(10);            
             //wait for the WIP bit to go low
             _cs_mem=0;                           //Selet memory
             my_spi.write(0x05);             //Send read status register command
@@ -120,15 +120,19 @@
                 my_spi.write(0x05);         //Send read status register command
                 byte1 = my_spi.write(dummy);//Send dummy byte to read status reg
             }
+            
+            //Select memory
             _cs_mem=1;
-
+            wait_us(10);
             _cs_mem=0;                           //Selet memory
+            
             my_spi.write(06);               //Set Write Enable flag in the status reg
             _cs_mem=1;
             wait_us(10);
-
             _cs_mem=0;                           //Selet memory
-            my_spi.write(02);               //Send read comand
+            
+            //Write the destination address
+            my_spi.write(02);               //Send Write comand
             my_spi.write(address>>16);      //Send high address byte
             my_spi.write(address>>8);       //Send middle adress byte
             my_spi.write(address);          //Send low address