完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我的问题是BLE设备没有看到断开连接。
使用USB HID键盘演示,并进行了一些修改。没有可睡,和主回路采用cysyspmsleep()是醒来的1ms硬件中断与定时器。因此,cyble_processevents()称至少每女士BLE版本电流:3.52 脚本: connectuse电池servicebackout Android应用程序到手机说“装置断开” 期望:BLE堆栈应该表明cyble_evt_gap_device_disconnected或cyble_evt_timeout,取决于它是否听到断开消息。连接状态应该改变,应该回到广告。 汽车来了:没有事件发生和堆栈继续说cyble_getstate() = = cyble_state_connected永远真实。 我做错什么了?谢谢。 日志输出 可升级堆栈HID键盘 版本:1.20 编译日期和时间:7月6日2018:10:15:29 蓝牙上,启动广告与ADDR:00 A05000 615 CyLype Evtl广告,状态:3 CyLay-EvtgGaTaCieldTnId: 0, 4 CyLay-EvtgGAPI DEVICESIX连接 CyLeLeVeTnCalnopyUpDATEAY完成:0 CyLype EvtTuthAutha失败:6 CyBeLyEvtggssxxCNHggMtuuReq,最终MTU=23 CyLeLeVeTnCalnopyUpDATEAY完成:0 cyble_evt_connection_update_complete:0 CyBeLeVeT.GATTHI隔离连接器 cyble_evt_gap_device_disconnected cyble_evt_advertising,状态:3 cyble_evt_gatt_connect_ind:0, 4 CyLay-EvtgGAPI DEVICESIX连接 simulbatterylevelupdate:2 cyble_evt_connection_update_complete:0 cyble_evt_gatts_xcnhg_mtu_req,最终MTU = 23 cyble_evt_connection_update_complete:0 simulbatterylevelupdate:2 其他事件:57 其他事件:33 cyble_evt_auth_req:安全= 3键= 1,ekeysize = 10错误=0 cyble_evt_connection_update_complete:0 cyble_evt_gap_encrypt_change:1 cyble_evt_gap_keyinfo_exchnge_cmplt auth_complete:安全:1、结合:1,10,0 ekeysize:autherr 其他事件:FA cyble_evt_connection_update_complete:0 其他事件:104 cyble_evt_connection_update_complete:0 其他事件:57 / /手动读取 cyble_evt_connection_update_complete:0 simulbatterylevelupdate:2 simulbatterylevelupdate:2 cyble_evt_connection_update_complete:手机断开0 / /只指示 cyble_evt_connection_update_complete:0 simulbatterylevelupdate:2 / /不应该发生,不再连接。 simulbatterylevelupdate:2 simulbatterylevelupdate:2 simulbatterylevelupdate:2 以上来自于百度翻译 以下为原文 My issue is that the BLE device does not see a disconnect. Using the USB HID Keyboard Demo, with some modifications. There is no BLE sleeping, and the main loop is using CySysPmSleep() which is woke by a 1mS hardware interrupt from a timer. Therefore, CyBle_ProcessEvents() is called at least every ms. BLE version is current: 3.52 Scenario:
Expectation: BLE Stack should indicate CYBLE_EVT_GAP_DEVICE_DISCONNECTED or CYBLE_EVT_TIMEOUT, depending on whether it heard the disconnect message. The connection state should change and it should go back to advertising. Auto come: Neither event happens and stack continues to say CyBle_GetState() == CYBLE_STATE_CONNECTED is true forever. What am I doing wrong? Thanks. Log Output > BLE Upgradable Stack HID Keyboard > Version: 1.20 > Compile Date and Time: Jul 6 2018 10:15:29 Bluetooth On, StartAdvertisement with addr: 00a050000615 CYBLE_EVT_ADVERTISING, state: 3 CYBLE_EVT_GATT_CONNECT_IND: 0, 4 CYBLE_EVT_GAP_DEVICE_CONNECTED CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 CYBLE_EVT_AUTH_FAILED: 6 CYBLE_EVT_GATTS_XCNHG_MTU_REQ, final mtu= 23 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 CYBLE_EVT_GATT_DISCONNECT_IND CYBLE_EVT_GAP_DEVICE_DISCONNECTED CYBLE_EVT_ADVERTISING, state: 3 CYBLE_EVT_GATT_CONNECT_IND: 0, 4 CYBLE_EVT_GAP_DEVICE_CONNECTED SimulBatteryLevelUpdate: 2 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 CYBLE_EVT_GATTS_XCNHG_MTU_REQ, final mtu= 23 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 SimulBatteryLevelUpdate: 2 OTHER event: 57 OTHER event: 33 CYBLE_EVT_AUTH_REQ: security=3, bonding=1, ekeySize=10, err=0 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 CYBLE_EVT_GAP_ENCRYPT_CHANGE: 1 CYBLE_EVT_GAP_KEYINFO_EXCHNGE_CMPLT AUTH_COMPLETE: security:1, bonding:1, ekeySize:10, authErr 0 OTHER event: fa CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 OTHER event: 104 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 OTHER event: 57 //Manual Read CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 SimulBatteryLevelUpdate: 2 SimulBatteryLevelUpdate: 2 CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 // Only indication of phone disconnecting CYBLE_EVT_CONNECTION_UPDATE_COMPLETE: 0 SimulBatteryLevelUpdate: 2 // Should never happen - no longer connected. SimulBatteryLevelUpdate: 2 SimulBatteryLevelUpdate: 2 SimulBatteryLevelUpdate: 2 |
|
相关推荐
6个回答
|
|
你好,迈克,
你能把你的设计寄给我吗?如果需要,我们可以看到问题并修改这些变化。 谢谢, 心理医生。 以上来自于百度翻译 以下为原文 Hello Mike, Can you please send your design. We can see the issue and modify the changes if needed. Thanks, PSYU. |
|
|
|
你好,MikeMitchell,
你用的是哪种手机? 有些手机的BLE硬件存在问题,即使在关闭应用程序并保持BLE连接保持在后台时,它们也不会发送断开请求。 你可以尝试一些其他的手机和cysmart BLE USB适配器与cysmart Windows PC工具吗? -吉安 以上来自于百度翻译 以下为原文 Hello MikeMitchell , Which Mobile Phone are you using? There is issue with some mobile phone's BLE hardware and they do not send a Disconnect Request even after closing the APP and keeps BLE connection maintained in background. Could you try with some other Mobile phones and CySmart BLE USB Dongle with CySmart Windows PC tool? -Gyan |
|
|
|
yu1004402274 发表于 2018-8-30 09:37 这里是这个问题的演示。注意问题仅仅是确认11的Nexus 6与Android 7 该我试了像素1 XL和似乎没有问题。 因此,我们或许可以缩小问题不断开连接超时后。我在调整主回路的目标是保持稳定的工作,但从不去睡觉或浪费了太多的努力,因为我的设计可不是主要特征。从数据表,我的理解是,只要我叫processevents比这7ms最小连接时间更快,BLE应该罚款。如果不是这样的话,请澄清。 谢谢。 DISCONDEM DEMOO.CYPRJ.CaseV01.ZIP 1.7兆字节 以上来自于百度翻译 以下为原文 psyu here is a demo of the issue. Note the issue is only confirmed on a a Nexus 6 with Android 7.0 gyan I tried a Pixel 1 XL and it does not seem to have the problem. Therefore, we can probably narrow the issue to not disconnecting after a connection timeout. My goal in restructuring the main loop is to keep the BLE working, but never goto sleep or waste too much effort on it, since for my design BLE is not the primary feature. My understanding from the data sheet is as long as I call ProcessEvents faster than the connection interval which is 7ms minimum, BLE should be fine. If that is not the case please clarify. Thanks.
|
|
|
|
Ernest1 发表于 2018-8-30 10:03 你好,迈克, 连接管理超时参数,定义了两个接收数据包的PDU之间的最大时间 连接被认为是丢失的。这是一个链路层的定时器应用程序没有任何控制权。如果设备没有收到一包一时间等于连接监督超时值,链接将失去联系。 这里的问题是一些手机,即使你断开或杀死的应用程序,手机硬件将保持与同伴的BLE设备的连接,因此手机没有发送一个断开连接的要求和监督超时发生。 是的,你是对的。我们应该叫cyble_processevents()至少一次连接间隔处理的事件。 -吉安 以上来自于百度翻译 以下为原文 Hello Mike, Connection supervision timeout is a parameter that defines the maximum time between two received Data Packet PDUs before the connection is considered lost. This is a link layer timer and application does not have any control over it. If the devices does not receive a BLE packet for a time equal to Connection supervision timeout value , the link will lost the connection. The issue here is some mobile phones , where even if you disconnect or kill the app ,the mobile hardware will maintain the connection with peer BLE device and hence the mobile neither sends a Disconnect request Nor Connection supervision timeout happens. Yes, you are right. We should call CyBle_ProcessEvents() at least once in a connection interval to process the BLE events. -Gyan |
|
|
|
YHYDZ 发表于 2018-8-30 10:13 Gyan 你是对的,使用嗅探器,我能够确认电话应用程序说设备断开了,但是电话继续保持连接打开,交换空的PDU。于是我在电话里把蓝牙关掉,手机上的BooP操作码实际上断开了蓝牙。有趣的是,它发送了两个终止操作码。 记住,只有在使用电池服务时才会发生这种情况。这表明电话栈试图保持两个逻辑连接,只断开其中一个。 两个问题: 1。这可能是CyScript应用程序中的一个错误,而不是Android系统没有在断开之前杀死它打开电池通知的通道吗? 2。不管怎样,假设这是一个开放的生态系统中的应用和手机无法修复,这将是一个电池造成的错误。设备不允许这样做。有一个强制断开装置,如果一段时间没有发生有用的活动方法?在CyPress API中如何做到这一点? 以上来自于百度翻译 以下为原文 Gyan, You are right, using a sniffer, I was able to confirm that the Phone App says the device is disconnected, but the phone continues to keep the connection open, exchanging empty PDUs. So then I turned bluetooth off in the phone, and that actually disconnected by BLE opcode from the phone. Interestingly, it sent two terminate opcodes. Remember, this happens only when you use the battery service. So this suggests that phone stack is trying to maintain two logical connections, and only disconnects one of them. Two Questions: 1. Is this potentially a bug in the Cysmart app rather than the Android OS not killing the channel it opened to get the battery notifications before disconnecting? 2. Regardless, assume this is an open eco-system application and the phone cannot be fixed, this would be a battery killing bug. The device should not allow that. Is there a workaround for forcing a disconnection from the device if no useful activity has occurred for some time? How might that be done in the Cypress API? |
|
|
|
Ernest1 发表于 2018-8-30 10:21 你好,迈克, 1)这不是CysApp应用程序的问题。APP在关闭应用程序时向手机BLE栈发送断开连接请求,但BLE Stand不处理这个请求。这个问题与其他BLE手机应用同样存在,而不仅仅是CyStApp。 2)是的,当没有有用的BLE活动时,你可以调用CyBeY-GAPDISCONTION()API来断开手机。 -吉安 以上来自于百度翻译 以下为原文 Hello Mike, 1) This is not CySmart App issue. App is sending disconnect request to the Phone BLE stack on closing the App but BLE stack is not processing this request. The issue persists with other BLE Mobile Apps as well and not only with CySmart App. 2) Yes , you can call CyBe_GapDisconnect() API to disconnect from the Mobile Phone when there are no useful BLE activities. -Gyan |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2100 浏览 1 评论
1846 浏览 1 评论
3665 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1782 浏览 6 评论
1532 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
560浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
412浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
433浏览 2评论
379浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
905浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-19 23:23 , Processed in 1.307417 second(s), Total 86, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号