goodfet.msp430 selftest is working!
[goodfet] / client / GoodFETSPI.py
index 044aea2..0020ec2 100644 (file)
@@ -30,7 +30,8 @@ class GoodFETSPIFlash(GoodFETSPI):
                         0xEF: "Winbond",
                         0xC2: "MXIC",
                         0x20: "Numonyx/ST",
-                        0x1F: "Atmel"
+                        0x1F: "Atmel",
+                        0x01: "AMD/Spansion"
                         };
 
     JEDECdevices={0xFFFFFF: "MISSING",
@@ -62,6 +63,7 @@ class GoodFETSPIFlash(GoodFETSPI):
         """Grab an SPI Flash ROM's JEDEC bytes."""
         data=[0x9f, 0, 0, 0];
         data=self.SPItrans(data);
+        
         self.JEDECmanufacturer=ord(data[1]);
         self.JEDECtype=ord(data[2]);
         self.JEDECcapacity=ord(data[3]);
@@ -91,11 +93,13 @@ class GoodFETSPIFlash(GoodFETSPI):
     def SPIpokebyte(self,adr,val):
         self.SPIpokebytes(adr,[val]);
     def SPIpokebytes(self,adr,data):
-        #self.SPIwriteenable();
-        adranddata=[(adr&0xFF0000)>>16,
-              (adr&0xFF00)>>8,
-              adr&0xFF
-              ]+data;
+        #Used to be 24 bits, BE, not 32 bits, LE.
+        adranddata=[adr&0xFF,
+                    (adr&0xFF00)>>8,
+                    (adr&0xFF0000)>>16,
+                    0, #MSB
+                    ]+data;
+        #print "%06x: poking %i bytes" % (adr,len(data));
         self.writecmd(0x01,0x03,
                       len(adranddata),adranddata);