Hi,
I have a crash in the LOG backend UART when the system shutdowns:
<info> app: poweroff... <debug> app: Disconnected connection handle 0 <info> app: Disconnected 1 links. <info> pwr_mgmt: Shutdown request 0 <info> pwr_mgmt: Shutdown started. Type 0 <info> app: NRF_PWR_MGMT_EVT_PREPARE_WAKEUP <info> pwr_mgmt: SysOff handler 0x00030775 => ready <info> pwr_mgmt: Maximum CPU usage: 74% <info> p<info> pwr_mgmt: Shutdown complete. <debug> nrf_sdh_ble: BLE event: 0x11. <error> app: ERROR 17 [NRF_ERROR_BUSY] at sdk-nrf52/components/libraries/log/src/nrf_log_backend_uart.c:83 PC at: 0x0002649B <error> app: End of error report
My power manager handler is as follows:
static bool app_shutdown_handler(nrf_pwr_mgmt_evt_t event) { uint32_t err_code; switch (event) { case NRF_PWR_MGMT_EVT_PREPARE_WAKEUP: NRF_LOG_INFO("NRF_PWR_MGMT_EVT_PREPARE_WAKEUP"); //Configure the sense to be woken up on push. nrf_gpio_cfg_sense_input(INT_BTN_USB, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW); NRF_LOG_FINAL_FLUSH(); return true; break; default: return true; } return true; }
The crash occurs when the backend calls nrf_drv_uart_tx() that returns BUSY. I've tried to call NRF_LOG_FINAL_FLUSH() but the problem is still present. Is there a way to avoid this crash ? I did not see any way to disable the backend.
I use a NRF52832 and the SDK V15.2. Logs are deferred and the main calls NRF_LOG_PROCESS() in a while loop to empty the queue.
Best regards,
Mathieu