This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

uart disable problem

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?

Parents
  • Hi,

    What are the exact power consumption level you are measuring before an after the init and uninit? Knowing this will be of great help when tracking down the possibly still active components.

    Have you seen this and this post?
    Could you attempt to abort the rx/tx explicitly, as described by my colleague Stian in the second forum post, and get back to me with the results?
    It seems probable that your issue might be the same.

    I will investigate this further and get back to you tomorrow.

    Best regards,
    Karl

Reply
  • Hi,

    What are the exact power consumption level you are measuring before an after the init and uninit? Knowing this will be of great help when tracking down the possibly still active components.

    Have you seen this and this post?
    Could you attempt to abort the rx/tx explicitly, as described by my colleague Stian in the second forum post, and get back to me with the results?
    It seems probable that your issue might be the same.

    I will investigate this further and get back to you tomorrow.

    Best regards,
    Karl

Children
No Data
Related