Does not quite behave properly. Maybe the block size isn't negotiable?
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@67
12e2690d-a6be-4b82-a7b7-
67c4a43b65c8
//! Enable SPI writing
void spiflash_wrten(){
P5OUT&=~SS; //Drop !SS to begin transaction.
//! Enable SPI writing
void spiflash_wrten(){
P5OUT&=~SS; //Drop !SS to begin transaction.
- spitrans8(0x06);//Chip Erase
+ 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.
}
P5OUT|=SS; //Raise !SS to end transaction.
}
P5OUT|=SS; //Raise !SS to end transaction.
break;
case POKE://Poke up bytes from an SPI Flash ROM.
P5OUT|=SS; //Raise !SS to end transaction.
break;
case POKE://Poke up bytes from an SPI Flash ROM.
+ spiflash_wrten();
+ P5OUT&=~SS; //Drop !SS to begin transaction.
+ spitrans8(0x02); //Poke command.
+ //First three bytes are address, then data.
+ for(i=0;i<len;i++)
+ spitrans8(cmddata[i]);
+ P5OUT&=~SS; //Drop !SS to begin transaction.
+ txdata(app,verb,len);
break;
case SPI_ERASE://Erase the SPI Flash ROM.
spiflash_wrten();
break;
case SPI_ERASE://Erase the SPI Flash ROM.
spiflash_wrten();