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.

CC2340R5-Q1: Func:GapAdv_disable retun value is not success

Part Number: CC2340R5-Q1
Other Parts Discussed in Thread: CC2340R5

Hello TI Team.

We are trying to realize a series of operations such as "carrier transmission"→"advertisement transmission"→

"standby mode transition" after wake up by GPIO interrupt.

 

The return value of Func. "GapAdv_disable" before sending advertisements is "0x34".
Please let me know the solution.

SDK:simplelink_lowpower_f3_sdk_7_20_01_10

BaseSW:basic_ble_LP_EM_CC2340R5_freertos_ticlang

Regards.

  • Hi,

    0x34 is found as bleGAPNotFound which means there is no buffer/handle / it does not exist. 

    https://dev.ti.com/tirex/content/simplelink_lowpower_f3_sdk_7_40_00_64/docs/ble5stack/ble_user_guide/doxygen/ble/html/group___gap_adv.html#ga4e45550a6887067a26b8cc797e3d51fe

    For us to comment further, can you please share more about what you're doing, and how you're ensuring the handle you're passing in is ok?

  • Thanks for the feedback. 

    This may not be the optimal information, but I will share it.

    1. After processing the HCI GAP events generated by HCI, set up the advertised transmission data.

    void Connection_HciGAPEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
    {
    
      switch (event)
      {
      case BLEAPPUTIL_HCI_VE_EVENT_CODE:
      {
        hciEvt_VSCmdComplete_t *vsdat = (hciEvt_VSCmdComplete_t *)pMsgData;
        if (vsdat->cmdOpcode == HCI_EXT_MODEM_TEST_TX)
        {
          Util_startClock(&tsCStr);
          tsRFStatus = tsRF_TX;
        }
        else if (vsdat->cmdOpcode == HCI_EXT_END_MODEM_TEST)
        {
          Util_stopClock(&tsCStr);
          tsRFStatus = tsRF_IDLE;
          advdata_setup();
        }
        break;
      }
    
      default:
        break;
      }
    }

    void advdata_setup(void)
    {
    	uint8_t *pData;
    
    	pData = BLEAppUtil_malloc(DATA_SIZE + 2);
    	pData[0] = (uint8_t)0;
    	pData[1] = (uint8_t)(23 + 8);
    	pData[2] = 3;
    	pData[3] = (uint8_t)GAP_ADTYPE_LOCAL_NAME_SHORT;
    	pData[4] = (uint8_t)'B';
    	pData[5] = (uint8_t)'C';
    	pData[6] = (uint8_t)(23 + 3);
    	pData[7] = GAP_ADTYPE_MANUFACTURER_SPECIFIC;
    	pData[8] = 0x0d;
    	pData[9] = 0x00;
    	memcpy(&pData[10], &data_buf[6], 23);
    	if (BLEAppUtil_enqueueMsg(BLEAPPUTIL_EVT_RCV_UART_MSG, pData) != SUCCESS) {
    		BLEAppUtil_free(pData);
    	}
    	return;
    }

            if (mq_receive(BLEAppUtil_theardEntity.queueHandle, (char*)&pAppEvt, sizeof(pAppEvt), NULL) > 0)
            {
                BLEAppUtil_msgHdr_t *pMsgData = (BLEAppUtil_msgHdr_t *)pAppEvt.pData;
                bool freeMsg = FALSE;
    
                switch (pAppEvt.event)
                {
                  case BLEAPPUTIL_EVT_RCV_UART_MSG:
    				advdata_update((uint8_t *)pMsgData);
    				break;

    2.By the queue, updates the advertised transmission data.

    void g_fn_advdata_update(uint8_t *dat)
    {
    	bStatus_t lb_status;
    	if(dat[0] == 0) {
    		lb_status = Broadcaster_updateAdvData(&dat[1]);
    		if(lb_status != SUCCESS) {
    			while(1){}
    		}
    	}
    }

    3.The code below causes a problem.

    bStatus_t Broadcaster_updateAdvData(char *advDat)
    {
        bStatus_t status = SUCCESS;
    
        status = GapAdv_disable(broadcasterAdvHandle_1);
        if((status != SUCCESS) && (status != bleAlreadyInRequestedMode))
        {// Return status value
            return(status);
        }
        status = GapAdv_loadByHandle(broadcasterAdvHandle_1, GAP_ADV_DATA_TYPE_ADV, advDat[0], &advDat[1]);
        if(status != SUCCESS)
        {// Return status value
            return(status);
        }
        status = GapAdv_enable(broadcasterAdvHandle_1, GAP_ADV_ENABLE_OPTIONS_USE_DURATION, 200);
        if(status != SUCCESS)
        {// Return status value
            return(status);
        }
        return(status);
    }

    Regards.

  • Hello, 

    Since you are receiving an 0x34 code, GapAdv_disable is somehow not receiving the handle. Can you please verify that the handle is being properly created and/or the handle is actually making it to the GapAdv_disable function? Let me know if this helps and if I can assist any further! 

    Thanks, 

    Isaac