My issue seems to be similar to DRGN-12539. However, I am erasing internal flash.
I am calling in a loop nrfx_nvmc_page_erase to erase multiple pages of flash. At first, I erase all the required pages at once
ret_code_t erase(uint32_t startAddress, uint32_t pageCount)
{
for (uint32_t i = 0; i < pageCount; i++)
{
VERIFY_SUCCESS(nrfx_nvmc_page_erase(startAddress + (i * NVM_PAGE_SIZE)));
}
return NRF_SUCCESS;
}
I change it to use an app timer that will only erase one page at a time.
#define START_ADDRESS (0x00060000)
#define PAGE_COUNT 5
#define NVM_PAGE_SIZE (4096) // Bytes in one page
APP_TIMER_DEF(m_erase_timer);
static uint32_t m_erase_page_offest = 0;
static void erase_page(void *p_context)
{
UNUSED_VARIABLE(p_context);
if (m_erase_page_offest < PAGE_COUNT)
{
uint32_t address = START_ADDRESS + (m_erase_page_offest * NVM_PAGE_SIZE);
ret_code_t err_code = erase(address, 1);
APP_ERROR_CHECK(err_code);
m_erase_page_offest++;
}
}
/**@brief Function for the Timer initialization.
*
* @details Initializes the timer module.
*/
static void timers_init(void)
{
// Initialize timer module, making it use the scheduler
ret_code_t err_code = app_timer_init();
APP_ERROR_CHECK(err_code);
app_timer_create(&m_erase_timer, APP_TIMER_MODE_REPEATED, erase_page);
}
/**@brief Function for application main entry.
*/
int main(void)
{
ret_code_t err_code;
timers_init();
err_code = app_timer_start(m_erase_timer, APP_TIMER_TICKS(1000), NULL);
APP_ERROR_CHECK(err_code);
for (;;)
{
if (NRF_LOG_PROCESS() == false)
{
nrf_pwr_mgmt_run();
}
}
}
/**
* @}
*/
In both case, I will get a NRF_FAULT_ID_SD_ASSERT during the process. It varies on which page it ultimately triggers the failure.
I'm using S112 v7.2.0 on NRF52832