Hii, i am using CC2340 basic_ble example and changing the advertising name in runtime using UART command and i am able to use do this succesfully but the problem is after changing the scan response or advertising data i am disabling the advertisement using GapAdv_disable to restart the advertisement to take changed data in effet and the code only works once. After that , by giving command on UART the callback function is not triggerd and when i dont use GapAdv_disable function the callback function is triggering every time perfectly. I dont know much about RTOS i am using GapAdv_disable in void *BLEAppUtil_Task(void *arg) in for loop
void *BLEAppUtil_Task(void *arg) { // Register to the stack and create queue and event BLEAppUtil_stackRegister(); #ifdef CC23X0 // Set the BD Address status = osal_snv_read(SNV_ID_ADDR, BUF_LEN, (uint8 *)Address_buf); if(status != SUCCESS) HCI_EXT_SetBDADDRCmd(ownAddr); else HCI_EXT_SetBDADDRCmd(Address_buf); #endif // Init the ble stack BLEAppUtil_stackInit(); // Application main loop for (;;) { if(change_addr || Change_name) { Change_name = 0; status = osal_snv_write(SNV_ID_NAME, NAME_LEN, (uint8 *)buf); if(status != SUCCESS) { UART2_write(uart, "WRITE FAIL",10 , NULL); } else { for(uint8 i=0;i<9;i++) prin_sacn_resp_data_1[i+2] = buf[i]; UART2_write(uart, "NAMEdone:",9 , NULL); status = BLEAppUtil_advStop(peripheralAdvHandle_1); status = BLEAppUtil_initAdvSet(&peripheralAdvHandle_2, &advSetInitParamsSet_2); status = BLEAppUtil_advStart(peripheralAdvHandle_2, &advSetStartParamsSet_1); } }} BLEAppUtil_appEvt_t pAppEvt; // wait until receive queue message 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_STACK_CALLBACK: { // Set the flag to true to indicate that BLEAppUtil_freeMsg // should be used to free the msg freeMsg = TRUE; switch (pMsgData->event) { case GAP_MSG_EVENT: BLEAppUtil_processGAPEvents(pMsgData); break; case GATT_MSG_EVENT: BLEAppUtil_processGATTEvents(pMsgData); break; case L2CAP_DATA_EVENT: BLEAppUtil_processL2CAPDataMsg(pMsgData); break; case L2CAP_SIGNAL_EVENT: BLEAppUtil_processL2CAPSignalEvents(pMsgData); break; case HCI_GAP_EVENT_EVENT: BLEAppUtil_processHCIGAPEvents(pMsgData); break; case HCI_DATA_EVENT: BLEAppUtil_processHCIDataEvents(pMsgData); break; case HCI_SMP_EVENT_EVENT: BLEAppUtil_processHCISMPEvents(pMsgData); break; case HCI_SMP_META_EVENT_EVENT: BLEAppUtil_processHCISMPMetaEvents(pMsgData); break; case HCI_CTRL_TO_HOST_EVENT: { BLEAppUtil_processHCICTRLToHostEvents(pMsgData); hciPacket_t *pBuf = (hciPacket_t *)pMsgData; switch (pBuf->pData[0]) { case HCI_ACL_DATA_PACKET: case HCI_SCO_DATA_PACKET: BM_free(pBuf->pData); default: break; } break; } default: break; } break; } case BLEAPPUTIL_EVT_ADV_CB_EVENT: { BLEAppUtil_processAdvEventMsg(pMsgData); if (((BLEAppUtil_AdvEventData_t *)pMsgData)->event != BLEAPPUTIL_ADV_INSUFFICIENT_MEMORY && ((BLEAppUtil_AdvEventData_t *)pMsgData)->pBuf) { BLEAppUtil_free(((BLEAppUtil_AdvEventData_t *)pMsgData)->pBuf); } break; } case BLEAPPUTIL_EVT_SCAN_CB_EVENT: { BLEAppUtil_processScanEventMsg(pMsgData); if (((BLEAppUtil_ScanEventData_t *)pMsgData)->event == BLEAPPUTIL_ADV_REPORT && ((BLEAppUtil_ScanEventData_t *)pMsgData)->pBuf->pAdvReport.pData) { BLEAppUtil_free(((BLEAppUtil_ScanEventData_t *)pMsgData)->pBuf->pAdvReport.pData); } if (((BLEAppUtil_ScanEventData_t *)pMsgData)->event != BLEAPPUTIL_SCAN_INSUFFICIENT_MEMORY && ((BLEAppUtil_ScanEventData_t *)pMsgData)->pBuf) { BLEAppUtil_free(((BLEAppUtil_ScanEventData_t *)pMsgData)->pBuf); } break; } case BLEAPPUTIL_EVT_PAIRING_STATE_CB: BLEAppUtil_processPairStateMsg(pMsgData); break; case BLEAPPUTIL_EVT_PASSCODE_NEEDED_CB: BLEAppUtil_processPasscodeMsg(pMsgData); break; case BLEAPPUTIL_EVT_CONN_EVENT_CB: BLEAppUtil_processConnEventMsg(pMsgData); break; case BLEAPPUTIL_EVT_CALL_IN_BLEAPPUTIL_CONTEXT: { ((BLEAppUtil_CallbackToInvoke_t *)pMsgData)->callback(((BLEAppUtil_CallbackToInvoke_t *)pMsgData)->data); // Verify that the data is not NULL before freeing it if(((BLEAppUtil_CallbackToInvoke_t *)pMsgData)->data != NULL) { BLEAppUtil_free(((BLEAppUtil_CallbackToInvoke_t *)pMsgData)->data); } break; } default: break; } // Free the data if (pMsgData && freeMsg) { // Use freeMsg BLEAppUtil_freeMsg(pMsgData); } else if (pMsgData) { // Use free BLEAppUtil_free(pMsgData); } } } }