hi,
I am testing the flash erasing times of nRF52832, and i find that the minimum times of flash erase\write are 10000 documented in the data sheet.
I konw the times are tested at very high temperature(non-normal temperature), so I 'm curious about how many times of flash erase/write are at room tempetature.
The FS and NVMC are programing and downloaded in the nRF52832 chip.
The erase times can get by J-link RTT Viewer, and the codes generate random numbers and write them to flash.
Just pay attention to this times of flash erase (the red arrow is marked) .
Regarding the question:
1) are the times right? Why is it that the flash is still not damaged after so many erases?
2) if not, could i know the times of flash erase/write at room tempetature?
3) are the codes right attached the end of the page?
FS code log: run many times and reset by manual (erase times more than a million times in total)

NVMC code log: erase times more than a million times in total

FS code:
while(true)
{
NRF_LOG_FLUSH();
NRF_LOG_INFO("\n =============================================== ");
uint8_t p_buff[RANDOM_BUFF_SIZE];
uint8_t length = random_vector_generate(p_buff,RANDOM_BUFF_SIZE);
NRF_LOG_INFO("Write Random Vector:");
NRF_LOG_HEXDUMP_INFO(p_buff, length);
NRF_LOG_INFO("");
NRF_LOG_FLUSH();
nrf_delay_ms(20);
memcpy(my_fs_info.write_data, p_buff, length);
my_fs_info.write_len = length;
nrf_delay_ms(100);
// flash write
if((my_fs_info.need_write == true) && (my_fs_info.busy == false)&&(reverse_flag == false))
{
if((write_err_cnt > 100) || (erase_err_cnt > 100))
{
NRF_LOG_INFO(" ==== write enough!!!! ====");
NRF_LOG_INFO(" ==== write enough!!!! ====");
continue;
}
if(my_fs_info.write_len == 0)
{
continue;
}
my_fs_info.busy = true;
my_fs_info.need_write = false;
my_fs_info.need_read = true;
reverse_flag = true;
NRF_LOG_INFO("Address: %08X", FLASH_START_ADDR);
rc = nrf_fstorage_write(&my_fs, FLASH_START_ADDR, &my_fs_info.write_data, my_fs_info.write_len, NULL);
if(rc != NRF_SUCCESS)
{
write_err_cnt += 1;
NRF_LOG_INFO("== fs write error: 0x%x",rc);
}
else
{
write_cnt += 1;
NRF_LOG_INFO(" === write count: %d", write_cnt);
}
}
// flash read
if((my_fs_info.need_read == true)&&(my_fs_info.busy == false))
{
my_fs_info.need_read = false;
rc = nrf_fstorage_read(&my_fs, FLASH_START_ADDR, &my_fs_info.read_data,256);
if(rc != NRF_SUCCESS)
{
NRF_LOG_INFO("0x%x",rc);
}
else
{
NRF_LOG_INFO("Read Flash Data:");
NRF_LOG_HEXDUMP_INFO(my_fs_info.read_data, RANDOM_BUFF_SIZE);
}
}
// flash erase
if((my_fs_info.need_write == false) && (my_fs_info.busy == false)&&(reverse_flag == true))
{
if((write_err_cnt > 100) || (erase_err_cnt > 100))
{
NRF_LOG_INFO(" ==== erase enough!!!! ====");
NRF_LOG_INFO(" ==== erase enough!!!! ====");
continue;
}
my_fs_info.need_read = true;
my_fs_info.need_write = true;
my_fs_info.busy = true;
reverse_flag = false;
rc = nrf_fstorage_erase(&my_fs, FLASH_START_ADDR, 1, NULL);
if(rc != NRF_SUCCESS)/
{
erase_err_cnt += 1;
NRF_LOG_INFO("== fs erase error: 0x%x",rc);
}
else
{
erase_cnt += 1;
NRF_LOG_INFO(" === erase count: %d", erase_cnt);
}
}
idle_state_handle();
}
}
NVMC code:
while(status)
{
addr = 0x00072000;
nrf_nvmc_page_erase(addr);
nrf_nvmc_write_word(addr,src_value);
pdat = (uint32_t *)addr;
NRF_LOG_INFO("0x%x was read from flash\r\n", *pdat);
if((*pdat) != src_value)
{
status = false;
NRF_LOG_INFO(" ===== Flash Error !!! =====");
NRF_LOG_FLUSH();
break;
}
opt_cnt += 1;
NRF_LOG_INFO(" ===== flash operation : %d", opt_cnt);
NRF_LOG_FLUSH();
}
}
best wishes,
thanks.