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

ble_advdata_set

I use SES for debugging,

the chip is nrf52840 with softdevice 140, sdk 15.3

I ported a project from 2017 and now I'm ready to compile all without any error,

but as soon as I am debugging 

the program runs into advertising_init() and ends up in an infinity loop

the ble_advdata_set() returns error code 10 what means that it's an invalid flag

so far I don't know what flags are allowed and were they where set in code

in Infocenter I found only this structble__advdata__t, but still not sure what flags I could set were I set flags

then it leafs the advertising_init() and reenters again. sd_ble_gap_adv_start() returns from now on 8

from now on the program try to ble_advertising_start() and sd_ble_gap_adv_start()  always return 8 and so on (in a loop)

Edit: 26.06.2020 

I dived deep in debbuging spheres and found some additional informations

down in the function I mentionet already is a call to 

sd_ble_gap_adv_data_set() this function gives me the error code 10 -> Invalid Flags

I extracted some defines from this function the hole definition is defined in ble_gap.h

the value witch is given to the function in *p_data has a flag field witch is 6

but 6 is not an invalid flag as you can see 

#define BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE   (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE | BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED)   /**< LE General Discoverable Mode, BR/EDR not supported. */

is in fact flag value 6: because 0x2 | 0x4 is 0x6 ... so far so bad, whats wrong now?  

Related