2 Replies Latest reply on Jul 2, 2017 11:16 PM by AnjanaM_61

    Change advertisement interval to 10 minutes



      I am working with the S6SAE101A00SA1002 Solar-Powered IoT Device Kit and I am currently trying to change the advertisement rate of the CYBLE-022001-00 EZ-BLE PRoC Module to 10 minutes. 


      The code I am looking at is the example code "EH_Motherboard". In the main.h file there is the following define: 


       #define ITRVL_SENSOR_ON                         (10240u) /* 10.24s */


      First of all, the default value 10240 should lead to an advertisment of 10.24s. I measured the blink frequency of the "User LED" on the receiver, the LED blinks every 5.8s. (I assume the LED blinks as soon as a packet arrives?)


      However, even if I increase the value ITRVL_SENSOR_ON , the LED still blinks every 5.8s. If I decrease the value, the LED blinks more often (at least...). 


      The problem I see is that  ITRVL_SENSOR_ON is given to the function


      CYBLE_API_RESULT_T Beacon_GappStartAdvertisement(uint32_t advertisingInterval)


      and is therefore casted into a uint32_t. 




      In the function itself the value is then casted to a uint16_t: 


            cyBle_discoveryModeInfo.advParam->advIntvMin = (advertisingInterval << 3) / 5;
            cyBle_discoveryModeInfo.advParam->advIntvMax = cyBle_discoveryModeInfo.advParam->advIntvMin;


      I think it is not possible to increase the advertisement rate to 10 minutes using this code. Any suggestions on how I get the chip to send the data every 10 minutes? :-)


      Thank you a lot in advance for your help!


      Best regards, 



        • 1. Re: Change advertisement interval to 10 minutes

          @smalacar The maximum value of a uint16 is 65535, which if it is in milliseconds would be 65.5 seconds ~  It does seem like the code for the example might be limited in functionality ;)


          10 Minutes might be too long for the internal timer for the advertisement; You could try using a software timer, a hardware timer, or the WDT to turn on advertisement for a single packet every ten minutes instead of setting the advertisement interval. I think this would be a more likely-to-succeed approach.

          • 2. Re: Change advertisement interval to 10 minutes

            Hi sma,


            According to the BLE spec, the maximum advertising interval can be set up to 10.24s. Thus 10 minute advertisement interval violates the spec you can't set it directly.


            Also 10 minute advertisement interval is too long such that your Central will not be able to find the peripheral so fast.


            Please let us know why do you want to keep such long adv interval. If your application needs advertising slow, you can keep adv timeout less. And after a 10 minute timer, you can start the advertisement again.