2 posts / 0 new
Last post
Aaron Li
Offline
Last seen:2 months 2 weeks ago
Joined:2016-09-12 14:20
DA14580广播间隔修改

我用的是DA14580, SDK5.0.3,ble_app_profile project。

1. 如果要修改广播间隔是否只需修改下面intv的值即可?是否还有广播间隔的最大值和最小值需要调整?如果有的话在哪里修改?

2. 有时用lightblue连接时会失败,提示interrogating timeout。请问如何进一步改进呢?

static const struct advertise_configuration user_undirected_advertise_conf ={
/// Advertise operation type.
.advertise_operation=ADV_UNDIRECT,
/// Own BD address source of the device:
.address_src=GAPM_PUBLIC_ADDR,
/// Advertise interval
.intv = 160, // 100ms (160*0.625ms)
///Advertising channel map
.channel_map = 0x7,
};

谢谢支持!

Device:
CYibin
Offline
Last seen:6 months 4 weeks ago
Staff
Joined:2017-12-14 02:48
你好,

你好,

请看下面回答:

1. 如果要修改广播间隔是否只需修改下面intv的值即可?是否还有广播间隔的最大值和最小值需要调整?如果有的话在哪里修改?

建议以 SDK5.0.4 作为基础进行开发,广播相关的参数修改(包括 intv_min 和 intv_max ),只需在以下结构体中修改即可:

static const struct advertise_configuration user_adv_conf = { /// Own BD address source of the device: /// - GAPM_PUBLIC_ADDR: Public Address /// - GAPM_PROVIDED_RND_ADDR: Provided random address /// - GAPM_GEN_STATIC_RND_ADDR: Generated static random address /// - GAPM_GEN_RSLV_ADDR: Generated resolvable private random address /// - GAPM_GEN_NON_RSLV_ADDR: Generated non-resolvable private random address /// - GAPM_PROVIDED_RECON_ADDR: Provided Reconnection address (only for GAPM_ADV_DIRECT) .addr_src = GAPM_PUBLIC_ADDR, /// Duration of resolvable address before regenerate it. .renew_dur = 0, /// Minimum interval for advertising .intv_min = 160, // 100ms (160*0.625ms) /// Maximum interval for advertising .intv_max = 160, // 100ms (160*0.625ms) /// Advertising channel map .channel_map = 0x7, /************************* * Advertising information ************************* */ /// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT) /// Advertising mode : /// - GAP_NON_DISCOVERABLE: Non discoverable mode /// - GAP_GEN_DISCOVERABLE: General discoverable mode /// - GAP_LIM_DISCOVERABLE: Limited discoverable mode /// - GAP_BROADCASTER_MODE: Broadcaster mode .mode = GAP_GEN_DISCOVERABLE, /// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT) /// Advertising filter policy: /// - ADV_ALLOW_SCAN_ANY_CON_ANY: Allow both scan and connection requests from anyone /// - ADV_ALLOW_SCAN_WLST_CON_ANY: Allow both scan req from White List devices only and /// connection req from anyone /// - ADV_ALLOW_SCAN_ANY_CON_WLST: Allow both scan req from anyone and connection req /// from White List devices only /// - ADV_ALLOW_SCAN_WLST_CON_WLST: Allow scan and connection requests from White List /// devices only .adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY, /// Direct address information (GAPM_ADV_DIRECT) /// (used only if reconnection address isn't set or privacy disabled) /// BD Address of device .peer_addr = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6}, /// Direct address information (GAPM_ADV_DIRECT) /// (used only if reconnection address isn't set or privacy disabled) /// Address type of the device 0=public/1=private random .peer_addr_type = 0, };

2. 有时用lightblue连接时会失败,提示interrogating timeout。请问如何进一步改进呢?

连接失败,需要你提供更多信息才能进一步分析,如测试的软、硬件环境,测试的步骤,问题发生的概率等。

关于和 iOS 设备的连接,APPLE 官网有一份指导文档,里面有一些 BLE connect parameters 的建议,文档如下:

https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf