Hi,
I have a problem with uart disable function (app_uart_close();). I started from ble_app_uart example, and I want to disable uart when nobody is connected to the Ble device.
First I removed uart_init(); and printf from main and then added next to the ble_evt_handler function:
case BLE_GAP_EVT_CONNECTED: NRF_LOG_INFO("Connected"); err_code = bsp_indication_set(BSP_INDICATE_CONNECTED); APP_ERROR_CHECK(err_code); m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle); APP_ERROR_CHECK(err_code); uart_init(); break; case BLE_GAP_EVT_DISCONNECTED: NRF_LOG_INFO("Disconnected"); // LED indication will be changed when advertising starts. NRF_UART0->TASKS_STOPRX = 1; app_uart_close(); m_conn_handle = BLE_CONN_HANDLE_INVALID; break;
These are just two cases of the function, so on connect I enable the uart and on disconnect, I disable the uart. Problem is when I disable the uart power consumption does not drop and the NRF52 is not low power. In the picture is the part of the power consumption diagram when the device is connected and disconnected:
Is there something I am missing when disabling the uart?