Why Scan Window and Scan Interval Params in Connection Request Params

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Why Scan Window and Scan Interval Params in Connection Request Params

跳至解决方案
2,046 次查看
nidhintomy
Contributor IV

Hi

I tested BLE Central with different values in .scanInterval and .scanWindow params of gapConnectionRequestParameters_t structure. And this change value affected connection establishment time.

But this structure is only used after we found a device in Device Discovery Procedure and try to connect to it.

                /* Connect with the previously scanned peer device */
                if (mFoundDeviceToConnect)
                {
                    (void)App_Connect(&gConnReqParams, BleApp_ConnectionCallback);
                }

 

The actual scan window and interval are in gapScanningParameters_t structure. And this is used for scanning.

Then how the .scanInterval and .scanWindow params of gapConnectionRequestParameters_t structure affect scanning?

Thanks in Advance
Nidhin

标签 (1)
  • KW

0 项奖励
回复
1 解答
1,993 次查看
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @nidhintomy ,

We discover devices via scanning, but when the device is found, we need to initiate the connection.

The connection procedure also needs to scan the advertising package first, then initiate the connection request, so gap connection request need the parameters scanInterval and .scanWindow .

Gavin_Jia_0-1685508802901.png

 

Best regards,

Gavin

 

在原帖中查看解决方案

6 回复数
2,025 次查看
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @nidhintomy

Hope you are doing well!

In your case, you found that changing the values of the scan interval and scan window parameters affects the connection establishment time. This is because the connection establishment time is determined by the time it takes for the central device to find the peripheral device and connect to it. Since the scan interval and scan window parameters affect how often the central device scans for advertisement packets, connection establishment time is also somewhat affected.

 

Best regards,

Gavin

0 项奖励
回复
2,009 次查看
nidhintomy
Contributor IV

Hi @Gavin_Jia 

I am fine. Thanks for reply.

Here my question was about importance of setting scan interval and scan window parameters in connection request parameter. We already set scan interval and scan window parameters in scan request parameters. Then why we need to set it again in connection request parameter.

E.g., In frdmkw38_adv_ext_central_bm project/source/app_config.c line no.54&55 set scan interval and scan window parameters in scan request parameters. In line no.64&65 set scan interval and scan window parameters in connection request parameters.

Best Regards,
Nidhin

 

0 项奖励
回复
1,994 次查看
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @nidhintomy ,

We discover devices via scanning, but when the device is found, we need to initiate the connection.

The connection procedure also needs to scan the advertising package first, then initiate the connection request, so gap connection request need the parameters scanInterval and .scanWindow .

Gavin_Jia_0-1685508802901.png

 

Best regards,

Gavin

 

1,979 次查看
nidhintomy
Contributor IV

Hi @Gavin_Jia 

That means if i set .scanInterval and .scanWindow in scan req params as 500ms and set .scanInterval and .scanWindow in connection req params as 1000ms, then the device will scan at 500ms until peripheral device found. After it will scan at 1000ms until device get connected.

So what if the connection failed, is device going to scan at 1000ms ?

Best Regards,
Nidhin

0 项奖励
回复
1,927 次查看
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @nidhintomy ,

If the connection failed, it will scan until connect to the scanned device. So in my opinion, it will be 500ms. And you can test it as well.

 

Best regards,

Gavin

1,912 次查看
nidhintomy
Contributor IV

Hi @Gavin_Jia 

Thanks for your help.

0 项奖励
回复