gap_set_adv_parameters API

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

cross mob
YaTr_3516311
Level 5
Level 5
25 sign-ins First solution authored 100 replies posted

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"?

pastedImage_0.png

0 Likes
1 Solution

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.

View solution in original post

9 Replies
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

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:

pastedImage_1.png

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.

0 Likes

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.

: It's beacon function. I think it should be advertising with "transmit data per 7s". How can I set?...

0 Likes

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.

0 Likes

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

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

0 Likes

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.

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.

pastedImage_0.png

0 Likes

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. 

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?

0 Likes

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.