This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

QSPI async read write

Hi,

We are using a custom board based on nRF 52840, trying to transfer data to external QSPI  flash(GD2QC).

Flash  was successfully initialized and exchanged chunks of data. Our use case is mostly  async read and write based on ble data.

But after some time qspi stops responding  with NRF_BUSY after initialization. After referring sdk 15.2 interrupt clear issue, we cherry picked qspi driver files from sdk ver 17.2, but issue still exists.

Once initialized we are not calling nrf_drv_qspi_uninit() since we . Also MCU power management is off.

Here is our qspi config

{                                                                       \
    .xip_offset  = 0,                         \
    .pins = {                                                           \
       .sck_pin     = 19,                                \
       .csn_pin     = 20,                                \
       .io0_pin     = 17,                                \
       .io1_pin     = 22,                                \
       .io2_pin     = 23,                                \
       .io3_pin     = 21,                                \
    },                                                                  \
    .prot_if = {                                                        \
        .readoc     = (nrf_qspi_readoc_t)0,       \
        .writeoc    = (nrf_qspi_writeoc_t)0,     \
        .addrmode   = (nrf_qspi_addrmode_t)0,   \
        .dpmconfig  = 0,                                            \
    },                                                                  \
    .phy_if = {                                                         \
        .sck_delay  = (uint8_t)1,              \
        .dpmen      = 0,                                            \
        .spi_mode   = (nrf_qspi_spi_mode_t)0,       \
        .sck_freq   = (nrf_qspi_frequency_t)15, \
    },                                                                  \
    .irq_priority   = (uint8_t)6,           \
}

Thanks,

Manoj

Parents Reply Children
  • Hi,

    Thank you for the quick response.

    Here is the link to data sheet of the external flash.

    http://www.elm-tech.com/en/products/spi-flash-memory/gd25q16/gd25q16.pdf

    I followed QSPI example pointed in your answer. I have my wait_4 peripheral as in the example.

    #define wait_4_peripheral() do { \
            while (!m_finished) {\
            } \
            m_finished = false;    \
        } while (0)

    After issuing a nrf_drv_qspi_read, the mcu waits for the peripheral ever. The error code was NRF_ERROR_BUSY

    By 17.2  I meant qspi driver version available here - https://github.com/NordicSemiconductor/nrfx/tree/v1.7.2

    I was referring this issue in the forum - https://devzone.nordicsemi.com/f/nordic-q-a/50290/qspi-interrupt-hangs-caused-by-power-consumption-problems/201095#201095

    Regards,

    Manoj

  • Hi Manoj,

    Thanks for clearing that up!

    Did you also add the following callback

    static void qspi_handler(nrf_drv_qspi_evt_t event, void * p_context)
    {
        UNUSED_PARAMETER(event);
        UNUSED_PARAMETER(p_context);
        m_finished = true;
    }

    which is called by

    err_code = nrf_drv_qspi_erase(NRF_QSPI_ERASE_LEN_64KB, 0);
        APP_ERROR_CHECK(err_code);
        WAIT_FOR_PERIPH();
        NRF_LOG_INFO("Process of erasing first block start");


    Kind regards,
    Øyvind

  • Yes. I do have the irq callback.

    On further debugging what I observed is qspi driver returns NRFX_ERROR_BUSY from qspi_task_perform

    static nrfx_err_t qspi_task_perform(nrf_qspi_task_t task)
    {
    // Wait for peripheral
    if (m_cb.is_busy)
    {
    return NRFX_ERROR_BUSY;
    }

    Manoj

  • is this issue related to nRF52840 Engineering A Errata

    3.29 [121] QSPI: Second read and long read commands fail

    This anomaly applies to IC Rev. Engineering A, build codes QIAA-AA0. Symptoms

    • QSPI read command never gets sent.

    • QSPI read command of more than 0x20 characters fails. Conditions QSPI.IFCONFIG1 is different than 0xYY0404YY, where Y is any value. Consequences QSPI is not functional.

    Best Regards,

    Manoj

  • Do you have an engineering revision of your device? This is a very old device. Please provide markings on your device.


    Also, I see pasted the wrong function in my previous post, it should have been:

     err_code = nrf_drv_qspi_init(&config, qspi_handler, NULL);
        APP_ERROR_CHECK(err_code);
        NRF_LOG_INFO("QSPI example started.");

    Not that this should do any difference. 


    On further debugging what I observed is qspi driver returns NRFX_ERROR_BUSY from qspi_task_perform

    What task is failing?

    /**
     * @brief QSPI tasks.
     */
    typedef enum
    {
        /*lint -save -e30*/
        NRF_QSPI_TASK_ACTIVATE   = offsetof(NRF_QSPI_Type, TASKS_ACTIVATE),   /**< Activate the QSPI interface. */
        NRF_QSPI_TASK_READSTART  = offsetof(NRF_QSPI_Type, TASKS_READSTART),  /**< Start transfer from external flash memory to internal RAM. */
        NRF_QSPI_TASK_WRITESTART = offsetof(NRF_QSPI_Type, TASKS_WRITESTART), /**< Start transfer from internal RAM to external flash memory. */
        NRF_QSPI_TASK_ERASESTART = offsetof(NRF_QSPI_Type, TASKS_ERASESTART), /**< Start external flash memory erase operation. */
        NRF_QSPI_TASK_DEACTIVATE = offsetof(NRF_QSPI_Type, TASKS_DEACTIVATE), /**< Deactivate the QSPI interface. */
        /*lint -restore*/
    } nrf_qspi_task_t;
     

    Have you verified that the m_finished flag is toggled during debugging? Are you certain that you have the correct commands for the GD25Q16C?

    -Øyvind

Related