flash partial erase operation

hi support team,

am i operate partial erase correctly? i added delay_ms(10000) to see the memory, find out that only partialerase once, before i changes from 1 to 2, the flash is all changed to 0xFF.

so we still need to wait for over 85ms to make sure the flash operation is finished, correct?

void partial_page_erase(uint32_t address)
{
       NRF_NVMC->ERASEPAGEPARTIALCFG = 1;//1ms
       for(uint8_t i = 0; i<86; i++)
       {
             // Enable erase.
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een;
            __ISB();
            __DSB();
            nrf_gpio_pin_set(14);
            NRF_NVMC->ERASEPAGEPARTIAL = address;
            nrf_gpio_pin_clear(14);
            wait_for_flash_ready();
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
            nrf_delay_ms(10000);
            __ISB();
            __DSB();
      }
}

Regards,

William.

Related