This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Low Power Mode - nrf52833

We are having trouble getting the NRF52833 to operate in a low power mode.  It always seems to be drawing 1-2mAmps.

Application: Nrf52833, Central host, scans 100ms every 3 seconds, UART to Host MCU to deliver advertisments and peripheral data.

Our application is based on the Central UART example.  Our hardware uses one UART.

We use timers to control scanning and idle times of operation.  We consider the Application to be idle where the UART is disabled, and no BLE communications is active.  But sometimes the current use inreases and does not return to low levels.  How can we debug  what part of the system is running and using the power during idle period when we expect Power management to be running?  Is there additional initialization of power management needed?

static void idle_state_handle(void)
{
if (NRF_LOG_PROCESS() == false)
{
// watchdog & failsafe state management
nrf_pwr_mgmt_run();

}
}

Thanks,

Dan

Parents
  • Hi Sitian,

    Thank you for the information.  We are currently checking with NRF_LOG_ENABLED to 0, I did have that enabled.  Below is the code used to init and de-init the UART.  The FDS storage is also used to save non volatile configurations that are rarely changed.  I will send the timer code that turns on/off the scanning in a separate response.

    Thanks!

    Dan


    static nrf_drv_uart_t cble_uart_inst = NRF_DRV_UART_INSTANCE(0);
    static bool s_bAllowdeInit = true;

    /*******************************************************************************
    * Function Name : void cble_uart_deinit(void)
    * Description : de-init and power down the uart
    * Author : Dan P
    * Date : 02.23.2022
    * Input : None
    * Return : None
    *******************************************************************************/
    void cble_uart_init(void)
    {
    uint16_t u16CheckCount =0;
    ret_code_t err_code;
    if (!s_initialized){

    app_uart_comm_params_t const comm_params =
    {
    .rx_pin_no = RX_PIN_NUMBER,
    .tx_pin_no = TX_PIN_NUMBER,
    .rts_pin_no = RTS_PIN_NUMBER, // assign as a gpio for use in low power control, assign to un-used pins.
    .cts_pin_no = CTS_PIN_NUMBER, // assign as a gpio for use in low power control, assign to un-used pins.
    .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
    .use_parity = false,
    .baud_rate = UART_BAUDRATE_BAUDRATE_Baud115200
    };
    \
    buffers.rx_buf = rx_buf; \
    buffers.rx_buf_size = sizeof (rx_buf); \
    buffers.tx_buf = tx_buf; \
    buffers.tx_buf_size = sizeof (tx_buf); \
    err_code = app_uart_init(&comm_params, &buffers, uart_event_handle, APP_IRQ_PRIORITY_LOWEST); \
    APP_ERROR_CHECK(err_code);

    nrf_uarte_enable(NRF_UARTE1);
    NRF_UARTE1->TASKS_STARTRX=0;
    NRF_UARTE1->TASKS_STARTTX=0;
    NRF_UARTE1->ENABLE=0;

    //nrf_drv_uart_rx_enable(&cble_uart_inst);
    u16CheckCount=0;
    do{
    u16CheckCount++;
    if(nrf_drv_uart_rx_ready(&cble_uart_inst)){
    u16CheckCount = 100;
    break;
    }
    }while(u16CheckCount < 50);

    s_initialized = true;


    }
    }

    /*******************************************************************************
    * Function Name : void cble_uart_deinit(void)
    * Description : de-init and power down the uart
    * Author : Dan P
    * Date : 02.23.2022
    * Input : None
    * Return : None
    *******************************************************************************/
    void cble_uart_deinit(void)
    {

    if (s_initialized && (s_bAllowdeInit == true))
    {

    NRF_UARTE1->TASKS_STOPRX=1;
    NRF_UARTE1->TASKS_STOPTX=1;
    NRF_UARTE1->ENABLE=0;

    cble_uart_flush();
    app_uart_flush();
    cble_uart_close();
    //UARTE0
    // *(volatile uint32_t *)0x40002FFC = 0;
    // *(volatile uint32_t *)0x40002FFC;
    // *(volatile uint32_t *)0x40002FFC = 1;

    //UARTE1
    *(volatile uint32_t *)0x40028FFC = 0; // Power down UARTE1
    *(volatile uint32_t *)0x40028FFC; //
    *(volatile uint32_t *)0x40028FFC = 1; // Power on UARTE1 so it is ready for next time

    s_initialized = false;
    }
    }

Reply
  • Hi Sitian,

    Thank you for the information.  We are currently checking with NRF_LOG_ENABLED to 0, I did have that enabled.  Below is the code used to init and de-init the UART.  The FDS storage is also used to save non volatile configurations that are rarely changed.  I will send the timer code that turns on/off the scanning in a separate response.

    Thanks!

    Dan


    static nrf_drv_uart_t cble_uart_inst = NRF_DRV_UART_INSTANCE(0);
    static bool s_bAllowdeInit = true;

    /*******************************************************************************
    * Function Name : void cble_uart_deinit(void)
    * Description : de-init and power down the uart
    * Author : Dan P
    * Date : 02.23.2022
    * Input : None
    * Return : None
    *******************************************************************************/
    void cble_uart_init(void)
    {
    uint16_t u16CheckCount =0;
    ret_code_t err_code;
    if (!s_initialized){

    app_uart_comm_params_t const comm_params =
    {
    .rx_pin_no = RX_PIN_NUMBER,
    .tx_pin_no = TX_PIN_NUMBER,
    .rts_pin_no = RTS_PIN_NUMBER, // assign as a gpio for use in low power control, assign to un-used pins.
    .cts_pin_no = CTS_PIN_NUMBER, // assign as a gpio for use in low power control, assign to un-used pins.
    .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
    .use_parity = false,
    .baud_rate = UART_BAUDRATE_BAUDRATE_Baud115200
    };
    \
    buffers.rx_buf = rx_buf; \
    buffers.rx_buf_size = sizeof (rx_buf); \
    buffers.tx_buf = tx_buf; \
    buffers.tx_buf_size = sizeof (tx_buf); \
    err_code = app_uart_init(&comm_params, &buffers, uart_event_handle, APP_IRQ_PRIORITY_LOWEST); \
    APP_ERROR_CHECK(err_code);

    nrf_uarte_enable(NRF_UARTE1);
    NRF_UARTE1->TASKS_STARTRX=0;
    NRF_UARTE1->TASKS_STARTTX=0;
    NRF_UARTE1->ENABLE=0;

    //nrf_drv_uart_rx_enable(&cble_uart_inst);
    u16CheckCount=0;
    do{
    u16CheckCount++;
    if(nrf_drv_uart_rx_ready(&cble_uart_inst)){
    u16CheckCount = 100;
    break;
    }
    }while(u16CheckCount < 50);

    s_initialized = true;


    }
    }

    /*******************************************************************************
    * Function Name : void cble_uart_deinit(void)
    * Description : de-init and power down the uart
    * Author : Dan P
    * Date : 02.23.2022
    * Input : None
    * Return : None
    *******************************************************************************/
    void cble_uart_deinit(void)
    {

    if (s_initialized && (s_bAllowdeInit == true))
    {

    NRF_UARTE1->TASKS_STOPRX=1;
    NRF_UARTE1->TASKS_STOPTX=1;
    NRF_UARTE1->ENABLE=0;

    cble_uart_flush();
    app_uart_flush();
    cble_uart_close();
    //UARTE0
    // *(volatile uint32_t *)0x40002FFC = 0;
    // *(volatile uint32_t *)0x40002FFC;
    // *(volatile uint32_t *)0x40002FFC = 1;

    //UARTE1
    *(volatile uint32_t *)0x40028FFC = 0; // Power down UARTE1
    *(volatile uint32_t *)0x40028FFC; //
    *(volatile uint32_t *)0x40028FFC = 1; // Power on UARTE1 so it is ready for next time

    s_initialized = false;
    }
    }

Children
No Data
Related