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

low power in advertising

I'm using ble_app_uart example.

The board go in low power mode, but after 3 minutes (#define APP_ADV_DURATION  18000  ) go OFF. I need that remain in advertsing mode always.

Only with a bluetooth connection my board must resume and go in IDLE mode.

Is possible ?

Marco

Parents
  • Hi Marco,

    You can disable advertisement timeout by setting APP_ADV_DURATION to 0 and use the BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE flag in advertising_init(). 

  • Thanks,

    in the main loop:

          

        for (;;)
        {
            nrf_gpio_pin_clear(OUT_COMP);
            nrf_delay_ms(2);
            
              idle_state_handle();
            
            nrf_gpio_pin_set(OUT_COMP);
            nrf_delay_ms(2);
        }
    

    I have insert this code to test the difference when the device is connect or not.

    When not connected I expected to see the port change at every interval time but there is no difference between CONNECTED or NOT CONNECTED.

    the routine  idle_state_handle(); always takes 0.5 seconds.

    The  idle_state_handle(); work only in relese mode ?

    Marco

  • when the application go in idle_state_handle(); is in low power ?

    I measure 1,9 mA.

    From your power management power example (https://devzone.nordicsemi.com/power/) with

    3V, 1280 mS of advertising time, 31 bytes of payload and 0 dBm I'm aspected 13 uA.

    #define APP_ADV_INTERVAL                1280

    The time 0,5 sec related with idle_state_handle() seem not connected with 1,28 sec of my advertising time.

    If an event arrive after 0,5 secod from last advertisment I'm aspected that the micro remain il low power and after 1,28 sec check the external event.

    Marco

  • That could be the UART peripheral. As a test, try to not initialize/enable UART in your code. 

    The advertisement events will run in the "background". That is, the softdevice will not wake the application for every advertisement event. 

  • I have already removed the UART, this is my actual main:

    int main(void)
    {
        bool erase_bonds;
        char debug_str[80] = {0};
        int value;
        unsigned char break_point;
        uint32_t p_is_running;
    
        // Initialize.
       // uart_init();
        
        log_init(); 
        timers_init();
    
        nrf_gpio_cfg_output(OUT_COMP);  // pin per visualizzare l'uscita digitale
        nrf_gpio_cfg(OUT_COMP, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_PULLDOWN/*NRF_GPIO_PIN_NOPULL*/, NRF_GPIO_PIN_H0H1, NRF_GPIO_PIN_NOSENSE);
        
     
        flag_connected = 0;
    
        //buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
    //********************************************
    //    sd_clock_hfclk_request();
    //    p_is_running = 0;
    //    while (!p_is_running)
    //    {
    //        sd_clock_hfclk_is_running(&p_is_running);
    //    }
     //********************************************
    /*
        // Start execution.
        printf("\r\nUART started.\r\n");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        value = 105;
        sprintf(debug_str, "valore di variabile = %d", value);
        NRF_LOG_INFO("%s",(uint32_t)debug_str);
    */
    
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            nrf_gpio_pin_clear(OUT_COMP);
            nrf_delay_ms(2);
            
             idle_state_handle();
            
            nrf_gpio_pin_set(OUT_COMP);
         
             nrf_delay_ms(2);
            //nrf_gpio_pin_toggle(OUT_COMP);
         }
    }
    

    I need that my device wake up from SLEEP (low power) only after a bluetooth connection.

    I need to use only few uA during advertising.

    On the oscilloscope I can see the I/O go up each 500 mS (in advertising),  this means that the micro is not in sleep.

    In the same time with an BPA400 bluetooth protocol analizer I can see the advertising at 1,28 sec:

    Marco

  • Please try to measure the current consumption with this .hex file:

    ble_app_beacon_w_softdevice.hex

    It's based on the ble_app_beacon example with adv. interval changed to 1280ms. Are you measuring this on a Nordic development kit or a custom board?

  • I 'm using a my custom board. But now I have found the problem.

    I had forgotten to remove a timer that I used to update the battery service into  timers_init();

    Now if the device is in advertising I don't see the change in the I/O port.

    Thanks for your patient.

    Marco

Reply Children
No Data
Related