Clarify idle_state_handle() function

Hi, I'm building an applicaiton based on ble_app_uart.
I got that using  idle_state_handle(); function to set the my nRF52833 into system ON mode.
I disable system OFF mode before

static void idle_state_handle(void) {
  if (NRF_LOG_PROCESS() == false) {
    nrf_pwr_mgmt_run();
  }
}

In my application I use an app_timer to set a timer period (repeated) after 5minutes nRF will send an "string" to device that connected via BLE and continute wait to the next time to send again.

Please answer for me 3 questions to clarify this function
1. What is NRF_LOG_PROCESS ? when it is false or true ? (I think when device actually is in idle. So when it is idle ? In my application MobilePhone still keeps connect with nRF and app_timer still run.)

2. I got an issue when I use NRF_LOG_INFO() before I comment this function I can not log info in loop () ? And Logging work normally when I comment this function. What doest this function affect to NRF_LOG_INFO (). I set NRF_LOG_DEFFERED 0. 

3. If I can set my device into system ON when I finish my work. by a flag and call nrf_pwr_mgmt_run();

Thanks for your support

Parents
  • Hi,

    1. What is NRF_LOG_PROCESS ? when it is false or true ? (I think when device actually is in idle. So when it is idle ? In my application MobilePhone still keeps connect with nRF and app_timer still run.)

    From documentation

    Macro for processing a single log entry from a queue of deferred logs.

    You can call this macro from the main context or from the error handler to process log entries one by one.

    Note
    If logs are not deferred, this call has no use and is defined as 'false'.
    Return values
    true                  There are more logs to process in the buffer.
    false                 No more logs in the buffer.

    2. I got an issue when I use NRF_LOG_INFO() before I comment this function I can not log info in loop () ? And Logging work normally when I comment this function. What doest this function affect to NRF_LOG_INFO (). I set NRF_LOG_DEFFERED

    From the documentation on deffered mode:

    In the default deferred mode, whenever the logger is used, the pointer to the string and the arguments are stored in an internal buffer and the log is not processed. It is up to the user to trigger processing whenever suitable. In most cases, the processing is performed in an idle stage, when the system would normally sleep. 

    NRF_LOG_PROCESS() must be called to process the logs in deffered mode:. You can use in-place mode instead, but this would increase the time used in interrupt handlers if logs are printed there. 

    3. If I can set my device into system ON when I finish my work. by a flag and call nrf_pwr_mgmt_run();

    Yes, this is possible.

    regards

    Jared 

Reply
  • Hi,

    1. What is NRF_LOG_PROCESS ? when it is false or true ? (I think when device actually is in idle. So when it is idle ? In my application MobilePhone still keeps connect with nRF and app_timer still run.)

    From documentation

    Macro for processing a single log entry from a queue of deferred logs.

    You can call this macro from the main context or from the error handler to process log entries one by one.

    Note
    If logs are not deferred, this call has no use and is defined as 'false'.
    Return values
    true                  There are more logs to process in the buffer.
    false                 No more logs in the buffer.

    2. I got an issue when I use NRF_LOG_INFO() before I comment this function I can not log info in loop () ? And Logging work normally when I comment this function. What doest this function affect to NRF_LOG_INFO (). I set NRF_LOG_DEFFERED

    From the documentation on deffered mode:

    In the default deferred mode, whenever the logger is used, the pointer to the string and the arguments are stored in an internal buffer and the log is not processed. It is up to the user to trigger processing whenever suitable. In most cases, the processing is performed in an idle stage, when the system would normally sleep. 

    NRF_LOG_PROCESS() must be called to process the logs in deffered mode:. You can use in-place mode instead, but this would increase the time used in interrupt handlers if logs are printed there. 

    3. If I can set my device into system ON when I finish my work. by a flag and call nrf_pwr_mgmt_run();

    Yes, this is possible.

    regards

    Jared 

Children
No Data
Related