From: Bjorn G. <bg...@si...> - 2008-10-03 15:12:04
|
On Fri, 3 Oct 2008 15:40:07 +0100 "Jonathan Lewis" <jo...@cs...> wrote: Moi, > Thanks for the tip about putting the M25P80 chip into "Deep Power-down (DP)" > mode. I'll investigate. However, if anyone knows off the top of their head > how to do this I would much appreciate them posting it here. This is untested code that may serve as a starting point: int xmem_deep_power_down(void) { spl_t s; wait_ready(); s = splhigh(); SPI_FLASH_ENABLE(); spi_tx(SPI_FLASH_INS_DP); SPI_FLASH_DISABLE(); splx(s); return xxx; } #define M25P80_SIGNATURE 0x13 int xmem_release_from_deep_power_down(void) { unsigned char signature; spl_t s; s = splhigh(); SPI_FLASH_ENABLE(); spi_tx(SPI_FLASH_INS_RES); spi_tx(0); /* Three dummy bytes */ spi_tx(0); /* Three dummy bytes */ spi_tx(0); /* Three dummy bytes */ FASTSPI_CLEAR_RX(); FASTSPI_RX(signature); SPI_FLASH_DISABLE(); splx(s); if (signature == M25P80_SIGNATURE) return 0; /* Success */ else return -1; /* Fail */ } Cheers, /b -- _ _ ,_______________. Bjorn Gronvall (Björn Grönvall) /_______________/| Swedish Institute of Computer Science | || PO Box 1263, S-164 29 Kista, Sweden | Schroedingers || Email: bg...@si..., Phone +46 -8 633 15 25 | Cat |/ Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30 '---------------' |