Why Scan Window and Scan Interval Params in Connection Request Params

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why Scan Window and Scan Interval Params in Connection Request Params

Jump to solution
1,908 Views
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

Labels (1)
  • KW

0 Kudos
Reply
1 Solution
1,855 Views
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

 

View solution in original post

6 Replies
1,887 Views
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 Kudos
Reply
1,871 Views
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 Kudos
Reply
1,856 Views
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,841 Views
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 Kudos
Reply
1,789 Views
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,774 Views
nidhintomy
Contributor IV

Hi @Gavin_Jia 

Thanks for your help.

0 Kudos
Reply