Hello,
I am working on an nRF52840 with S140SD chip.
I am currently using the RTT as a backend for logs. I tried adding the Flashlog backend in order to save the logs in non-volatile memory however it doesn't appear to be saving them in the flash.
Here is my current initialization:
// Define log backend for using non-volatile memory NRF_LOG_BACKEND_FLASHLOG_DEF(m_flash_log_backend); NRF_LOG_BACKEND_CRASHLOG_DEF(m_crash_log_backend); void log_init() { // Initialize logging module ret_code_t err_code = NRF_LOG_INIT(app_timer_cnt_get, TIMESTAMP_FREQ); APP_ERROR_CHECK(err_code); NRF_LOG_DEFAULT_BACKENDS_INIT(); // Enable RTT // Add flashlog backend flashlog_init(); NRF_LOG_ERROR("Test flash log"); NRF_LOG_WARNING("Test warning flash log"); NRF_LOG_INFO("Test info flash log"); NRF_LOG_FLUSH(); } void flashlog_init(void) { ret_code_t ret; int32_t backend_id; ret = nrf_log_backend_flash_init(&nrf_fstorage_sd); APP_ERROR_CHECK(ret); backend_id = nrf_log_backend_add(&m_flash_log_backend, NRF_LOG_SEVERITY_WARNING); APP_ERROR_CHECK_BOOL(backend_id >= 0); backend_id = nrf_log_backend_add(&m_crash_log_backend, NRF_LOG_SEVERITY_INFO); APP_ERROR_CHECK_BOOL(backend_id >= 0); nrf_log_backend_enable(&m_flash_log_backend); nrf_log_backend_enable(&m_crash_log_backend); }
The sdk_config was modified to use:
NRF_QUEUE_ENABLED 0 RF_LOG_BACKEND_FLASH_ENABLED 1 NRF_LOG_BACKEND_FLASHLOG_ENABLED 1 NRF_LOG_BACKEND_FLASHLOG_QUEUE_SIZE 8 NRF_LOG_BACKEND_CRASHLOG_ENABLED 1 NRF_LOG_BACKEND_CRASHLOG_FIFO_SIZE 8 NRF_LOG_BACKEND_FLASH_SER_BUFFER_SIZE 64 NRF_LOG_BACKEND_FLASH_START_PAGE 0 NRF_LOG_BACKEND_PAGES 10 NRF_LOG_MSGPOOL_ELEMENT_COUNT 16 NRF_LOG_BUFSIZE 8192 NRF_LOG_FILTERS_ENABLED 1
I am reading the flash and getting the text using
nrfjprog --readcode flashhex && python3 hex2dump.py flashhex > flash.txt
I also modified the linker to add a section for the flash storage.
I am not seeing the logs that were supposed to be stored in the flash.
What could I be doing wrong?
Thank you.