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

How to build a beacon advertising in 20ms interval

I wanna to make an iBeacon device based on ble_app_beacon example.

I found in the example the default advertising mode is BLE_GAP_ADV_TYPE_ADV_NONCONN_IND, where its advertising interval must be more than 100ms.

I tried to use BLE_GAP_ADV_TYPE_ADV_IND. Even if the advertising interval time can be low as 20ms, some mobile phones like Oneplus or Huawei stop discovering signal after the first time having discovered it.

For example, when I use Nordic Master Control Panel, mobile phone can find beacon in BLE_GAP_ADV_TYPE_ADV_NONCONN_IND mode and shows the interval properly. When I change the mode to BLE_GAP_ADV_TYPE_ADV_IND, after appearing in the app once time , it never shows the interval time and the rssi never changes. I also tried some other BLE discovering app, the results are same.

So if I want to build a ibeacon device with 20ms interval time, what should I do? thx

Here is my parameter giving to adv_start

#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(20, UNIT_0_625_MS)
#define APP_CFG_NON_CONN_ADV_TIMEOUT    0
memset(&m_adv_params, 0, sizeof(m_adv_params));

m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
m_adv_params.p_peer_addr = NULL;                             // Undirected advertisement.
m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval    = NON_CONNECTABLE_ADV_INTERVAL;
m_adv_params.timeout     = APP_CFG_NON_CONN_ADV_TIMEOUT;
err_code = sd_ble_gap_adv_start(&m_adv_params);
Parents
  • As it says in the information when you press continuous scanning:

    Some devices, f.e. Nexus 4 or Nexus 7, notifies about connectable peripherals (where SCAN REQUEST and SCAN RESPONSE) are used) only once per scan. With continuous mode disabled the scanner will stop and start scanning again every 2 seconds to get RSSI values from those devices. Please note that it is not possible to estimate the advertising interval in such case.

    So you need an app that stops and starts scanning again more frequently than 2 seconds.

Reply
  • As it says in the information when you press continuous scanning:

    Some devices, f.e. Nexus 4 or Nexus 7, notifies about connectable peripherals (where SCAN REQUEST and SCAN RESPONSE) are used) only once per scan. With continuous mode disabled the scanner will stop and start scanning again every 2 seconds to get RSSI values from those devices. Please note that it is not possible to estimate the advertising interval in such case.

    So you need an app that stops and starts scanning again more frequently than 2 seconds.

Children
Related