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

Non-connectable Long Range advertisement

Hi,

We're using nRF52840 rev. A with s140_nrf52840_6.0.0-6.alpha SoftDevice and patched SDK 14.2.0. We've succesfully launched Long Range advertisements on one device and LR scanner on another. However we don't neeed the device to be connectable, so obviously we've tried setting .connectable = 0,. The problem is that function sd_ble_gap_adv_start returns NRF_ERROR_INTERNAL. Any idea why or (even better) how to launch this? Here's our code:

uint32_t bluetooth_advertisingInit(void)
{
	uint8_t custom_data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
	ble_advdata_manuf_data_t manuf_data =
	{
			.company_identifier = 0xFFFF,
			.data.size = 8,
			.data.p_data = custom_data,
	};
	ble_advdata_t adv_data;
	memset(&adv_data, 0, sizeof(adv_data));
	adv_data.name_type          = BLE_ADVDATA_NO_NAME;
	adv_data.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
	adv_data.include_appearance = false;
	adv_data.p_manuf_specific_data = &manuf_data;

    ret_code_t err_code = ble_advdata_set(&adv_data, NULL);
    APP_ERROR_CHECK(err_code);
    app_timer_create(&bluetooth_advertisementTimer,
                     APP_TIMER_MODE_SINGLE_SHOT,
                     bluetooth_advertisementTimerHandler);


#if defined(S140)
    // Set maximum output power for advertiser, scanner, and initiator.
    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, BLE_CONN_HANDLE_INVALID, 9);
    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, BLE_CONN_HANDLE_INVALID, 9);
#endif
    return err_code;
}

void bluetooth_advertisingStart(void)
{
    ble_gap_adv_params_t const adv_params =
    {
        .properties    =
        {
          .connectable = 0,
		  .scannable   = 0,
		  .directed    = 0,
		  .high_duty   = 0,
		  .legacy_pdu  = 0,
		  .anonymous   = 0,
        },
        .p_peer_addr   = NULL,
        .fp            = BLE_GAP_ADV_FP_ANY,
        .interval      = BLUETOOTH_ADVERTISEMENT_FAST_INTERVAL,
        .duration      = 0,
		.scan_req_notification = 0,
#if defined(S140)
        .primary_phy   = BLE_GAP_PHY_CODED,
        .secondary_phy = BLE_GAP_PHY_CODED,
#else
        .primary_phy   = BLE_GAP_PHY_1MBPS,
        .secondary_phy = BLE_GAP_PHY_1MBPS,
#endif
    };
    ret_code_t err_code = sd_ble_gap_adv_start(BLE_GAP_ADV_SET_HANDLE_DEFAULT, &adv_params, BLUETOOTH_CONNECTION_CONFIG_TAG);
    APP_ERROR_CHECK(err_code);
}
Parents
  • Hi We can now confirm that this is bug in newest alpha of softdevice. We've tried literally every combination of parameters with no success. In every case, when 'connectable' was set to 0, softdevice returned ERROR_INTERNAL.

    As for Long range we've achieved ~60m for advertisement packets, but antenna on advertising device wasn't fine tuned yet. However I don't see any way to reach 2km of which Nordic was so proud of on seminars.

Reply
  • Hi We can now confirm that this is bug in newest alpha of softdevice. We've tried literally every combination of parameters with no success. In every case, when 'connectable' was set to 0, softdevice returned ERROR_INTERNAL.

    As for Long range we've achieved ~60m for advertisement packets, but antenna on advertising device wasn't fine tuned yet. However I don't see any way to reach 2km of which Nordic was so proud of on seminars.

Children
No Data
Related