蓝牙通过过程中异常断开后,能发现蓝牙信号,但是无法再继续连接了。

5 posts / 0 new
Last post
intretech_XM
Offline
Last seen:2 days 21 hours ago
加入:2016-02-26 23:11
蓝牙通过过程中异常断开后,能发现蓝牙信号,但是无法再继续连接了。

嗨对话框:

我使用DA的ble dongle与DA14580通信的时候,在数据通信过程中发现蓝牙会断开,这时候能发现蓝牙信号,但是无法再与da14580连接了,现象是一连马上就断开了。请问下 这是什么问题?

我使用第三方工具去连接也不行,如使用linght blue去连接,提示“”“timeout interrogating the peripheral”错误。

必须重启设备才能连接,我使用SDK版本是 3.0.6。

下面是我用cypress dongle抓的连接log,也是异常情况下,无法连接的log。

[16:53:36:525] : 'Resolve and Set Peer Device BD Address' request sent
[16:53:36:525]: Typ BD地址e: PUBLIC_ADDRESS
[16:53:36:525] : BD Address: 02:0F:00:03:04:17:00:00
[16:53:36:552] : 'Command Status' event received
[16:53:36:552] : Status: BLE_STATUS_OK
[16:53:36:552] : 'Resolve and Set Peer Device BD Address Response' event received
[16:53:36:552] : Status: 0x01
[16:53:36:552] : 'Command Complete' event received
[16:53:36:552] : Status: BLE_STATUS_OK
[16:53:36:552] : 'Establish Connection' request sent
[16:53:36:552] : BD Address Type: PUBLIC_ADDRESS
[16:53:36:552] : BD Address: 02:0F:00:03:04:17:00:00
[16:53:36:557] : 'Command Status' event received
[16:53:36:557] : Status: BLE_STATUS_OK
[16:53:36:844] : 'Establish Connection Response' event received
[16:53:37:148] : 'Current Connection Parameters' event received
[16:53:37:148] : HCI Status: 0x00
[16:53:37:148] : Connection Interval: 8.75 ms
[16:53:37:148] : Slave Latency: 0
[16:53:37:148] : Supervision Timeout: 100 ms
[16:53:37:149] : 'Command Complete' event received
[16:53:37:149] : Status: BLE_STATUS_OK
[16:53:37:149] : 'Connection Terminated Notification' event received
[16:53:37:149] : Reason: CONNECTION_FAILED_TO_BE_ESTABLISHED
[16:53:37:149] : 'Get local device security keys' request sent
[16:53:37:202] : 'Command Status' event received
[16:53:37:202] : Status: BLE_STATUS_OK
[16:53:37:202] : 'Get local device security keys response' event received
[16:53:37:202] : Key flags: INITIATOR_ENCRYPTION_INFORMATION, INITIATOR_IDENTITY_INFORMATION, INITIATOR_SIGNATURE_KEY, RESPONDER_ENCRYPTION_INFORMATION, RESPONDER_IDENTITY_INFORMATION, RESPONDER_SIGNATURE_KEY
[16:53:37:202] : Long Term Key (LTK): [D6:93:E8:A4:23:55:48:99:1D:77:61:E6:63:2B:10:8E]
[16:53:37:202] : Encrypted Diversifier (EDIV) and Random Number: [99:1F:26:1E:F6:09:97:2E:AD:7E]
[16:53:37:202] : Identity Resolving Key (IRK): [0A:2D:F4:65:E3:BD:7B:49:1E:B4:C0:95:95:13:46:73]
[16:53:37:202] : Identification Address: [0x00A0500A0D27, PUBLIC_ADDRESS]
[16:53:37:202] : Connection Signature Resolving Key (CSRK): [90:D5:06:95:92:ED:91:D7:A8:9E:2C:DC:4A:93:5B:F9]
[16:53:37:203] : 'Command Complete' event received
[16:53:37:203] : Status: BLE_STATUS_OK

Device:
Qinjiny_Dialog
Offline
Last seen:1 day 21 hours ago
Staff
加入:2016-11-01 05:47
SDK3.0.6版本过旧了,BLE

SDK3.0.6版本过旧了,BLE Stack存在一些已知的问题会导致你所见的情况发生, 我们这边建议您把工程建立在比较新的SDK上(5.0.2或以上)

这边提供一个基于3.0.6的小补丁,你可以尝试一下是否能改善情况。

请按以下内容修改至dk_apps/src/ip/ble/ll/src/rwble/rwble.c

@@ -614,6 +617,16 @@ void $Sub$$BLE_EVENT_Handler(void)

lld_evt_end_isr();

+ // Do a SW reset
+ // Reset the BLE state machines
+ ble_master_soft_rst_setf(1);
+ while(ble_master_soft_rst_getf());
+ //If an encryption was on going restart it
+ if( ble_aes_start_getf())
+ {
+ ble_aescntl_set(BLE_AES_START_BIT);
+ }
+
rwble_last_event = BLE_EVT_END;
}
}

@@ -986,6 +999,16 @@ void $Sub$$BLE_EVENT_Handler(void)

#endif // METRICS
lld_evt_end_isr();

+ // Do a SW reset
+ // Reset the BLE state machines
+ ble_master_soft_rst_setf(1);
+ while(ble_master_soft_rst_getf());
+ //If an encryption was on going restart it
+ if( ble_aes_start_getf())
+ {
+ ble_aescntl_set(BLE_AES_START_BIT);
+ }
+
rwble_last_event = BLE_EVT_END;
}
}

intretech_XM
Offline
Last seen:2 days 21 hours ago
加入:2016-02-26 23:11
hi Qinjiny_Dialog:

hi Qinjiny_Dialog:

谢谢你的回答,我将尽快添加你给的补丁,测试下,并将结果返回给你。

还有在SDK 5.0.2里面有两个void $Sub$$BLE_EVENT_Handler(void) 函数,和你的这个补丁一样,但是3.0.6里面只有一个,是否只需要改这个?

Qinjiny_Dialog
Offline
Last seen:1 day 21 hours ago
Staff
加入:2016-11-01 05:47
这个只是针对已知常见问题的fix

这个只是针对已知常见问题的fix,更新的SDK里还有其他改动,可以的话还是switch过去比较好

intretech_XM
Offline
Last seen:2 days 21 hours ago
加入:2016-02-26 23:11
hi Qinjiny_Dialog:

hi Qinjiny_Dialog:

好的,非常感谢!目前添加了这个补丁,经过测试,应该是有解决了目前的问题。我将在后面移植到最新的SDK上面。