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.

CC2640: CC2640 central role, collect notifications from several peripherals

Part Number: CC2640

Hi!

On CC2640 is possible collect notifications from several peripherals?

CC2640 in central_to_multiperipheral role, SDK ble_sdk_2_02_05_02.

Do you have example?

I trying write, but I got notifications only from lastest connected device

  • Hi,

    We have the central_to_multiperipheral example available on github (docs | project files | src). Please review the readme an make sure the number of connections (hold by MAX_NUM_BLE_CONNS) is 2.

    Best regards,

  • Hi Clément!

    MAX_NUM_BLE_CONNS is 3 in my project. I working in this project, right now my central is connected to 3 pertiheral, work well, but notification is coming only from last connected device. My noti enablig code:

            if (events & SBC_NOTI_CHANGE_EVT) 
            {
                // Process message.
                uint8_t retVal;
                attWriteReq_t req;
                uint8_t configData[2] = {0x01, 0x00};
    
                events &= ~SBC_NOTI_CHANGE_EVT;
    
                req.pValue = GATT_bm_alloc(connHdl[curr_num], ATT_WRITE_REQ, 2, NULL);
                if ((req.pValue != NULL) && charCCCDHdl[curr_num])
                {
                    req.handle = charCCCDHdl[curr_num]; //Handle for CCCD of Data characteristic        
                    req.len = 2;
                    memcpy(req.pValue, configData, 2);
                    req.cmd = TRUE; //Has to be true for NoRsp from server(command, not request)
                    req.sig = FALSE;
                    retVal = GATT_WriteNoRsp(connHdl[curr_num], &req);
                    if (retVal != SUCCESS)
    				{
    					retVal = GATT_WriteNoRsp(connHdl[curr_num], &req);
    				}
                }
            }

    Perhaps there is a separate define for several notifications?

  • Alex,

    I believe that you must be getting notifications from all peripherals, in the form of SBC_NOTI_CHANGE_EVT:

    if (events & SBC_NOTI_CHANGE_EVT) 

    You can discover which connection it is coming from by looking at the index of connHdl.

    -Luis