Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to de-init the NRF_LOG module

Hi Nordic,

I am writing a simple boot-loader, which is working fine without NRF_LOG module enabled. But if I enable the NRF_LOG module, the main app stops working when it is initializing the NRF_LOG again.

I cannot seem to find a way to de-initialize the NRF_LOG module after enabling it. Can you please help me to find a way to do that?

This is what I do to initialize the LOG module (besides enabling it in sdk_config):

int rc = NRF_LOG_INIT(NULL);

APP_ERROR_CHECK(rc);

NRF_LOG_DEFAULT_BACKENDS_INIT();

Parents
  • Well, the NRF_LOG module is not dynamic, so if it's on it's on. I assume resetting the device whenever go from the bootloader to your application is not viable for you? Because if you do that you can init the log for the application after the reset, as there is no way to deinit the NRF_LOG module during run time.

    So I would suggest that you use the UART directly, without the logging module so that you can uninitialize once you're done. You'll have to call the prints with another call than NRF_LOG_INFO(), but other than that it should be rather similar to the NRF_LOG_MODULE in terms of performance and current consumption.

    Using the NRF_LOG_MODULE in both bootloader and app won't be possible I'm afraid.

    Best regards,

    Simon

Reply
  • Well, the NRF_LOG module is not dynamic, so if it's on it's on. I assume resetting the device whenever go from the bootloader to your application is not viable for you? Because if you do that you can init the log for the application after the reset, as there is no way to deinit the NRF_LOG module during run time.

    So I would suggest that you use the UART directly, without the logging module so that you can uninitialize once you're done. You'll have to call the prints with another call than NRF_LOG_INFO(), but other than that it should be rather similar to the NRF_LOG_MODULE in terms of performance and current consumption.

    Using the NRF_LOG_MODULE in both bootloader and app won't be possible I'm afraid.

    Best regards,

    Simon

Children
No Data
Related