How do I stop ble broadcasting before sleep

SDK:17.1.0
application: ble_app_uart(+ble_app_buttonless dfu service)
bootloader:secure bootloader pca10040e_s112_ble

We recently encountered one while developing our product. After the product goes to sleep, ble still has the problem of reconnection. I wonder if the ble broadcast didn't stop in time. What can I do with ble before going into sleep mode?

  • Hi there,

    I'm not sure I understand the problem correctly. Is the problem that the board is still advertising after going to sleep? If so, can you specify what kind of sleep that you're using and if you're using nRF5SDK or nRF Connect SDK?

    regards

    Jared

  • Hi Jared.
    we are using nrf5SDK. 
    Yes, it will continue after sleep and then eventually stop. We call ’sd_power_system_off‘ to go to sleep.And if it needs to work again, it is awakened by the key.

    Our goal is to get him off the adv after sleep

    regards

    Kenyon

  • Hi,

    Could you show me the part of the code where you go to sleep?

    Also, are you sure that the device isn't waken up from system off sleep?  A reset or if enabled the DETECT signal from the GPIO peripheral can wake up the chip from system off sleep. 

    regards

    Jared 

  • hi Jared
    I'm sorry it took so long to get back to you. Because we Chinese have a long holiday.
    This is a sequence of actions that we do before we go to sleep.

    1.Pull the battery pin down.
    2.Turn off all lights of the device (driven by PWM\APP-PWM\IO PIN, respectively)
    3.Perform uninit operations on pwm and app pwm.
    4.finally call sd_power_system_off();(It can be triggered again by pressing key)

    void LL_GPIO_OutputWrite(
                        unsigned long ulPort ,
                        unsigned long ulPin  ,
                        unsigned long value  )
    {
        if(1 == value) { NRF_GPIO->OUTSET = 1 << ulPin; }
        else           { NRF_GPIO->OUTCLR = 1 << ulPin; }
    }
    void LL_PWM_Sleep(void) {
    
        app_pwm_uninit(&PWM1);
    
        if (m_used & USED_PWM(0))
        {
            nrf_drv_pwm_uninit(&m_pwm0);
        }
        m_used = 0;
    }
    
    void LL_Power_BeforeSleep(void)
    {
        LL_GPIO_OutputWrite(0, LL_PIN__BATT_LVL, LL_PIN_N__BATT_LVL); 
        for(i=0; i<LL_LED_NUM; i++) { 
            LL_LED_OFF((E_LL_LED)i);
        }  
        LL_PWM_Sleep();
        
        sd_power_system_off();
    }


    Best regard!

    kenyon

  • Hi there,

    What does the battery pin do? Does it restrict the supply to the VDD of the chip?

    If you turn off VDD then you have to make sure that every device that is connected to the nRF52810 is also turned off. If not, then the device can supply the nRF52810 through the GPIO header, and it can also break the protection diodes on the GPIO pins.

    Have you checked if the device does a reset right after you put into system off?

    regards

    Jared 

Related