Skip to content

Instantly share code, notes, and snippets.

@yifanlu
Created April 2, 2017 23:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yifanlu/baa76ab718b33411bdf48a4e9a5f505a to your computer and use it in GitHub Desktop.
Save yifanlu/baa76ab718b33411bdf48a4e9a5f505a to your computer and use it in GitHub Desktop.
SPIway support for Spansion FL128SAIF00
diff --git a/SPIway.py b/SPIway.py
index f3a48b7..f79e52c 100644
--- a/SPIway.py
+++ b/SPIway.py
@@ -176,6 +176,22 @@ class SPIFlasher(TeensySerial):
print "Chip type: unknown (0x%02x)"%self.DEVICE_ID
self.close()
sys.exit(1)
+
+ if self.MF_ID == 0x01:
+ print "Chip manufacturer: Spansion (0x%02x)"%self.MF_ID
+ if self.DEVICE_ID == 0x17:
+ print "Chip type: FL128SAIF00 (0x%02x)"%self.DEVICE_ID
+ self.SPI_BLOCK_COUNT = 256
+ self.SPI_SECTORS_PER_BLOCK = 16
+ self.SPI_SECTOR_SIZE = 0x1000
+ self.SPI_TOTAL_SECTORS = self.SPI_SECTORS_PER_BLOCK * self.SPI_BLOCK_COUNT
+ self.SPI_BLOCK_SIZE = self.SPI_SECTORS_PER_BLOCK * self.SPI_SECTOR_SIZE
+ self.SPI_ADDRESS_LENGTH = 4
+
+ else:
+ print "Chip type: unknown (0x%02x)"%self.DEVICE_ID
+ self.close()
+ sys.exit(1)
else:
print "Chip manufacturer: unknown (0x%02x)"%self.MF_ID
print "Chip type: unknown (0x%02x)"%self.DEVICE_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment