9 Replies Latest reply on Apr 29, 2019 2:19 AM by XinghaoZ_26

    gap_set_adv_parameters API

    YaTr_3516311

      Dear friends,

       

      I want to change device to tranmist data per 7s, so I want to use SAP command to do the setting. But I don't understand below parameters clearly.

      1. What is the difference with high interval and low interval(high duration and low duaration)?

      2. Can you do a detail explanation for interval and duration behavior?

      3. How can I set to realize the function "tranmist data per 7s"?

        • 1. Re: gap_set_adv_parameters API
          XinghaoZ_26

          The four parameters are for the advertisement settings. They are all defined in the BT spec. High interval and high duration are for "Fast Advertisement", low interval and low duration are for "Slow Advertisement".

           

          Interval is the time between two advertising events:

           

          Duration determines how long the advertising will last. The device will usually starts fast advertising first, then after the high duration time, it will change to slow advertising.

           

          For your application, do you mean advertising or connection with "transmit data per 7s". Usually the device will transmit data after connection. You'd better start a timer on your host MCU and send data per 7s.

          • 2. Re: gap_set_adv_parameters API
            YaTr_3516311

            Dear OwenZ,

             

            Thank you for your help.

            1. "They are all defined in the BT spec", can you give me a detailed spec name? I check the information in "EZ-Serial WICED Firmware Platform User Guide for CYW2070x-based Modules", but no detail explanation.

            2. For your application, do you mean advertising or connection with "transmit data per 7s". Usually the device will transmit data after connection. You'd better start a timer on your host MCU and send data per 7s.

            [A]: It's beacon function. I think it should be advertising with "transmit data per 7s". How can I set? Not just use gap_set_adv_parameters API to set the interval? I don't know why "Usually the device will transmit data after connection. ", can you explain?

            • 3. Re: gap_set_adv_parameters API
              XinghaoZ_26

              BT Spec is the bluetooth core specification. The latest version is 5.1 now. You can download it in the bluetooth sig web: https://www.bluetooth.com/specifications/bluetooth-core-specification/

               

              For beacon application, the device just working in advertising state. You don't need to consider the connection.

              You need to start a timer in MCU for advertising every 7 seconds.

              • 4. Re: gap_set_adv_parameters API
                YaTr_3516311

                You need to start a timer in MCU for advertising every 7 seconds.

                [Q]: use gap_set_adv_parameters API to set the interval is not correct? Must start a timer in MCU for advertising every 7 seconds?

                 

                • 5. Re: gap_set_adv_parameters API
                  XinghaoZ_26

                  There are two reasons:

                  1. The actual time between two advertising event contains advinterval(20ms~10.24s) and a random advDelay(0~10ms). You can't control it with 7 seconds precisely.

                  2. In each advertising event, the advertising packet will only be transmitted once in channel 37,38 and 39. You need to evaluate if that is reliable in your application.

                  1 of 1 people found this helpful
                  • 6. Re: gap_set_adv_parameters API
                    YaTr_3516311

                    I test ezserial_343026-CYBT_343026_EVAL-rom-ram-Wiced-release FW, then get @R,0039,GAP,0000,M=02,T=03,C=07,H=0030,D=001E,L=0800,O=003C,F=00 from GAP command.

                    H=0030,D=001E,L=0800,O=003C means 30ms high interval, 18.75ms high duaration, 1.28s low interval, 37.5ms low duaration respectively. So behavior is like blew screen shot? If have any problem, please modify.

                     

                    • 7. Re: gap_set_adv_parameters API
                      XinghaoZ_26

                      The duration must be bigger than interval. For example, if you set the high interval to 20ms and high duration to 1s. Low interval to 50ms and low duration to 10s. The device will excute advertising 50 times with 20ms interval in 1 second and 200 times with 50ms interval in 10 seconds. Then it will stop advertising. 

                      1 of 1 people found this helpful
                      • 8. Re: gap_set_adv_parameters API
                        YaTr_3516311

                        OK. I see.

                        If I don't mind the 7 seconds precision, just a rough value to transmit 7s, SAP,H=2BC0,D=2BC0. Am I correct? How can I confirm that this 7s parameter have been changed successfully and bt DEV behavior as my setting?

                        • 9. Re: gap_set_adv_parameters API
                          XinghaoZ_26

                          Please set the duration to 0 which means the device will always stay in high advertising mode with 7s interval and never stop. If you set it same with interval, the device will only advertise once.

                          If you want to test the BT behavior, you need a sniffer such as frontline or ellisys to catch the OTA log.

                          1 of 1 people found this helpful