Perform a software reset of the spi flash before init

This commit is contained in:
Michael McMaster 2021-02-09 12:12:37 +10:00
parent 2cf8d58667
commit 349051b744
1 changed files with 15 additions and 3 deletions

View File

@ -164,11 +164,23 @@ static void spiFlash_init(S2S_Device* dev)
nNOR_CS_Write(1); // Deselect
NOR_SPI_Start();
CyDelayUs(1);
CyDelayUs(50); // tRPH is 35 uS. Wait a bit longer
// Mode-bit-reset (go back to normal from high performance mode)
nNOR_CS_Write(0); // Select
CyDelayCycles(4); // Tiny delay
spiFlashByte(0xFF);
nNOR_CS_Write(1); // Deselect
CyDelayCycles(4); // Tiny delay
// Software-reset
nNOR_CS_Write(0); // Select
CyDelayCycles(4); // Tiny delay
spiFlashByte(0xF0);
nNOR_CS_Write(1); // Deselect - reset is triggered on the deselect
CyDelayUs(50); // tRPH is 35 uS. Wait a bit longer
nNOR_CS_Write(0); // Select
// JEDEC standard "Read Identification" command
// returns CFI information
spiFlashByte(0x9F);
@ -450,4 +462,4 @@ static int spiFlash_readAsyncPoll(S2S_Device* dev)
}
return allComplete;
}
}