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

restart after ble_advertising_on_ble_evt(p_ble_evt)

On an ble advertising timeout an event is dispatched to : ble_advertising_on_ble_evt(p_ble_evt)

I notice the application restart and suspect it due to : ble_advertising.c

"ble_advertising.c" 
   static ble_adv_mode_t adv_mode_next_get(ble_adv_mode_t adv_mode)
    {
        return (ble_adv_mode_t)((adv_mode + 1) % BLE_ADV_MODES);
    }

That return an invalid adv mode code

In the current application the unit should not restart on advertising timeout. Is there a way of accomplishing this ?

Parents Reply
  • Yes, if the return statement succeed the next advertising mode is set to 4 BLE_ADV_MODE_SLOW. The statement does not execute. The below code the SEGGER_RTT does not print out and restart...

      static ble_adv_mode_t adv_mode_next_get(ble_adv_mode_t adv_mode)
    {
    	SEGGER_RTT_printf(0,"Adv mode: %d\n",adv_mode);
    	return (ble_adv_mode_t)((adv_mode + 1)%BLE_ADV_MODES);
    } 
    

    Removed the -O optimization flag from Makefile.

Children
No Data
Related