Flash is25lp032d fails to enter sleep mode after erase.

I am using is25lp03d flash with "nordic,qspi-nor" driver. 

The issue is that nrf_qspi_nor.c driver uses `nrfx_qspi_mem_busy_check()` before entering suspend mode. This function repeatedly returns -EBUSY after erasing some portion of flash.

The solution to the problem is to include `.wipwait = true` to the config structure of the `nrfx_qspi_mem_busy_check()` function.

Should that change be included by default in nrfx module?

  • Hi

    I will have to check with the devs about this ticket, but to me it sounds like an okay way to handle things at least. I'll get back to you when I hear from the devs.

    Best regards,

    Simon

  • Hi Michał

    What might be happening here is that the device is still erasing when you ask it to suspend so the response from the device is that it's still busy doing something. Are you sure the error doesn't return from the erase "ongoing" function, since it seems that the erase returns before the device has completed its operation.

    How long is the timing between you trying to erase and calling the sleep mode function, and what are the erase timings of the chip?

    Best regards,

    Simon

  • Hi Simon

    Thanks for looking into it.

    The flash erase takes 7s and it is almost exactly in the middle of the range suggested by datasheet.

    I am using:
    `boot_erase_img_bank` which is calling `flash_area_erase` which is calling `flash_erase` which is calling `z_impl_flash_erase` which is calling `nrf_qspi_nor.c:qspi_erase()`
    Then probably Power Management subsystem is suspending flash by calling `nrf_qspi_nor.c:qspi_suspend()`.

    I do not control the time between calling erase and suspend. It is all within driver. That is why I suggested above implementation.

  • While I'm looking into/asking internally about this, you're not able to see where exactly the suspend is being called from, are you?

    Best regards,

    Simon

  • Below is the backtrace right up to the moment when `nrfx_qspi_mem_busy_check` is suppose to return NRFX_RETURN_BUSY:

    #0 nrfx_qspi_mem_busy_check () at /workdir/modules/hal/nordic/nrfx/drivers/src/nrfx_qspi.c:697
    #1 0x000230b2 in qspi_suspend (dev=0x48bc4 <__device_dts_ord_130>)
    at /workdir/zephyr/drivers/flash/nrf_qspi_nor.c:1250
    #2 qspi_nor_pm_action (dev=0x48bc4 <__device_dts_ord_130>, action=<optimized out>)
    at /workdir/zephyr/drivers/flash/nrf_qspi_nor.c:1298
    #3 0x00019136 in runtime_suspend (async=<optimized out>, delay=..., dev=0x48bc4 <__device_dts_ord_130>)
    at /workdir/zephyr/subsys/pm/device_runtime.c:85
    #4 0x000191c0 in pm_device_runtime_put (dev=dev@entry=0x48bc4 <__device_dts_ord_130>)
    at /workdir/zephyr/subsys/pm/device_runtime.c:333
    #5 0x00022dc2 in qspi_release (dev=dev@entry=0x48bc4 <__device_dts_ord_130>)
    at /workdir/zephyr/drivers/flash/nrf_qspi_nor.c:329
    #6 0x0002377e in qspi_nor_erase (dev=0x48bc4 <__device_dts_ord_130>, addr=<optimized out>, size=<optimized out>)
    at /workdir/zephyr/drivers/flash/nrf_qspi_nor.c:1002
    #7 0x00024252 in cmd_erase (sh=0x48fb0 <shell_uart>, argc=<optimized out>, argv=<optimized out>)
    at /workdir/zephyr/drivers/flash/flash_shell.c:102
    #8 0x0001c1c0 in exec_cmd (help_entry=0x20010f9c <shell_uart_stack+3556>, argv=0x20010fb4 <shell_uart_stack+3580>,
    argc=<optimized out>, sh=0x48fb0 <shell_uart>) at /workdir/zephyr/subsys/shell/shell.c:558
    #9 execute (sh=sh@entry=0x48fb0 <shell_uart>) at /workdir/zephyr/subsys/shell/shell.c:800
    #10 0x0001c450 in state_collect (sh=0x48fb0 <shell_uart>) at /workdir/zephyr/subsys/shell/shell.c:1008
    #11 shell_process (sh=0x48fb0 <shell_uart>) at /workdir/zephyr/subsys/shell/shell.c:1483
    #12 0x0001bb5e in shell_signal_handle (sh=sh@entry=0x48fb0 <shell_uart>, sig_idx=sig_idx@entry=SHELL_SIGNAL_RXRDY,
    handler=handler@entry=0x1c2d5 <shell_process>) at /workdir/zephyr/subsys/shell/shell.c:1296
    #13 0x0001cc32 in shell_thread (arg_log_backend=<optimized out>, arg_log_level=<optimized out>,
    shell_handle=0x48fb0 <shell_uart>) at /workdir/zephyr/subsys/shell/shell.c:1352
    #14 shell_thread (shell_handle=0x48fb0 <shell_uart>, arg_log_backend=<optimized out>, arg_log_level=<optimized out>)
    at /workdir/zephyr/subsys/shell/shell.c:1314
    #15 0x000154dc in z_thread_entry (entry=0x1cb71 <shell_thread>, p1=0x48fb0 <shell_uart>, p2=0x1, p3=0x4)
    at /workdir/zephyr/lib/os/thread_entry.c:48

Related