This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF LOG crashlog backend

I can't get flashlog/crashlog to work properly. The symptoms are that when NRF_LOG_BACKEND_FLASH_START_PAGE is set to 0 (i.e logs are written to address right after the application code ends), the flashlog status CLI command reveals that logs are being filled but flashlog read says the flashlog is empty.

If I clear the flashlog using flashlog clear command, I can start reading the newly written logs. However, when the NRF_LOG_FINAL_FLUSH is called before a reset, the code enters a hardfault condition. This means that the NRF_LOG_FINAL_FLUSH's writes are somehow corrupting flash.

To check for that, I changed NRF_LOG_BACKEND_FLASH_START_PAGE to a value after my application and before FDS pages (~150) and logging seems to be working fine and so does NRF_LOG_FINAL_FLUSH. Except when the flash is filled with logs-- when flashlog status says 99% of the flash is used, it doesn't increment the counter for dropped logs anymore. A reset after NRF_LOG_FINAL_FLUSH results in a hardfault again. 

Am I somehow misusing the module? I am using SDK 15.2 and FreeRTOS. I followed how the  flashlog module is used in the ble_cli_app example identically. 

 

Related