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

stop Ble advertising

I want to stop advertising for 8 hours but when I use

		sd_ble_gap_adv_stop();
		sd_ble_gap_connect_cancel();

It starts advertising after 1 or 2 secends again. I think SoftDevice start that but how I stop or start that manually without SD management?

Parents
  • Hi

    the best shot you can take is use the WDT.

    Here is an example, which wakesup after 60min

    static uint16_t wdt_time = 3600; //3600 s = 60 min = 1 hr
    
         void wdt_init(void)
        {
        	NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);   //Configure Watchdog. a) Pause watchdog while the CPU is halted by the debugger.  b) Keep the watchdog running while the CPU is sleeping.
        	NRF_WDT->CRV = wdt_time*32768;             //wdt_time in s
        	NRF_WDT->RREN |= WDT_RREN_RR0_Msk;  //Enable reload register 0
        	NRF_WDT->TASKS_START = 1;           //Start the Watchdog timer
        }
    

    So fater all your prozessing all you do is put the peripheral into sleep or system off. After 60 min the watchdog will fire and reset(!!!) the device, meaning you will lose all RAM data.

    Hope this helps

    Martin

  • thank you so much. but I want to scan IO pin every 20ms, and I want to run only this function not BLE.

Reply Children
No Data
Related