app_advertise_stop_op() returns GAP_ERR_ADV_DATA_INVALID

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
3 posts / 0 new
Last post
Sebastian Edman
Offline
Last seen:3 years 4 months ago
Joined:2017-05-29 12:02
app_advertise_stop_op() returns GAP_ERR_ADV_DATA_INVALID

Hi,

we try to send two advertisements directly after eachother since we need to transmit more data than can fit in one advertisement. We do it the following way.

1. trigger by an external interrupt, collects data.
2. when finished, a message is transmitted using app_advertise_start_msg_send();
3. In the .app_on_ble_powered callback we start a timer 30ms.
4. Upon execution of timer we call app_advertise_stop_op();
5. We then get a .app_on_adv_nonconn_complete callback with status GAP_ERR_ADV_DATA_INVALID, why is this, what is invalid?

the transmit (no 2 above) looks like this:

struct gapm_start_advertise_cmd* cmd;
cmd = app_advertise_start_msg_create();
cmd->op.code = GAPM_ADV_NON_CONN;
cmd->op.addr_src = GAPM_PUBLIC_ADDR;
cmd->op.renew_dur = 0;
cmd->intv_min = LLM_ADV_INTERVAL_MIN_NONCON_DISC; //160
cmd - > intv_max = LLM_ADV_INTERVAL_MIN_NONCON_DISC;//160
cmd->channel_map = 1;
cmd->info.host.mode = GAP_BROADCASTER_MODE;
cmd->info.host.adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY;

//adv_msg = 0201041B00AC00023B120000F0000000F1000010F00100F00F1F10F1F1F11A (in hex)
memcpy(&cmd->info.host.adv_data[0], &adv_msg, sizeof(adv_msg));
cmd->info.host.adv_data_len = sizeof(adv_msg); //28

app_advertise_start_msg_send(cmd);

and the 4. just calls the function app_advertise_stop_op(); (no modifiactions to command).

What is invalid, the stop command, or the advertisement command?

Regards
Sebastian

Device:
STS_Dialog (not verified)
Hi sebastian,

Hi sebastian,

Sorry for the delay i need more information. please tell me :

1) What is the project that you use for your plan.

2)How do you realize that your device advertises? Using the below code the device advertises in non-connectable mode. I didn't really catch what do you mean with the question number 2. The function app_easy_gap_advertise_stop() it's in the timer's callback and stops the advertising, please use it.

3)What is the version of the SDK that you use ?

void user_app_adv_start(void)

{

// Schedule the next advertising data update

app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb);

struct gapm_start_advertise_cmd* cmd;

cmd = app_easy_gap_non_connectable_advertise_get_active();

// add manufacturer specific data dynamically

mnf_data_update();

app_add_ad_struct(cmd, &mnf_data, sizeof(struct mnf_specific_data_ad_structure));

// Set deep sleep during advertising

app_easy_gap_non_connectable_advertise_start();

}

to start a non connectable advertising

BR,

STS_Dialog.

Sebastian Edman
Offline
Last seen:3 years 4 months ago
Joined:2017-05-29 12:02
Hi STS_Dialog,

Hi STS_Dialog,

We found the problem in this, the problem was that we interpreted the debug output wrong. The debug output consisted of a number of pulses on an output pin. But since there was an offset of 0x40, we subtracted 0x39 in order to get one pulse for the first error message and so on. Maybe you have already seen our problem. However this made our debug pin bump 11 times which indicated GAP_ERR_ADV_DATA_INVALID, but it was in fact a GAP_ERR_CANCELED. So there was no error.

Regards
Sebastian