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

Not able to connect in slow advertising mode

Hi,

I got an issue with a battery powered sensor with generic OOB NFC pairing. The NFC is used to pair the sensor with a gateway, but if the device is not connected it must advertise so it can reconnect after a disconnection. So far so good, the sensor reconnects as long as it is in fast advertising mode, but as soon as the sensor switches to slow advertising it doesn't accept or recognizes any connection attempts. The advertisement event handler (on_adv_evt) doesn't get an event when switching from fast to slow advertising as well.

void advertising_init(void)
{
	NRF_LOG_INFO("advertising init");
	ret_code_t err_code;
	ble_advertising_init_t init;

	memset(&init, 0, sizeof(init));

	// Only set up adv_data. Options will be set depending on if advertising will be enabled or not.
	m_advdata.name_type               = BLE_ADVDATA_FULL_NAME;
	m_advdata.include_appearance      = false;
	m_advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
	m_advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
	m_advdata.uuids_complete.p_uuids  = m_adv_uuids;

	init.advdata = m_advdata;
	init.evt_handler = on_adv_evt;

	advertising_config_get(&init.config);

	err_code = ble_advertising_init(&m_advertising, &init);
	APP_ERROR_CHECK(err_code);

	ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);

	err_code = app_timer_create(&m_slow_advertising_start, APP_TIMER_MODE_SINGLE_SHOT, on_slow_advertising);
	APP_ERROR_CHECK(err_code);
}

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(500, UNIT_1_25_MS)            /**< Minimum acceptable connection interval (1 second). */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(1000, UNIT_1_25_MS)            /**< Maximum acceptable connection interval (5 seconds). */
#define SLAVE_LATENCY                   0                                           /**< Slave latency. */
#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(4000, UNIT_10_MS)             /**< Connection supervisory timeout (4 seconds). */

#define APP_FAST_ADV_INTERVAL           500                                         /**< The fast advertising interval (in units of 0.625 ms). */
#define APP_FAST_ADV_DURATION           6000                                        /**< The fast advertising duration (180 seconds) in units of 10 milliseconds. */

#define APP_SLOW_ADV_INTERVAL           16380										/**< The slow advertising interval (in units of 0.625 ms) max 10,24s. */

I used the NFC pairing template, with SDK nrf5_sdk_15.3.0_59ac345 and Softdevice s132_nrf52_6.1.1

best,

Bernhard

Parents Reply Children
Related