Abnormally long time to wakeup flash [SOLUTION]

Started by Uncle Buzz, October 30, 2017, 09:58:24 AM

Uncle Buzz

Hi all,
I was trying to log some data at 1 min intervalle in flash memory on my moteino R6, but I see about 40s more than expected between saves.
I tryied to find out where was the problem, and it seems than the spiflash::wakeup function is the guilty !

As I understand it, when we put flash in sleep mode (power-down mode as Winbond names it), we have to wake up the flash before trying to use it. But spiflash::wakeup function is calling spiflash::command function to send commands to the flash memory, which check and wait until the spiflash::busy function said the memory flash is available and not doing some other stuff...

the spiflash::busy function returns the "read status" register of the flash memory

But from Winbond datasheet, when in power-down mode, the read status command is ignored :
QuoteWhile in the power-down state only the Release Power-down /
Device ID (ABh) instruction, which restores the device to normal operation, will be recognized. All other
instructions  are  ignored.  This  includes  the  Read  Status  Register  instruction
,  which  is  always  available
during normal operation. Ignoring all but one instruction makes the Power Down state a useful condition
for securing maximum write protection. The device always powers-up  in the normal operation  with  the
standby current of ICC1.

So, I wonder if waiting than memory flash are not busy when it sleep always return false ?

Shouldn't we bypass the busy function if we are in sleep mode and we are trying to wake up the flash ?

Is there something I didn't well understood ?


Uncle Buzz

#2
well, I should have check the repository of spiflash before starting this thread... this is already fixed.
I didn't though these threads were relevant since I don't use radio on my sketch.
Sorry for the inconvenience (but proud to have found same solution, even if it was waste of time...)

Felix