Hello,
I need to reset FDS. How can I get it's address / size in code ? How to erase it's area ?
Thank you.
Hello,
I need to reset FDS. How can I get it's address / size in code ? How to erase it's area ?
Thank you.
Error printed fatal error on RTT output (in event management)
I finally found a way to create my "FDS" format that works nice. Thank you for your help.
This sounds interesting. Is this code publicly accessible on github?
This sounds interesting. Is this code publicly accessible on github?
void fds_erase()
{
flash_bounds_set();
NRF_LOG_INFO("FDS area is 0x%08X - 0x%08X", m_fs.start_addr, m_fs.end_addr - 1);
ret_code_t rc = nrf_fstorage_init(&m_fs, &nrf_fstorage_nvmc, NULL); // only working for bootloader
if (rc == NRF_SUCCESS)
{
NRF_LOG_INFO("nrf_fstorage_init OK");
}
else
{
NRF_LOG_ERROR("nrf_fstorage_init error (%d)", rc);
return;
}
for (int a = m_fs.start_addr; a < m_fs.end_addr; a++)
{
unsigned char * fds_area = (unsigned char *) a;
if (fds_area[0] != 0xFF)
{
NRF_LOG_INFO("FDS not clear at 0x%08X", a);
break;
}
}
for (int p = 0; p < FDS_VIRTUAL_PAGES; p++)
{
NRF_LOG_INFO("FDS erasing page %d", (int) p);
#if defined(NRF51)
int erase_unit = 1024;
#elif defined(NRF52_SERIES)
int erase_unit = 4096;
#endif
int page_addr = m_fs.start_addr + p * erase_unit; // erase unit == virtual page size
nrf_nvmc_page_erase(page_addr);
low_power_delay_ms(200);
}
for (int a = m_fs.start_addr; a < m_fs.end_addr; a++)
{
unsigned char * fds_area = (unsigned char *) a;
if (fds_area[0] != 0xFF)
{
NRF_LOG_ERROR("FDS erase failed at 0x%08X", a);
break;
}
}
NRF_LOG_INFO("FDS erase finished");
}This is the part of my code that can interest you (for bootloader).
Thank you!