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.

CC1352P: Gap_AdvDestroy not working

Part Number: CC1352P

Using of Gap_AdvDestroy before Gap_AdvEnable corrupting advertise data and generate hard fault.

Below is my code snippet

GapAdv_destroy( advHandle, GAP_ADV_FREE_OPTION_ADV_DATA | GAP_ADV_FREE_OPTION_SCAN_RESP_DATA );
CPUdelay( 160000 );//Task_sleep(100*100);

// Create Advertisement set #1 and assign handle
GapAdv_create(&multi_role_advCB, &advParams1,
&advHandle);

// Load advertising data for set #1 that is statically allocated by the app
GapAdv_loadByHandle(advHandle, GAP_ADV_DATA_TYPE_ADV, nLen_p,
aData_p);

// Set event mask for set #1
GapAdv_setEventMask(advHandle,
GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
GAP_ADV_EVT_MASK_SET_TERMINATED);

// Enable legacy advertising for set #1
//status = GapAdv_enable(advHandle, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);

status = GapAdv_enable(advHandle, GAP_ADV_ENABLE_OPTIONS_USE_MAX_EVENTS , 10u);

Whenever i use Gap_AdvDestroy, advetisement gives hard fault error.