nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs

nRF52840 SDK 16 sd140 - how to store the NRF_LOG_ERROR

Hi guys,

I have developed a custom board using the nRF52840 module and the SDK16.If the peripheral is disconnected from the central, it starts advertising again in normal conditions.

However, sometimes the peripheral disconnects from the central and stops advertising. I need to find and handle the error but it is very difficult.

This happens randomly and not often. I cannot reproduce the error, and I cannot debug it.

What I am considering is to store in the internal flash memory the NRF_LOG_ERROR, so the next time the firmware crashes, to retrieve the error code and the line number.

However, I do not know how to do that, is there any example?

Is there another way to do that?

Parents Reply Children
  • Hi

    Thank you for your solutions. I tried both of them, and they both work well. However, I prefer your modified error handler because is simple and easy to integrate with my application. I have some questions if you can help me

    I use the SDK16 and nRF52840DK

    1. Is there any reason that you just store the errors and not the asserts?

    2. You disable the soft device before writing the flash. Is it safe to write the flash without disabling the sd? To disable the sd requires stopping all the ble activities (advertising, active connections etc). This complicates the things.

    3. Any tip to visualize in proper way the error code and line number?

Related