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.

CCS/CC2640R2L: Simple Central Error "Encryption Failed"

Part Number: CC2640R2L
Other Parts Discussed in Thread: LAUNCHXL-CC26X2R1, CC2640, SYSCONFIG, CC2640R2F

Tool/software: Code Composer Studio

Hello,

I am having a problem while running the simple_central and simple_peripheral examples.

The examples work correctly, but when DEFAULT_DEV_DISC_BY_SVC_UUID is enabled, simple_central does not maintain the connection with the peripheral. The change is being made through simple_central.syscfg, field "Discover Devices By Service UUID".

After the connection the error is returned: "Encryption failed: 6".

The define SIMPLEPROFILE_SERV_UUID is the same in both examples.

When I undo the change to DEFAULT_DEV_DISC_BY_SVC_UUID the problem persists.

The system only works again if another pci is used. And if you repeat the activation of DEFAULT_DEV_DISC_BY_SVC_UUID the same occurs.

Simple_peripheral connects when using btool and also on smartphones. It is just the Simple_Central example that stops working.

By erasing the entire example and creating everything again, the problem persists.

Simple_central -> launchxl-cc26x2r1.
simplelink_cc13x2_26x2_sdk_4_20_01_04

Simple_peripheral -> cc2640r2.
simplelink_cc2640r2_sdk_4_20_00_04

  • Hi Dhiego,

    I have assigned an expert to help you on this issue you are seeing. In the meantime I had some clarification questions for you:

    - Can you provide sniffer logs please to better help with the debugging?

    - Is it possible to perform your test using the same launchpads? For instance two CC2640 or two CC26x2R1?

    - Is it possible to perform your test using the LPs you have listed, but the same SDK?

    My goal with the last two tests is to provide as much information on what this issue could be stemming from. Thanks!

    Best Regards,

    Jenny

  • Hello,

    To continue the development, I'm using two pci with cc2640 and the same sdk.

    I removed the two_btn_menu from simple_central and added a state machine to execute the commands.

    The device connects but loses the connection after a few seconds.

    static void Ble_StateMachineControl(UArg a0){
        switch(GL_State_Machine) {
    
           case STATE_IDLE  : //1
               GL_State_Machine = STATE_SEARCHING;
              break;
    
           case STATE_SEARCHING  : //2
               if(SimpleCentral_enqueueMsg(SC_EVT_SCAN_ENABLED, SUCCESS, NULL) == SUCCESS)
                   GL_State_Machine = STATE_CONNECTING;
              break;
    
           case STATE_CONNECTING  : //3
               GL_State_Machine = STATE_IDLE;
               for(uint8_t i=0; i<numScanRes; i++){
                   if(SimpleCentral_enqueueMsg(SC_EVT_CONNECT_ENABLED, i, NULL) == SUCCESS)
                       GL_State_Machine = STATE_STATUS;
               }
              break;
    
           case STATE_STATUS  : //4
               GL_State_Machine = STATE_SEARCHING;
               if(numConn>0)
                   GL_State_Machine = STATE_READING_DATA;
              break;
    
           case STATE_READING_DATA  : //5
               GL_State_Machine = STATE_IDLE;
               for(uint8_t i=0; i<numConn; i++){
                   if(SimpleCentral_enqueueMsg(SC_EVT_READDATA_ENABLED, i, NULL) == SUCCESS)
                        GL_State_Machine = STATE_READING_DATA;
               }
    
              break;
    
           default :
               GL_State_Machine = STATE_IDLE;
               break;
    
        }

    And added the following code in the function static void SimpleCentral_processAppMsg(scEvt_t *pMsg).

        case SC_EVT_SCAN_ENABLED:
          SimpleCentral_doDiscoverDevices(0);
          break;
    
        case SC_EVT_CONNECT_ENABLED:
          SimpleCentral_doConnect(pMsg->hdr.state);
          break;
    
        case SC_EVT_READDATA_ENABLED:
            scConnHandle = connList[pMsg->hdr.state].connHandle;
            SimpleCentral_doReadData(0x20);
    
          break;

    Do I need more commands to maintain the connection?

  • Dhiego,

    I tested the stock projects where the only modification was to set up the UUID filtering on the Observer settings of the simple_central Sysconfig file. I was able to retain the connection throughout the process. 

    I am using the exact same setup as you: a CC2640R2F on the simple_peripheral and a CC26x2R1 on the simple_central.

    In this case, I suspect that may be some specific leftover configuration that may be preventing the central from acknowledging the Services on the peripheral for filtering. Could you step back and start from the known good configuration on both projects and start adding your modifications instead?

    At first glance the snippet of code you sent does not have anything blatantly wrong, but I would definitely check if the filtering in the SC_EVT_ADV_REPORT is still present in your code - basically the code highlighted below:

    #if (DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE)
          if (SimpleCentral_findSvcUuid(SIMPLEPROFILE_SERV_UUID,
                                        pAdvRpt->pData, pAdvRpt->dataLen))
          {
            SimpleCentral_addScanInfo(pAdvRpt->addr, pAdvRpt->addrType);
            Display_printf(dispHandle, SC_ROW_NON_CONN, 0, "Discovered: %s",
                           Util_convertBdAddr2Str(pAdvRpt->addr));
          }

    Hope this helps,

    Rafael