no or unkomplete ADV in hello_client

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I tried the connection between my hello_client-application and a smartphone,

but there is a strange problem:

The application is sending ADV with the default name of the device.

But if the device is running, there are no more ADVs received by my phone.

It seems like the ADVs are only sent while the create-function is called.

After it, there are no more ADVs.

After that, I tried to set the ADV-Data like I did on other devices (no hello_clients)

like this:

     // Fill GATT-DB
     // Device name
     memset(db_name.pdu, 0x00, (size_t)HELLO_CLIENT_NAME_LENGTH_U8);
     (void)snprintf(macString, sizeof(macString) ,"%02X%02X%02X%02X%02X%02X", macAddr[5], macAddr[4], macAddr[3], macAddr[2], macAddr[1], macAddr[0]);
     (void)snprintf((char *)db_name.pdu, (size_t)HELLO_CLIENT_NAME_LENGTH_U8,"%s_%s", HELLO_CLIENT_DEVICE_NAME, macString);
     db_name.len = HELLO_CLIENT_NAME_LENGTH_U8;
     /*@-compdef@*/
     (void)bleprofile_WriteHandle(0x0016, &db_name);
     /*@=compdef@*/

     // advertise first vendor specific service
     if (sizeof(hello_client_uuid_main_service) == 16) {
          // total length should be less than 31 bytes
          BLE_ADV_FIELD adv[3];
          BLE_ADV_FIELD scr[1];

          /*@-usedef@*/
          // flags
          adv[0].len     = 1 + 1;
          adv[0].val     = ADV_FLAGS;
          adv[0].data[0] = (UINT8)(LE_LIMITED_DISCOVERABLE | BR_EDR_NOT_SUPPORTED);

          adv[1].len     = 16 + 1;
          adv[1].val     = ADV_SERVICE_UUID128_COMP;
          memcpy(adv[1].data, &hello_client_uuid_main_service[0], 16);

          // Tx power level
          adv[2].len     = TX_POWER_LEN+1;
          adv[2].val     = ADV_TX_POWER_LEVEL;
          adv[2].data[0] = bleprofile_p_cfg->tx_power_level;

          // name
          scr[0].len      = HELLO_CLIENT_NAME_LENGTH_U8 + 1;
          scr[0].val      = ADV_LOCAL_NAME_COMP;
          memcpy(scr[0].data, (char *)db_name.pdu, (size_t)(scr[0].len - 1));
          /*@=usedef@*/

          bleprofile_GenerateADVData(adv, 3);
          bleprofile_GenerateScanRspData(scr, 1);
     }

With that changes, ADV will be sent all the time, but there is no name visible.

WICED Smart Explerer is showning the MAC-Address and in the lower line "Device name not available"

nRF Master Control Panel is showing as name "n/a" and also the MAC-Address.

Also the device-name is still visible while starting. After the application is running, the name is lost.

My application is scanning and advertising at the same time, but even if i stop scanning, this won't change anything.

Is there something else called after the create-function?

Is there something else interferring to the ADV-Data?

I'm using the 920736S (the module)

with SDK 2.2.1 on Ubuntu.

0 Likes
13 Replies