The values of advIntvMin and advIntvMax are the minimum and maximum values in the active advertising mode.
Try to set advIntvMin = REGVAL_Fast and advIntvMax = REGVAL_Fast+10 before starting the fast advertising and advIntvMin = REGVAL_Slow and advIntvMax = REGVAL_Slow+10 before starting the slow one.
You should be setting:
cyBle_discoveryModeInfo.advParam->advIntvMin = REGVAL_Slow;
cyBle_discoveryModeInfo.advParam->advIntvMax = REGVAL_Slow;
when you want slow advertising, and this:
cyBle_discoveryModeInfo.advParam->advIntvMin = REGVAL_Fast;
cyBle_discoveryModeInfo.advParam->advIntvMax = REGVAL_Fast;
when you want fast advertising.
The Min and Max intervals for advertising set the range of random distribution for timing that the packets will transmit within. Setting them to be the same will force strict timing increasing the chance of EMI, but for testing purposes it will simplify stuff.
Also, you may have to be stopping advertisement before switching advertisement modes;
Call CyBle_GappStopAdvertisement() first, then call the CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_SLOW); or CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST); depending on which mode you are switching to.
Thank you so much for your detailed reply.
So I have misunderstood the means of advIntvMax and advIntvMin thank again for have clarified me this point.
Before go head with the solutions that I have described here I have adopted the solution that you where proposing to me.
In fact I was setting the parameter to the same value and based on the results of ADC conversion I do the following steps:
1) I call the function CyBle_GappStopAdvertisement()
2) I looking for the signal CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP
3) I will update accordingly with the ADC results the advertiing interval
4) I restart the advertising mode
but this procedure require too much energy for my application.
There is a possibility of changing the advertising interval without restart the advertising system?
The Adv intervals cannot be changed without restarting the advertisement. In order to obtain low power, you can refer to the below app note.
You can put the device into deep-sleep mode with the device still advertising. This will allow very low power consumption of the CPU and peripherals (if configured properly), while still supporting advertising from the BLE device.