From e3e1bb605963def746b50f62277180e567d3b615 Mon Sep 17 00:00:00 2001 From: travisutk Date: Tue, 29 Sep 2009 23:06:39 +0000 Subject: [PATCH] Atmel JEDEC info for SPI Flash. Commented choice of chunk size, which must be an even fraction of the page size. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@155 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETSPI.py | 3 ++- client/goodfet.spiflash | 2 ++ firmware/apps/spi/spi.c | 4 +++- firmware/lib/command.c | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/GoodFETSPI.py b/client/GoodFETSPI.py index e0a6126..5d42354 100644 --- a/client/GoodFETSPI.py +++ b/client/GoodFETSPI.py @@ -29,7 +29,8 @@ class GoodFETSPIFlash(GoodFETSPI): JEDECmanufacturers={0xFF: "MISSING", 0xEF: "Winbond", 0xC2: "MXIC", - 0x20: "Numonyx/ST" + 0x20: "Numonyx/ST", + 0x1F: "Atmel" }; JEDECdevices={0xFFFFFF: "MISSING", diff --git a/client/goodfet.spiflash b/client/goodfet.spiflash index 8d93e3a..1005617 100755 --- a/client/goodfet.spiflash +++ b/client/goodfet.spiflash @@ -126,6 +126,8 @@ if(sys.argv[1]=="flash"): i=start; chars=list(file.read()); + + #N.B., chunksize must be an even fraction of 0x100. chunksize=0x80; while i<=stop: diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index c21cbc1..6e503f2 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -66,9 +66,11 @@ unsigned char spitrans8(unsigned char byte){ //! Enable SPI writing void spiflash_wrten(){ SETSS; + /* P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0x04);//Write Disable P5OUT|=SS; //Raise !SS to end transaction. + */ P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0x06);//Write Enable P5OUT|=SS; //Raise !SS to end transaction. @@ -205,7 +207,7 @@ void spihandle(unsigned char app, case SPI_JEDEC://Grab 3-byte JEDEC ID. P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0x9f); - len=3; + len=3; //Length is variable in some chips, 3 minimum. for(i=0;i