NRFX QSPI driver

Hi,

I am building a Zephyr application that runs on a nRF52840 with QSPI NOR external flash device (mx25l3233f) with CONFIG_PM_DEVICE_RUNTIME enabled.

I have just upgraded to NCS 2.4.1 and I started having consistent issues in initializing the external flash failing with code NRFX_ERROR_TIMEOUT.

Debugging I found out that that error was returned by:

qspi_nor_init() -> qspi_nor_configure() -> qspi_nrfx_configure() -> nrfx_qspi_init() -> qspi_configure() -> qspi_ready_wait()

 The nrfx QSPI driver has a workaround for errata 215, however, according to my tests that's the causing the issue I am seeing:

if (NRF52_ERRATA_215_ENABLE_WORKAROUND || NRF53_ERRATA_43_ENABLE_WORKAROUND)
{
    nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
    nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_ACTIVATE);
    if (qspi_ready_wait() == NRFX_ERROR_TIMEOUT)
    {
        return NRFX_ERROR_TIMEOUT;
    }
}


According to my tests, triggering task ACTIVATE when the status register is already set to "READY" turns the peripheral into "BUSY" state and this causes the following initialization steps to fail.
I have implemented a workaround for this, but I am not sure if this is required because I am doing something wrong anywhere else:
if (NRF52_ERRATA_215_ENABLE_WORKAROUND || NRF53_ERRATA_43_ENABLE_WORKAROUND)
{
    if (nrf_qspi_busy_check(NRF_QSPI) || !nrf_qspi_event_check(NRF_QSPI, NRF_QSPI_EVENT_READY)) {
        nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
        nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_ACTIVATE);
        if (qspi_ready_wait() == NRFX_ERROR_TIMEOUT)
        {
            return NRFX_ERROR_TIMEOUT;
        }
    }
}


This workaround is applied everywhere task ACTIVATE is triggered, and now the external flash can be initialized properly and can enter suspend/resume power states.

Parents Reply Children
No Data
Related