5 Replies Latest reply on Jul 13, 2018 12:53 PM by frederic.chasse_1669321

    Can't start advertisement with SLOW settings

    frederic.chasse_1669321

      Hi,

       

      I'm trying to use the "Limited" discovery mode, with a timeout on the Fast advertising interval, and no timeout on the Slow advertising interval.

       

      I realized that after the fast timeout, I need to call again Cy_BLE_GAPP_StartAdvertisement(), as it's not handled automatically.

       

      But when I use this:

       

      status = Cy_BLE_GAPP_StartAdvertisement(CY_BLE_ADVERTISING_SLOW, CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX);

       

      status is set to CY_BLE_ERROR_INVALID_PARAMETER. This is also validated because after that, the function Cy_BLE_GetAdvertisementState() returns CY_BLE_ADV_STATE_STOPPED.

       

      What am I doing wrong?

       

      Thank you,

       

      Fred

       

        • 1. Re: Can't start advertisement with SLOW settings
          frederic.chasse_1669321

          I just tested adding a timeout to the slow interval and it now seems to be working.

           

          Furthermore, the switching from fast to slow now seems automatic, meaning that the statement "if (Cy_BLE_GetAdvertisementState() == CY_BLE_ADV_STATE_STOPPED)" is always false after the first Cy_BLE_GAPP_StartAdvertisement().

           

          What is different in the behavior if I add/remove the timeout on the slow interval?

          • 2. Re: Can't start advertisement with SLOW settings
            psyu

            Hello Frederic,

             

            In the below statement you used the slow advertising parameter (CY_BLE_ADVERTISING_SLOW) but you disabled the timeout to the Slow advertising interval in the BLE component due to this the advertisement does not started. If you use the fast advertising parameter (CY_BLE_ADVERTISING_FAST) in the function you can advertise.

             

            status = Cy_BLE_GAPP_StartAdvertisement(CY_BLE_ADVERTISING_SLOW, CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX);

             

            After adding the timeout to the slow interval the function started advertising without any error because it accepted only slow advertising interval.

             

             

             

            Thanks,

            PSYU.

            • 3. Re: Can't start advertisement with SLOW settings
              frederic.chasse_1669321

              Hi PSYU,

               

              So the scheme that I want is not possible? Meaning that I want to advertise fast, but after the timeout, I want to advertise slowly indefinitely unless a certain event happens. The workaround that I have right now to never stop advertising is as follows:

               

              if (Cy_BLE_GetAdvertisementState() == CY_BLE_ADV_STATE_STOPPED) {

                  status = Cy_BLE_GAPP_StartAdvertisement(cy_ble_advertisingIntervalType, CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX);

              }

               

              cy_ble_advertisingIntervalType keeps track of the last advertisement speed used, so when the radio stops advertising, we restart it again. Ideally, I would like to remove the timeout on the slow advertisement interval, but you're telling that it cannot be done, right?

               

              Thank you,

               

              Fred

              • 4. Re: Can't start advertisement with SLOW settings
                psyu

                Hello Fredrick,

                 

                When we disable timeout for slow advertising interval it is not advertising but in this case it shall start continuous advertisement and if we enable the timeout advertisement is started. We will trace the issue regarding that and let you know once we find the solution.

                 

                Please enable timeout in slow advertising interval and use.

                 

                 

                Thanks,

                PSYU.

                • 5. Re: Can't start advertisement with SLOW settings
                  frederic.chasse_1669321

                  Thank you PSYU, I will continue to use the workaround until it's fixed.