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

CONFIG_LOG at runtime

Hi,

Is it possible to disable logger at runtime on nRF9160? I would like to have a logger at device's first startup after flashing (like in production test mode) and then disable the logger when exiting from that test mode and then rebooting and going to the normal device mode. How should I do that or is it even possible?

Could I set CONFIG_LOG to false or am I even able to change configs at runtime?

Regards,
Tero

Parents Reply Children
  • Could I do that disabling this way?

    1. Flash the device
    2. Running in the test mode
    3. Disable logger
    4. Go to normal mode and reboot the device
    5. Logger not available after reboot

    Is this possible that the device would disable logger (or serial) for rest for its life or to that point someone flashes the device again?

    I have disabled UART0 in the way shown below. But that is done after Non-Volatile storage initialization and when the device mode is read from NVS.

    // Disable UART0
    
    NRF_UARTE0_NS->TASKS_STOPTX = 1;
    NRF_UARTE0_NS->TASKS_STOPRX = 1;
    NRF_UARTE0_NS->ENABLE = 0;

    And replying to my previous message, I haven't tested the suggestion from yet.

  • The best would be to disable logging compile-time, as suggested by , since that will remove any code needed for logging etc. However, if you just want to avoid the current consumption caused by the UART peripheral itself, then disabling the UART should be OK.

  • I know that the best option would be disabling logger compile-time but this is not going to be the solution for my case. We need logger for production testing but not anymore after exiting the test mode. Or then I should disable logger compile-time and use other way, like add printk() to every place that will be needed in testing.

  • Hi,

    anicare-tero said:
    We need logger for production testing but not anymore after exiting the test mode.

    Do you need disconnect the programmer for production testing? If not, could you not re-program firmware without logging after running the tests that require logging?

    anicare-tero said:
    Or then I should disable logger compile-time and use other way, like add printk() to every place that will be needed in testing.

    That may be the best solution in this case. You could still use the log system for another testing during development, but not for logging you need for production testing.

  • Do you need disconnect the programmer for production testing? If not, could you not re-program firmware without logging after running the tests that require logging?

    I can't re-program a firmware because I have to disable UART also in normal mode. And then if I have to flash a normal firmware without UART, I'm not able to write serialnumber and some other stuff to NVS. Or is it possible to flash another firmware without erasing the NVS?

Related