SPI NOR peripheral restart

Hi 

I have an external NOR flash chip which is powered off on startup. The idea is to power up the flash when needed to reserve power. On startup, I get the error message:

<err> spi_nor: SFDP magic ffffffff invalid
<err> spi_nor: SFDP read failed: -22

Enabling the power pin only starts during application code, meaning SPI-NOR fails before that.

Is there a way to restart the SPI-NOR instance or driver to re-attempt initializing the device?

I have had limited success by reorganizing boot priorities to have GPIO start before SPI, but what about the case where I have to reinitialize during runtime?

I have also tried remounting the fstab entry, but it doesn't seem to do anything to the SPI situation.

I appreciate any guidance regarding this

Parents
  • Hi

    You need to make sure you're writing in 4 byte words when using the QSPI, as data needs to be word-aligned. Other than that I'm not aware of any do's or don'ts for writing with the QSPI. Can you share the exact error code/message you're getting when trying to write over QSPI?

    Best regards,

    Simon

  • [00:00:04.712,524] <inf> littlefs: FS at exflash@0:0x0 is 1024 0x1000-byte blocks with 512 cycle
    [00:00:04.712,524] <inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
    [00:00:04.763,854] <inf> littlefs: /lfs1 mounted
    [00:00:05.772,491] <wrn> littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:1897: Superblock 0x1 has become unwritable
    [00:00:05.772,552] <err> fs: file close error (-28)

    Sizes in the first two lines are correct.

    I think the read commands still work in single line mode. So there must be something not working for my chip in the quad-enablements options.

  • Are you able to find out what causes the "Superblock 0x1 has become unwritable" message by debugging, as this means that a superblock couldn't be relocated, and that the filesystem was frozen due to it. So if we find the function calling the "relocation" that might point us in the right direction.

    Best regards,

    Simon

Reply Children
  • I'll look into it, maybe opening a new ticket to track this...

    In the meantime, I got SPI NOR working by restarting the SDHC over SPI. I had to do some hackyness to get the SD card flagged as uninitialized to get that working.

    My issue with SPI NOR was that I manually configured the GPIO for the least power consumption, which changed the interpretation of logic active/inactive on the CS pins. Fixing this fixed the whole SPI NOR restart issue. 

    There is one remaining concern if the SPI flash was not seen on startup, I still cannot mount it after boot. I need to ensure the flash is powered and ready before booting. I got that sorted out with a kernel hook, so all things considered, I'm closing the ticket for now.

    Thanks again for everyone's help!

Related