Hi,
I'm developing a custom application starting from ble_hrm_freertos application. When NRF_LOG is enabled there is no way let the chip in low power consumption. I found the problem related to the following code in logger_thread function
#if NRF_LOG_ENABLED
/** **************************************************************************
** @brief Logger task
**
** This thread is responsible for processing log entries if logs are deferred.
** Thread flushes all log entries and suspends. It is resumed by idle task hook.
**
** @param arg Task arguments (unused)
** *************************************************************************/
void TASK_Logger(void * arg)
{
UNUSED_PARAMETER(arg);
NRF_LOG_INFO("Logger task started");
while (1)
{
NRF_LOG_FLUSH();
vTaskSuspend(NULL);
}
}
#endif/** **************************************************************************
** @brief Idle task hook
**
** @note Idle hook must be enabled in FreeRTOS configuration (configUSE_IDLE_HOOK).
** *************************************************************************/
void TASK_Idle( void )
{
#if NRF_LOG_ENABLED
vTaskResume(m_logger_task);
#endif
}
- When no other thread is scheduled the idle hook is called
- The idle hook resumes the logger thread
- After logger suspends, the idle hook is called again
This loop clearly prevents the device from going into low power. My question is the following: is there any other way to implement NRF_LOG flush without the side effect of increasing power consumption that much.
Best regards,
Andrea