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
  • Hi

    A typical reason for missing or corrupt RTT logs is that both the bootloader and application use RTT logging. If you edit either one of them so that one uses the UART instead this should resolve this issue for you. 

    I'm afraid it's not possible to turn off the logging module during run time in our SDK. If it is turned on it stays on, so if you'd like to only log certain parts of your application before turning it on I suggest that you look into using the UART directly without the logging module instead.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for your reply.

    Both bootloader and main application currently use UART as backend for logging. The issue is that if I turn on NRF_LOG in the bootloader application, the bootloader prints out LOG entries just fine, but then when it jumps to the main application, the main app works fine until it does runs NRF_LOG_INIT() or NRF_LOG_DEFAULT_BACKENDS_INIT(). The main app stops working and never prints out any LOG entries and also does not continue to run the application (without logging)

    If I disable the uart logging in the bootloader, then the main application works just fine and prints out LOG entries just fine.

    So I am not using RTT logging. I am using UART logging for both bootloader and main app.

Reply
  • Hi Simon,

    Thanks for your reply.

    Both bootloader and main application currently use UART as backend for logging. The issue is that if I turn on NRF_LOG in the bootloader application, the bootloader prints out LOG entries just fine, but then when it jumps to the main application, the main app works fine until it does runs NRF_LOG_INIT() or NRF_LOG_DEFAULT_BACKENDS_INIT(). The main app stops working and never prints out any LOG entries and also does not continue to run the application (without logging)

    If I disable the uart logging in the bootloader, then the main application works just fine and prints out LOG entries just fine.

    So I am not using RTT logging. I am using UART logging for both bootloader and main app.

Children
No Data
Related