4 posts / 0 new
Last post
sentimental
Offline
Last seen:2年11个月前
加入:2016-11-28 15:55
最大连接间隔

Hello,
I'm using PRO board and SDK 5.0.4. I'd like to set a large connection interval to reduce power consumption. Based on ble_peripheral project, I change parameters in user _config.h. When I change the interval to around 300ms, it works and I can see the waveform using powerprofiler. However, when I set the connection interval further to around 3.6~4.0s which is the limit according to BLE specification, the actual interval is still 30ms. This is my user.config.h: (I didn't change other places)

/ *
****************************************************************************************
*
* GAPM configuration
*
****************************************************************************************
*/
static const struct gapm_configuration user_gapm_conf = {
/// Device Role: Central, Peripheral, Observer or Broadcaster
.role = GAP_PERIPHERAL_SLV,

/// Device IRK used for resolvable random BD address generation (LSB first)
.irk = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

/// Device Appearance (0x0000 - Unknown appearance)
//根据填写https://developer.bluetooth.org/gatt/characteristics/Pages/Characteristi...
.appearance = 0,

/// Device Appearance write permission requirements for peer device (@see gapm_write_att_perm)
.appearance_write_perm = GAPM_WRITE_DISABLE,

/// Device Name write permission requirements for peer device (@see gapm_write_att_perm)
.name_write_perm = GAPM_WRITE_DISABLE,

/// maximal mtu.
.max_mtu = 23,

///预期的连接间隔Shoud为3.5s
/// Peripheral only: *****************************************************************
/// Slave preferred Minimum of connection interval measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.con_intv_min = MS_TO_DOUBLESLOTS(3200),

/// Slave preferred Maximum of connection interval measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.con_intv_max = ms_to_doubleslots(3800),

/// Slave preferred Connection latency. It is measured in connection events skipped
.con_latency = 0,

/// Slave preferred Link supervision timeout measured in timer units (10 ms)
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.superv_to = MS_TO_TIMERUNITS(8000),

///隐私设置位字段(0b1 =启用,0b0 =禁用)
/// - [位0]:隐私支持
/// - [bit 1]: Multiple Bond Support (Peripheral only); If enabled, privacy flag is
/// read only.
/// - [位2]:重新连接地址可见。
.flags = 0
};

/ *
****************************************************************************************
*
*参数更新配置
*
****************************************************************************************
*/
static const struct connection_param_configuration user_connection_param_conf = {
///预期的连接间隔Shoud为3.5s
/// Connection interval minimum measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.intv_min = MS_TO_DOUBLESLOTS(3200),

/// Connection interval maximum measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.intv_max = MS_TO_DOUBLESLOTS(3800),

/// Latency measured in connection events
.latency = 0,

/// Supervision timeout measured in timer units (10 ms)
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
.time_out = MS_TO_TIMERUNITS(5000),

/// Minimum Connection Event Duration measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.ce_len_min = MS_TO_DOUBLESLOTS(0),

/// Maximum Connection Event Duration measured in ble double slots (1.25ms)
///使用宏观MS_TO_DOUBLESLOTS从毫秒(MS)转换为双插槽
.ce_len_max = MS_TO_DOUBLESLOTS(0),
};

My question is 1) What is the longest allowed connection interval of Dialog chip? (4s?) and 2) Do I need to change other parameters to set a longer interval, say, 3.8s? Thanks!

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Sentimental,

Hi Sentimental,

Like the BLE specification mentions 4.0 seconds is the maximum time that can set the connection interval, and all you have to do is to change the user_connection_param_conf structure in the user_config.h file. A few comments on these, the connection interval are set by the master of the connection and not by the slave, thus your phone will decide for the initial connection intervals and not the 580 device that acts as slave. The slave device cannot set the connection interval, it can only indicate to the master for the connection interval that it would like, and that is done with a parameter update request, so after about 10 seconds the ble_app_peripheral example will issue that command and if the master accepts the parameters indicated by the slave the connection intervals will switch to the prefered values of the slave. Also when you do that make sure that the watchdog is undefined or you are operating under sleep mode, if you do this using active mode and with the watchdog define, after the parameter update the device will end up to the NMI_Handler due to spending over 2.6 seconds to the WFI() instruction.

Thanks MT_dialog

sentimental
Offline
Last seen:2年11个月前
加入:2016-11-28 15:55
I found the issue is probably

I found the issue is probably related to PunchThrough application. When I use my custom Android application, I can change the connection interval to up to 4s.

sentimental
Offline
Last seen:2年11个月前
加入:2016-11-28 15:55
Thanks MT, I will check the

谢谢MT,我将检查Android侧的代码。