def SPIsetup(self):
"""Moved the FET into the SPI application."""
self.writecmd(0x01,0x10,0,self.data); #SPI/SETUP
- #self.readcmd();
+
def SPItrans8(self,byte):
"""Read and write 8 bits by SPI."""
data=self.SPItrans([byte]);
client=GoodFET();
client.serInit("/dev/ttyUSB0")
+
client.SPIsetup();
+#Dummy read.
+#Might read as all ones if chip has a startup delay.
+client.SPIjedec();
+
if(sys.argv[1]=="test"):
result="";
dropped=0;
file = open(f, mode='rb')
i=start;
- bytes=file.read();
+ chars=list(file.read());
+ chunksize=0x80;
+
while i<=stop:
- client.SPIpokebyte(i,ord(bytes[i]));
+ bytes=range(0,chunksize);
+ for j in range(0,chunksize):
+ bytes[j]=ord(chars[i+j]);
+ #client.SPIpokebyte(i,ord(chars[i]));
+ client.SPIpokebytes(i,bytes);
- i+=1;
+ i+=chunksize;
if(i%0x100==0):
print "Flashed %06x."%i;
file.close()