Switch between FAST and SLOW adevrtising

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Dear all,

I'm developping a low power beacon based on solar harvesting. I would like to dynamically switch between the SLOW and the FAST advertising based on the energy available on the temporary storage.

I have defined two different value for the following parameter at the configuration phase:

    cyBle_discoveryModeInfo.advParam->advIntvMin = REGVAL_Slow;

    cyBle_discoveryModeInfo.advParam->advIntvMax = REGVAL_Fast;

and I start the advertising in SLOW mode

CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_SLOW);

During the runtime at the end of every becaon transmission using the ADC_Sar i estimate the volatge of the storage with these commands:

    int16 res_ADC = 0u;

    ADC_VddConv_Wakeup();

    ADC_VddConv_StartConvert();

    ADC_VddConv_IsEndConversion(ADC_VddConv_WAIT_FOR_RESULT);

    res_ADC = ADC_VddConv_GetResult16(0u);

Then I have defined a cut value and based on this value I would like to swtich among SLOW and FAST with a simple solution like this:

is_in_fast_advertisement is a global value initialized to false

    if(res_ADC>ADC_Cut){

        if(!is_in_fast_advertisement){

               CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

               is_in_fast_advertisement=true;

        }

    }else{

        if(is_in_fast_advertisement){

               CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_SLOW);

               is_in_fast_advertisement=false;

        }

    }

 

Unortunately is not working.

Anyone can hep me on find a solutions for this?

Thanks in advances for the support.

Best regards

Filippo

0 Likes
1 Solution
Anonymous
Not applicable

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.

View solution in original post

0 Likes
5 Replies
Anonymous
Not applicable

Hi Filippo.

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.

Regards,

Davide

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

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?

0 Likes
Anonymous
Not applicable

Hi,

The Adv intervals cannot be changed without restarting the advertisement. In order to obtain low power, you can refer to the below app note.

http://www.cypress.com/documentation/application-notes/an92584-designing-low-power-and-estimating-ba...

Regards,

-Madhu Sudhan

Anonymous
Not applicable

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.

0 Likes