I am using sdk15.2.0 with PCA10040 dev board.
In ble_app_eddystone example, the configured advertising interval and duration dont match the observed values.
I think I have found the reason why they dont match... Just want a confirmation from Nordic engineers weather I am correct or not.
Below code snippet is from es_app_config.h file
#define APP_CFG_NON_CONN_ADV_TIMEOUT 0 //!< Time for which the device must be advertising in non-connectable mode (in seconds). 0 disables the time-out. #define APP_CFG_NON_CONN_ADV_INTERVAL_MS 1000 //!< The advertising interval for non-connectable advertisement (in milliseconds). This value can vary between 100 ms and 10.24 s. #define APP_CFG_CONNECTABLE_ADV_TIMEOUT 6000 //!< Time for which the device must be advertising in connectable mode (in milliseconds). 0 disables the time-out. #define APP_CFG_CONNECTABLE_ADV_INTERVAL_MS 100 //!< The advertising interval for connectable advertisement (in milliseconds). This value can vary between 20 ms and 10.24 s.
As per the comment in the code, the values are in milli seconds.
In es_adv.c in get_adv_params() values from es_app_config.h are assigned to ble_gap_adv_params_t structure. Below code is from es_adv.c
/**@brief Given state of Eddystone beacon, get advertisement parameters. */ static void get_adv_params(ble_gap_adv_params_t * p_adv_params, bool non_connectable, bool remain_connectable) { // Initialize advertising parameters (used when starting advertising). memset(p_adv_params, 0, sizeof(ble_gap_adv_params_t)); // Non-connectable p_adv_params->properties.type = non_connectable ? BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED : BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED; p_adv_params->p_peer_addr = NULL; // Undirected advertisement. p_adv_params->filter_policy = BLE_GAP_ADV_FP_ANY; p_adv_params->interval = non_connectable ? m_adv_interval : APP_CFG_CONNECTABLE_ADV_INTERVAL_MS; p_adv_params->duration = non_connectable ? APP_CFG_NON_CONN_ADV_TIMEOUT : (remain_connectable ? 0 : APP_CFG_CONNECTABLE_ADV_TIMEOUT); p_adv_params->primary_phy = BLE_GAP_PHY_1MBPS; }
Now if you check ble_gap_adv_params_t structure definition in ble_gap.h, the interval and duration values are not in milli seconds(read the comments).
uint32_t interval; /**< Advertising interval in 625 us units. @sa BLE_GAP_ADV_INTERVALS.
@note If @ref ble_gap_adv_properties_t::type is set to
@ref BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED_HIGH_DUTY_CYCLE
advertising, this parameter is ignored. */
uint16_t duration; /**< Advertising duration in 10 ms units. When timeout is reached,
an event of type @ref BLE_GAP_EVT_ADV_SET_TERMINATED is raised.
@sa BLE_GAP_ADV_TIMEOUT_VALUES.
@note The SoftDevice will always complete at least one advertising
Milli second macros from es_config.h should have been converted to respective count before use. This is the reason why configured and observed values don't match up.
Please confirm my understanding...