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

suspend NRF_LOG to save power and then resume

Help, I want to run NRF_LOG_ENABLED builds but occasionally I want the device to sleep for (many) minutes, so I wish to turn off the NRF_LOG_UART backend since it consumes 200-300 uA, and then renable when back running, I have tried various hacks but to no avail, is there any easy way to achieve this - thanks

Parents
  • Hi, have you tried to stop UART RX and TX before going to sleep? I was able to get the current down by adding the following two lines to the idle_state_handle. It seems stable to me. The function is from the hrs example in SDK 15.2.0

    static void idle_state_handle(void)
    {
        ret_code_t err_code;

        err_code = nrf_ble_lesc_request_handler();
        APP_ERROR_CHECK(err_code);

        if (NRF_LOG_PROCESS() == false)
        {
            NRF_UARTE0->TASKS_STOPRX = 1;
            NRF_UARTE0->TASKS_STOPTX = 1;
            nrf_pwr_mgmt_run();

        }
Reply
  • Hi, have you tried to stop UART RX and TX before going to sleep? I was able to get the current down by adding the following two lines to the idle_state_handle. It seems stable to me. The function is from the hrs example in SDK 15.2.0

    static void idle_state_handle(void)
    {
        ret_code_t err_code;

        err_code = nrf_ble_lesc_request_handler();
        APP_ERROR_CHECK(err_code);

        if (NRF_LOG_PROCESS() == false)
        {
            NRF_UARTE0->TASKS_STOPRX = 1;
            NRF_UARTE0->TASKS_STOPTX = 1;
            nrf_pwr_mgmt_run();

        }
Children
Related