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.

LAUNCHXL-CC26X2R1: Ble simple central example modified code gap termination event not generating?

Part Number: LAUNCHXL-CC26X2R1

HI i'm using sdk simplelink_cc13x2_26x2_sdk_5_20_00_52

This is my modified code

like is follow -  i'm using a simple central example for my project in that after the scan  advreport event it well trigger on  that i'm collecting the scan address and sent to the uart and then again through serial UART i'm receiving address that address stored in global bufffer inside uart i'm enqueued this one  SC_CONN_EVT

SimpleCentral_enqueueMsg(SC_CONN_EVT,0, NULL);

 

case SC_EVT_ADV_REPORT:
    {

                     GapScan_Evt_AdvRpt_t* pAdvRpt;
                     pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);

                 /*    if (pAdvRpt->evtType &= ADV_RPT_EVT_TYPE_SCAN_RSP)
                                    {
                                        if (++total_scan_results_count == 0xffffffff)
                                        {
                                            total_scan_device_count = 0;
                                        }
                                        ++scan_results_count;*/
                      if( (*((pAdvRpt->pData)+2) == 0x41) ||  (*((pAdvRpt->pData)+2) == 0x4D) )
                         {

                          memcpy(&AddrLis, pAdvRpt->addr, B_ADDR_LEN);

                        

                              sync_done = false;

                              GapScan_disable("");
                                       
                        
                              scanningStarted =  FALSE;
                           
                              if (pAdvRpt->pData != NULL)
                                      {
                                         ICall_free(pAdvRpt->pData);                         // Free report payload data
                                      }

                              // Send Data To HOST
                              // the data address of scanned device address based on that IPQ send command to cental
                               // depends on that have to connect or cancel connection
                              SendDataToUart(AddrLis, sizeof(AddrLis));

                                }

                                    }
                                  

here I'm calling the connection function it's connecting but after that termination request function calling termination is happening but    GAP_LINK_TERMINATED_EVENT:  not triggering please help me!

  static void SimpleCentral_processAppMsg(scEvt_t *pMsg)
  {
    case  SC_CONN_EVT:
              {
                  uint8_t vs[4]={0};
                      vs[0]=0x65;
                      vs[1]=0x65;
                      vs[2]=0x65;

                     SendDataToUart(vs,sizeof(vs));
              uint8_t addrType=0x0;
                  GapInit_connect(addrType & MASK_ADDRTYPE_ID,addrr,INIT_PHY_1M,0);
                  break;
              }
    }

  • Hi Vadivelan,

    I'm not sure I understand your question entirely. What I think you're saying is that when you call the GapInit_connect function in your second code block, you are able to connect briefly, but then the connection is terminated and you aren't observing the GAP_LINK_TERMINATED_EVENT. Is that the problem you're seeing?

    If so, it may be possible that your application is getting stuck somewhere that is making it unable to maintain the connection interval with your device. I would recommend debugging your project and pausing its execution when the connection is terminated. This may give you some insight into where the connection is breaking.

    Best,

    Nate

  • connection is happening and termination also happening perfectly but termination event not triggering 

    Sorry for that, but what you said is not an issue !!

    if possible please can we have one sync up now

    To join the video meeting,

  • Hi Vadivelan,

    Unfortunately we do not offer personal video debugging support. It would be impossible for us to be able to support all of our customers this way. If you want more hands on support, you'll have to go through your local field applications engineer.

    You are more than welcome to share screenshots or describe your problems in greater detail. I will be happy to assist you and point you to the resources available to help you resolve your issue.

    Best,

    Nate

  • ok try to understand the issue 

     simple central scanning the particular devices  as bellow code we are receiving address of the device in this pAdvRpt->addr

    case SC_EVT_ADV_REPORT:
    {

    GapScan_Evt_AdvRpt_t* pAdvRpt;
    pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);


    if( (*((pAdvRpt->pData)+2) == 0x41) || (*((pAdvRpt->pData)+2) == 0x4D) )
    {

    memcpy(&AddrLis, pAdvRpt->addr, B_ADDR_LEN);

    GapScan_disable("");
    // Establish a connection to the device
    // GapInit_connect(pAdvRpt->addrType & MASK_ADDRTYPE_ID, pAdvRpt->addr,
    // INIT_PHY_1M, 0);

     I'm copying that into buffer send the data to uart  another controller will receive and again it will send back same device address 

    that address I'm collecting to the global buffer and then in uart read callback function inside  enqueued was called SC_CONN_EVT

    this on i was created  

    ( SimpleCentral_enqueueMsg(SC_CONN_EVT,0, NULL);

     whenever the above function is called it's gonna trigger the below code 

     

      static void SimpleCentral_processAppMsg(scEvt_t *pMsg)
      {
        case  SC_CONN_EVT:
                  {
                      uint8_t vs[4]={0};
                          vs[0]=0x65;
                          vs[1]=0x65;
                          vs[2]=0x65;
    
                         SendDataToUart(vs,sizeof(vs));
                  uint8_t addrType=0x0;
                      GapInit_connect(addrType & MASK_ADDRTYPE_ID,addrr,INIT_PHY_1M,0);
                      break;
                  }
        }

    then connection happen and some parameter updates  after that I'm terminating the connection 

    using gap_terminate function 

    after terminate GAP_LINK_TERMINATED_EVENT:  gap event has to trigger but it's not triggering 

    note(if I called gapinit_connect function inside the SC_EVT_ADV_REPORT means there is no problem not facing any issue )

    now tell me?

  • Hi Vadivelan,

    What function are you calling to terminate the connection? I see in simple_central you can use SimpleCentral_doDisconnect(), which should work. Once disconnected, you should observe a GAP_LINK_TERMINATED_EVENT triggered from the Stack Library. Perhaps you can pause execution of your code when this termination event happens to see where you code goes instead of the GAP_LINK_TERMINATED_EVENT case in SimpleCentral_processGapMsg?

    Best,

    Nate

  • What function are you calling to terminate the connection?

    GAP_TerminateLinkReq(scConnHandle, HCI_DISCONNECT_REMOTE_USER_TERM);

    I think still do not understand my question?

    please check this one code follow let me know

  • Hi Vadivelan,

    Please pause execution of your code when you're expecting the termination event to happen (even though it doesn't) to see where you code goes instead of the GAP_LINK_TERMINATED_EVENT case in SimpleCentral_processGapMsg. Consider putting a breakpoint inside that event to ensure it's not being called too.

    I would also recommend using an unmodified simple_central project to debug this. It may be possible you're doing something strange unintentionally with the UART with your modifications. So, I would recommend starting from the unmodified simple_central project and building your way up to find where it breaks.

    We cannot continue to debug your solution until you can show what's happening in your code instead of the terminate event you're expecting. We do not allow file-sharing over google drive, nor will I be able to parse through your entire code to find your issue.

    Best,

    Nate