Erasing 4kb QSPI ext flash block takes too long 700 - 900 millisec

NRF52840 running 17.1 SDK and using QSPI interface to erase a block of memory from AT25FF321A external flash IC.

When we call erase it takes 930 millisec to finish erasing a 4kb block. The IC datasheet says it should only take 45 millisec or something like that. 

Why is it taking so long?

 

nrfx_err_t nrf_err = nrfx_qspi_erase(NRF_QSPI_ERASE_LEN_4KB, start_address);
if (NRFX_SUCCESS == nrf_err)
{
    while(NRFX_SUCCESS != nrf_drv_qspi_mem_busy_check());
}

// this usually takes 770 - 930 millisec to finish
// but the datasheet for the ext falsh says it should only take 45 ms at most

Parents Reply Children
  • Hi Joshua, 
    As far as I know by default WREN is not sent. If you want to send WREN you would need to set WREN to 1 in ADDRCONF register. In the code it's done by calling nrf_qspi_addrconfig_set(). 
    I was suggesting that you should use the logic analyzer to verify the QSPI operation is correct. Please consider that. 

  • Hi,

    Ok so could you provide an example process? 

    would it be like this?

    nrf_qspi_addrconfig_set( WHAT GOES HERE ?);
    nrfx_err_t nrf_err = nrfx_qspi_erase(NRF_QSPI_ERASE_LEN_4KB, start_address);

  • Or would it be something like this?

    // save current reg value
    uint32_t config = QSPI->ADDRCONF;

    // add wren
    bool wren = true;
    config |= (wren ? 1U : 0U) << QSPI_ADDRCONF_WREN_Pos;

    // update register
    QSPI->ADDRCONF = config;
    // send erase
    nrfx_err_t nrf_err = nrfx_qspi_erase(NRF_QSPI_ERASE_LEN_4KB, start_address);
     
    // wait for completion code here
  • Hi Joshua, 
    Could you try this: 

        nrf_qspi_addrconfig_conf_t addr_cfg = {
            .opcode    = 0xB7,
            .byte0     = 0 ,
            .byte1     = 0,
            .mode      = 0,
            .wipwait   = true,
            .wren      = true
        };
        nrf_qspi_addrconfig_set(NRF_QSPI,&addr_cfg);


    As I mentioned, please try to verify the operation using a logic analyzer. It would save you a lot of time. 

  • Hi, we just tried that

    uint32_t                   start    = xTaskGetTickCount();
        nrf_qspi_addrconfig_conf_t addr_cfg = {
            .opcode = 0xB7, .byte0 = 0, .byte1 = 0, .mode = 0, .wipwait = true, .wren = true};
        nrf_qspi_addrconfig_set(NRF_QSPI, &addr_cfg);
        sys_delay_ms(10);
        nrfx_err_t nrf_err = nrfx_qspi_erase(NRF_QSPI_ERASE_LEN_4KB, 0x00041000);
    
        while (NRFX_SUCCESS != nrfx_qspi_mem_busy_check())
            ;
        uint32_t end = xTaskGetTickCount();
        NRF_LOG_INFO("Elapsed: %lu addr: %p", end - start, start_address);

    but still 920 millisec

    Also, we looked on the scope and here are the results when only using nrfx_qspi_erase (no nrf_qspi_addrconfig_set).

    It looks like the nrf sdk DOES send the 0x06 wren command during erase automatically

Related