TI E2E™ 英文论坛海量技术问答的中文版全新上线,可点击相关论坛查看,或在站内搜索 “参考译文” 获取。

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.

CC2642R: 在cc2642上设置配对绑定功能并设置配对码,手机app上无法使用指定配对码完成配对绑定操作

Part Number: CC2642R

当前环境:

SDK:simplelink_cc13x2_26x2_sdk_4_10_00_78

芯片:cc2642

手机使用苹果,安卓均出现同样问题,使用芯片设置使用指定的配对码进行配对,手机输入配对码后无法配对成功。

配置如下:

/*********************************************************************
 * Bond Manager Configuration
 */

uint8_t pairMode                =    GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
uint8_t mitm                    =    true;
uint8_t ioCap                   =    GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8_t bonding                 =    true;
uint8_t secureConnection        =    GAPBOND_SECURE_CONNECTION_ALLOW;
uint8_t autoSyncWL              =    false;
uint8_t eccReGenPolicy          =    0;
uint8_t KeySize                 =    16;
uint8_t removeLRUBond           =    true;
uint8_t KeyDistList             =    GAPBOND_KEYDIST_MENCKEY | GAPBOND_KEYDIST_MIDKEY | GAPBOND_KEYDIST_MSIGN | GAPBOND_KEYDIST_SENCKEY | GAPBOND_KEYDIST_SIDKEY | GAPBOND_KEYDIST_SSIGN;
uint8_t eccDebugKeys            =    false;

void setBondManagerParameters()
{
    // Set Pairing Mode
    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    // Set MITM Protection
    GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    // Set IO Capabilities
    GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    // Set Bonding
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
    // Set Secure Connection Usage during Pairing
    GAPBondMgr_SetParameter(GAPBOND_SECURE_CONNECTION, sizeof(uint8_t), &secureConnection);
    // Set Auto Whitelist Sync
    GAPBondMgr_SetParameter(GAPBOND_AUTO_SYNC_WL, sizeof(uint8_t), &autoSyncWL);
    // Set ECC Key Regeneration Policy
    GAPBondMgr_SetParameter(GAPBOND_ECCKEY_REGEN_POLICY, sizeof(uint8_t), &eccReGenPolicy);
    // Set Key Size used in pairing
    GAPBondMgr_SetParameter(GAPBOND_KEYSIZE, sizeof(uint8_t), &KeySize);
    // Set LRU Bond Replacement Scheme
    GAPBondMgr_SetParameter(GAPBOND_LRU_BOND_REPLACEMENT, sizeof(uint8_t), &removeLRUBond);
    // Set Key Distribution list for pairing
    GAPBondMgr_SetParameter(GAPBOND_KEY_DIST_LIST, sizeof(uint8_t), &KeyDistList);
    // Set Secure Connection Debug Keys
    GAPBondMgr_SetParameter(GAPBOND_SC_HOST_DEBUG, sizeof(uint8_t), &eccDebugKeys);
}


// GAP Bond Manager Callbacks
static gapBondCBs_t SimplePeripheral_BondMgrCBs =
    {
        SimplePeripheral_passcodeCb, // Passcode callback
        SimplePeripheral_pairStateCb // Pairing/Bonding state Callback
};

/*********************************************************************
 * @fn      SimplePeripheral_processPasscode
 *
 * @brief   Process the Passcode request.
 *
 * @return  none
 */
static void SimplePeripheral_processPasscode(spPasscodeData_t *pPasscodeData)
{
    uint32_t passcode = 999999;

    Display_printf(("%04x, %d, %d, %d,\r\n",
              pPasscodeData->connHandle,
              pPasscodeData->uiInputs,
              pPasscodeData->uiOutputs,
              pPasscodeData->numComparison));//state code: 0000,0,1,0

    // Display passcode to user
    if (pPasscodeData->uiOutputs != 0)
    {
        Display_printf(("Passcode: %d\r\n",
                  passcode));
    }

    // Send passcode response
    GAPBondMgr_PasscodeRsp(pPasscodeData->connHandle, SUCCESS,
                           passcode);
}

//ERR state code

    case GAPBOND_PAIRING_STATE_COMPLETE:
        if (status == SUCCESS)
        {
            Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Pairing success");
        }
        else
        {
            Display_printf(dispHandle, SP_ROW_CONNECTION, 0, "Pairing fail: %d", status);//fail state: 0x0b(11);
        }
        break;

在手机上连接并点击配对后,无配对成功记录,安卓苹果均如此,已经在上面查询并尝试了

static gapBondCBs_t SimplePeripheral_BondMgrCBs =
{
NULL, // Passcode callback
SimplePeripheral_pairStateCb // Pairing/Bonding state Callback
};

也无法配对成功,配对完成事件(GAPBOND_PAIRING_STATE_COMPLETE)错误码提示为0x0b(SMP_PAIRING_FAILED_DHKEY_CHECK_FAILED)

我不清楚我还有哪些设置点没有关注到。

麻烦提供一下技术支持,非常感谢!