I tried to use this example with a nRF51422 and the board of N5 Starter Kit of Dynastream. I adjust all to make it works fine: custom_board and so on.. And I used the Soft Device s130 'cause the program has to work as central and peripheral at the same time.
I cloned the example and I noticed that there was an error in the function static void advdata_update(void)
.
The lines:
advdata.flags.size = sizeof(flags);
advdata.flags.p_data = &flags;
gave me an error, I tried to find out it and I see that the file ble_advdata.h
define the field flags
ad uint8_t
. In the SDK nRF51 6.0.0 (you suggest the 5.1.0 in for the example, but the 6.0.0 works fine too) the field flags
is a uint8_array_t
.
I noticed that the only difference in the file is this definition, no version or any other char is different...
I solved changing the code as shown below:
// advdata.flags.size = sizeof(flags);
// advdata.flags.p_data = &flags;
advdata.flags = flags;
and seems that all works fine. I did the right thing? Why did you change the definition of that field? Could it be because the size of flags has to be fixed and maybe wasn't before?
Thanks.
Regards Luca