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: 蓝牙只能成功连接一次,是怎么回事?

Part Number: CC2642R


为了给我们的产品提供一个干净的项目基础。我在 SDK 5.10.00.48 上导入 project_zero,并清空了 OAD,以及 led, button, data 三个蓝牙服务。

程序编译连接没有问题。不过,有个奇怪的情况。在 CCS 下载程序调试,一切都正常。不过只能成功连接一次!

调试状态下,终端提示下面的信息时,蓝牙就中断了。以后再也不能搜索到这个蓝牙设备。

#000009 [ 37.733 ] INFO: (project_zero.c:1737) Updated params for 41:8F:71:66:4D:69, interval: 7.50 ms, latency: 0, timeout: 5000 ms
#000010 [ 37.973 ] INFO: (project_zero.c:1737) Updated params for 41:8F:71:66:4D:69, interval: 45.0 ms, latency: 0, timeout: 5000 ms

该处的函数代码是:

/*********************************************************************
 * @fn      ProjectZero_handleUpdateLinkEvent
 *
 * @brief   Receive and parse a parameter update that has occurred.
 *
 * @param   pEvt - pointer to stack event message
 */
static void ProjectZero_handleUpdateLinkEvent(gapLinkUpdateEvent_t *pEvt)
{
    // Get the address from the connection handle
    linkDBInfo_t linkInfo;
    linkDB_GetInfo(pEvt->connectionHandle, &linkInfo);

    static uint8_t addrStr[3 * B_ADDR_LEN + 1];
    util_arrtohex(linkInfo.addr, B_ADDR_LEN, addrStr, sizeof addrStr,
                  UTIL_ARRTOHEX_REVERSE);

    if(pEvt->status == SUCCESS)
    {
        uint8_t ConnIntervalFracture = 25*(pEvt->connInterval % 4);
        // Display the address of the connection update
        Log_info5(
            "Updated params for %s, interval: %d.%d ms, latency: %d, timeout: %d ms",
            (uintptr_t)addrStr,
            (uintptr_t)(pEvt->connInterval*CONN_INTERVAL_MS_CONVERSION),
            ConnIntervalFracture,
            pEvt->connLatency,
            pEvt->connTimeout*CONN_TIMEOUT_MS_CONVERSION);
    }
    else
    {
        // Display the address of the connection update failure
        Log_info2("Update Failed 0x%02x: %s", pEvt->opcode, (uintptr_t)addrStr);
    }

    // Check if there are any queued parameter updates
    pzConnHandleEntry_t *connHandleEntry = (pzConnHandleEntry_t *)List_get(
        &paramUpdateList);
    if(connHandleEntry != NULL)
    {
        // Attempt to send queued update now
        ProjectZero_sendParamUpdate(*(connHandleEntry->connHandle));

        // Free list element
        ICall_free(connHandleEntry->connHandle);
        ICall_free(connHandleEntry);
    }
}