This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2 HID profile自动重链接后操作失败

Other Parts Discussed in Thread: CC2640, CC2640R2F

1,CC2640R2 HID profile应用,主机上电主动配对链接BLE, 然后BLE按键,主机能解析到BLE按键操作,功能完全正常。

2, BLE 主动调用API(HidDev_Close() )中断链接,BLE进入sleep

3,  BLE 按键唤醒并再次自动配对链接主机, 然后BLE按键,主机不能解析BLE的按键操作,为什么?跟什么配置或时序有关了?

  • 请问是hid_emu_kbd这个demo吗?
  • 是的,simplelink_cc2640r2_sdk_ble_example_pack_1_50_00_62版本里的demo, SDK是simplelink_cc2640r2_sdk_1_50_00_58版本
  • Viki 能给我一些建议或方向吗?
  • 跟同事讨论了一下,仅提供的这些信息无法判断。是否能提供抓包数据,看一下唤醒后的BLE数据是否正常传递
  • ble_diff.zip多谢Viki, 搭建好抓包工具,抓包发现跟客户提供demo机,有2处差异(看附近文本),demo多发了GAP_SlaveRequestedSecurity事件包和安全链接数据全部为0,但不知道怎么修改跟客户demo样机一样,能提供修改方法?

  • Viki, 现发现可以跟(BLE_V42_FEATURES & PRIVACY_1_2_CFG)配置有关,目前PRIVACY_1_2_CFG配置默认是1,我打算配置为0, 但是在build_config.opt 添加-DV42_FEATURES=EXT_DATA_LEN_CFG+SECURE_CONNS_CFG设置,似乎无作用, PRIVACY_1_2_CFG还是配置为1,
    你能告诉我如何修改PRIVACY_1_2_CFG配置为无效,谢谢

    build_config.opt as follows:
    /* BLE v4.2 Features */
    -DV42_FEATURES=EXT_DATA_LEN_CFG+SECURE_CONNS_CFG
    /* Note: For advanced users who choose to explicitly build their BLE */
    /* Stack without ROM the following upper limit on RAM usage must be */
    /* observed when using the Secure Connections Feature: */
    /* R1: 0x20004F2C */
    /* R2: 0x20004F80 */
    /* When using linker command files provided by this SDK, the linker */
    /* symbol ENCRYPTION_ROM=1 or ENCRYPTION_ROM=2 may be defined to set */
    /* this upper limit for R1 and R2 devices, respectively. */

    List file as follows:
    // If using Privacy 1.2 then controller will have all IRK values stored
    N // in the bond records and will try to resolve every incoming RPA. Meaning
    N // if the host is given an RPA it will not be able to resolve it. Thus,
    N // resolving an address at the host level is only possible if Privacy 1.2
    N // is not enabled
    N#if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
    X#if !1L || !(V42_FEATURES+0x01+0x04+0x02 & 0x01)
    S else if ( randomSubType == RANDOM_ADDR_SUBTYPE_RPA )
  • 你要disable  PRIVACY_1_2_CFG吗:

       BLE_V42_FEATURES        Configure the stack to use features from the BLE 4.2 Specification
                                The following BLE 4.2 features are enabled by default and cannot
                                be disabled.
            EXT_DATA_LEN_CFG    - Enable the Extended Data Length Feature in the Controller
            SECURE_CONNS_CFG    - Enable Secure Connections Pairing Procedure
            PRIVACY_1_2_CFG     - Enable Enhanced Privacy

  • 是的, 如何disable PRIVACY_1_2_CFG 配置
  • Viki,因为我们发现再链接不工作的特定设备配对时用ADDRTYPE_RANDOM , RANDOM_ADDR_SUBTYPE_RPA类型配对,最后它没有绑定配对信息,我猜测再链接不工作可能跟这个有关,因为下面开关disable触发绑定的命令,你觉得对吗?



    // If using Privacy 1.2 then controller will have all IRK values stored
    // in the bond records and will try to resolve every incoming RPA. Meaning
    // if the host is given an RPA it will not be able to resolve it. Thus,
    // resolving an address at the host level is only possible if Privacy 1.2
    // is not enabled
    #if !defined (BLE_V42_FEATURES) || !(BLE_V42_FEATURES & PRIVACY_1_2_CFG)
    else if ( randomSubType == RANDOM_ADDR_SUBTYPE_RPA )
    {

    // Board_setLeds( Board_LED_MODE_TOGGLE, 1<<Board_TEST_PIN1, 0, 0 );


    idx = gapBondMgrResolvePrivateAddr( pDevAddr );
    if ( (idx < GAP_BONDINGS_MAX) && (pResolvedAddr) )
    {
    VOID gapBondMgrGetPublicAddr( idx, pResolvedAddr );
    }
    }
    #endif // ! BLE_V42_FEATURES | ! PRIVACY_1_2_CFG
  • CC2640R2F的例程里说明了不能disable。CC2640是可以的
  • 如果这样,那GAPBondMgr_ResolveAddr函数总是返回GAP_BONDINGS_MAX,导致GAPBondMgr_LinkEst函数不能触发gapBondMgrBondReq函数请求,那怎么修改才能绑定这个配对信息了?
  • Viki, 附件是host上电成功配对链接,peripheral按键操作正常,然后peripheral断链再成功链接, peripheral 按键操作,host 解析不到按键,整个流程的sniff数据包,

    peripheral MAC: 0x0C61CFA4E82A,看能否看出错误信息出来,多谢!2timesloop_sniffer_package.zip