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.

CC2640R2F: 连接多个从机,打开notify失败。

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640

主机是cc2642,从机是cc2640,

一主6从时,可以打开notify,并进行数据传输,一主7从时,第七个从机打开notify失败。一主8从时,也是第七个从机打开notify失败。更多从机还需要其他设置吗?

    for(i=0;i<MAX_NUM_BLE_CONNS;i++)
    {
        req.pValue = GATT_bm_alloc(connList[i].connHandle, ATT_WRITE_REQ, 2, NULL);
        if ( req.pValue != NULL )
        {
            if(index ==SIMPLEPROFILE_CHAR1)
            {
                req.handle = connList[i].charHandle+1;
            }
            else if(index ==SIMPLEPROFILE_CHAR2)
            {
                req.handle = connList[i].charHandle+5;
            }
            req.len = 2;
            req.pValue[0] = LO_UINT16(GATT_CLIENT_CFG_NOTIFY); //0x0001为开notify;
            req.pValue[1] = HI_UINT16(GATT_CLIENT_CFG_NOTIFY);
            req.sig = 0;
            req.cmd = 0;

            uint8_t status = GATT_WriteCharValue(connList[i].connHandle, &req, selfEntity);
//            System_printf("Notification connHandle:%d,%d\r\n",connList[i].connHandle,i);

            CPUdelay(100);//250 * 48 / 4    //6*3
            if ( status != SUCCESS )
            {
            GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
              #ifdef uart_debug
//                        System_printf("Notification failed:%d\r\n",i);
                        pStrAddr = (uint8_t*) Util_convertBdAddr2Str(connList[i].addr);
                    System_printf( "Notification failed:%d , %s\r\n",  i,pStrAddr);
              #endif
//                return false;
                        i--;
//                        CPUdelay(6*3);
            }
//            else
//            {
//            //                SimpleCentral_autoConnect();
//            //                    System_printf("Notification success:%d\r\n",i);
//                return true;//return use careful!
//            }
        }
    }