Flash log backend error ( hardfault: Cause: Data bus error)

Hi!

I just added flash log backend to my S140 NRF52840 project and I've been starting receive error on nrf_log_frontend_dequeue() from my main() :

[00:00:00.041,870] <error> hardfault: HARD FAULT at 0x000245F6
[00:00:00.042,236] <error> hardfault:   R0:  0x000930EC  R1:  0x2000DA98  R2:  0x00000008  R3:  0x4001E400
[00:00:00.042,724] <error> hardfault:   R12: 0xFA000000  LR:  0x0002469B  PSR: 0x81000018
[00:00:00.043,212] <error> hardfault: Cause: Data bus error (return address in the stack frame is not related to the instruction that caused the error).
 
0x000245F6 - seems like soft device address:

 


Could someone point me out what problem is?
  • Hi,

    Could you please show us how you enable flash log backend ? 

    Please make sure that when you access flash, the sd_* APIs are used (nrf_fstorage_sd) because it's not supposed to access flash directly when the softdevice is active. 

  • void initialize_logger(void)

    {

    ret_code_t err = NRF_LOG_INIT(app_timer_cnt_get);

    APP_ERROR_CHECK(err);

    NRF_LOG_DEFAULT_BACKENDS_INIT();

    #if NRF_LOG_BACKEND_FLASHLOG_ENABLED

    NRF_LOG_BACKEND_FLASHLOG_DEF(___flash_log_backend);

    err = nrf_log_backend_flash_init(&nrf_fstorage_sd);

    APP_ERROR_CHECK(err);

    int32_t backend_id = nrf_log_backend_add(&___flash_log_backend, NRF_LOG_SEVERITY_DEBUG); APP_ERROR_CHECK_BOOL(backend_id >= 0);

    nrf_log_backend_enable(&___flash_log_backend);

    #endif

    }

  • Hi Polek,

    Address 0x000245F6 is inside the softdevice but it doesn't point to any common asserts that we know. 


    Could you check what's your FLASH_LOG_START_ADDR ? 

    there is some discussion about that in this ticket:  RE: NRF LOG crashlog backend 

    Please double check if the page right after the application code is clear and you are not writing anything to there. 

    I'm not so sure why you need to call NRF_LOG_DEFAULT_BACKENDS_INIT() ? 

    Could you please try testing with the \examples\ble_peripheral\experimental\ble_app_cli to see if you have the same issue with the log flash back end ? 

    If you can provide us some minimal code that can reproduce the issue it would be great. 

Related