You can set the address type as random as below:
cyBle_discoveryModeInfo.advParam->ownAddrType = CYBLE_GAP_ADDR_TYPE_RANDOM; in the
CYBLE_EVT_STACK_ON event before starting advertisment.
This is only for setting the address type. For setting the advertising address as a random address, you can generate a random address and set using CyBle_SetDeviceAddress() API. They call the above code line of setting address type. Then start adv.
When I change BD address by CyBle_SetDeviceAddress() set, then BD address is changed.
But when add "cyBle_discoveryModeInfo.advParam->ownAddrType = CYBLE_GAP_ADDR_TYPE_RANDOM" to source,
then BD address is not changed.
Could you please make sure you have followed the below sequence:
- Make sure device is not advertising mode
- set the device address
- cyBle_discoveryModeInfo.advParam->ownAddrType = CYBLE_GAP_ADDR_TYPE_RANDOM;
- call enter discovery API
If still you are facing any issue, please share the project, I will help you to find what could be the issue.