and a bug with the execution of the first command after powerup
has been fixed. This client is now useful.
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@70
12e2690d-a6be-4b82-a7b7-
67c4a43b65c8
def SPIsetup(self):
"""Moved the FET into the SPI application."""
self.writecmd(0x01,0x10,0,self.data); #SPI/SETUP
def SPIsetup(self):
"""Moved the FET into the SPI application."""
self.writecmd(0x01,0x10,0,self.data); #SPI/SETUP
def SPItrans8(self,byte):
"""Read and write 8 bits by SPI."""
data=self.SPItrans([byte]);
def SPItrans8(self,byte):
"""Read and write 8 bits by SPI."""
data=self.SPItrans([byte]);
client=GoodFET();
client.serInit("/dev/ttyUSB0")
client=GoodFET();
client.serInit("/dev/ttyUSB0")
+#Dummy read.
+#Might read as all ones if chip has a startup delay.
+client.SPIjedec();
+
if(sys.argv[1]=="test"):
result="";
dropped=0;
if(sys.argv[1]=="test"):
result="";
dropped=0;
file = open(f, mode='rb')
i=start;
file = open(f, mode='rb')
i=start;
+ chars=list(file.read());
+ chunksize=0x80;
+
- 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);
if(i%0x100==0):
print "Flashed %06x."%i;
file.close()
if(i%0x100==0):
print "Flashed %06x."%i;
file.close()
P5OUT|=SS;
P5DIR|=MOSI+SCK+SS;
P5DIR&=~MISO;
P5OUT|=SS;
P5DIR|=MOSI+SCK+SS;
P5DIR&=~MISO;
+
+ //Begin a new transaction.
+ P5OUT&=~SS;
+ P5OUT|=SS;
}
//! Read and write an SPI bit.
}
//! Read and write an SPI bit.