Direction Finding Connectionless Tx -> Set up advertising data

Hello everyone,

I have a problem with the direction_finding_connectionless_tx example. I´m working with VS Code and nRF Connect SDK 2.3.0 is installed.

The unmodified example runs just fine but now I want to implement it together with a sensor that gives out some values over SPI and then I want to send these values in the advertising data.

So I use this function to set the advertising data:

printk("set Advertising Data...");
	err = bt_le_ext_adv_set_data(adv_set, &adv_manuf_data, 1, NULL, 0);
	if (err) {
		printk("failed (err %d)\n", err);
		return;
	}
	printk("success\n");

With this advertising data:

static const uint8_t adv_data[] = { 'T', 'e', 's', 't', 'D', 'a', 't', 'a' };
static struct bt_data adv_manuf_data = {
	.type = BT_DATA_MANUFACTURER_DATA,
	.data_len = sizeof(adv_data),
	.data = adv_data,
};

But I get err -5 from the function.

Do I need another function to set advertising data? My understanding is that in the function sets data in the extended avertising channel.

Thanks in advance

J-R

Parents
  • Hello J-R, sorry about the delay.

    Could you change the 1 in:

    err = bt_le_ext_adv_set_data(adv_set, &adv_manuf_data, 1, NULL, 0);

    to ARRAY_SIZE(adv_manuf_data)?

    Regards,

    Elfving

  • Hello Elfving,

    i tried the change, but get the following error message:

    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:97:66: error: subscripted value is neither array nor pointer nor vector
       97 |                                               __typeof__(&(array)[0])))
          |                                                                  ^
    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:78:66: note: in definition of macro 'ZERO_OR_COMPILE_ERROR'
       78 | #define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1)
          |                                                                  ^~~~
    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:109:20: note: in expansion of macro 'IS_ARRAY'
      109 |         ((size_t) (IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
          |                    ^~~~~~~~
    c:\Users\j.ross\Desktop\nordic_sdk_projekt\direction_finding_connectionless_tx3\src\main.c:109:64: note: in expansion of macro 'ARRAY_SIZE'
      109 |         err = bt_le_ext_adv_set_data(adv_set, &adv_manuf_data, ARRAY_SIZE(adv_manuf_data), NULL, 0);
          |                                                                ^~~~~~~~~~
    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:109:69: error: subscripted value is neither array nor pointer nor vector
      109 |         ((size_t) (IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
          |                                                                     ^
    c:\Users\user\Desktop\nordic_sdk_projekt\direction_finding_connectionless_tx3\src\main.c:109:64: note: in expansion of macro 'ARRAY_SIZE'
      109 |         err = bt_le_ext_adv_set_data(adv_set, &adv_manuf_data, ARRAY_SIZE(adv_manuf_data), NULL, 0);
          |                                                                ^~~~~~~~~~

    In the meantime I tried the "bt_le_per_adv_set_data(adv_set, &adv_manuf_data, 1)" function with which I am able to build the program, but right now I cant confirm if it really works.

    What is the difference between these two functions?

Reply
  • Hello Elfving,

    i tried the change, but get the following error message:

    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:97:66: error: subscripted value is neither array nor pointer nor vector
       97 |                                               __typeof__(&(array)[0])))
          |                                                                  ^
    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:78:66: note: in definition of macro 'ZERO_OR_COMPILE_ERROR'
       78 | #define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1)
          |                                                                  ^~~~
    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:109:20: note: in expansion of macro 'IS_ARRAY'
      109 |         ((size_t) (IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
          |                    ^~~~~~~~
    c:\Users\j.ross\Desktop\nordic_sdk_projekt\direction_finding_connectionless_tx3\src\main.c:109:64: note: in expansion of macro 'ARRAY_SIZE'
      109 |         err = bt_le_ext_adv_set_data(adv_set, &adv_manuf_data, ARRAY_SIZE(adv_manuf_data), NULL, 0);
          |                                                                ^~~~~~~~~~
    C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:109:69: error: subscripted value is neither array nor pointer nor vector
      109 |         ((size_t) (IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
          |                                                                     ^
    c:\Users\user\Desktop\nordic_sdk_projekt\direction_finding_connectionless_tx3\src\main.c:109:64: note: in expansion of macro 'ARRAY_SIZE'
      109 |         err = bt_le_ext_adv_set_data(adv_set, &adv_manuf_data, ARRAY_SIZE(adv_manuf_data), NULL, 0);
          |                                                                ^~~~~~~~~~

    In the meantime I tried the "bt_le_per_adv_set_data(adv_set, &adv_manuf_data, 1)" function with which I am able to build the program, but right now I cant confirm if it really works.

    What is the difference between these two functions?

Children
No Data
Related