How to run scanning with limited duration only in KW38 BLE

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to run scanning with limited duration only in KW38 BLE

ソリューションへジャンプ
1,090件の閲覧回数
FedericoWegher
Contributor III

Hello.

I am using KW38 BLE with SDK 2.6.6 on both central and peripheral devices. Currently the central is using continuous scan, that is, is calls the following API:

App_StartScanning(&gScanParams, BleApp_ScanningCallback, gGapDuplicateFilteringDisable_c, gGapScanContinuously_d, gGapScanPeriodicDisabled_d);

with

gapScanningParameters_t gScanParams =
{
.type = gScanTypePassive_c,
.interval = 3200,
.window = 1600,
.ownAddressType = gBleAddrTypePublic_c,
.filterPolicy = gScanAll_c,
.scanningPHYs = gLePhy1MFlag_c
};

That is, scan window is 1 second and interval is 2 second. It works fine.

Now my need is to use finite duration for scanning and have it stopped after one period. Ideally, I would like to stop after the scan window is over. I modified the API call this way:

App_StartScanning(&gScanParams, BleApp_ScanningCallback, gGapDuplicateFilteringDisable_c, 100, gGapScanPeriodicDisabled_d);

but the scan never stops. I tried the following values: 100, 101, 200, 201, 1000, always without success.

Please help to make scan periodic.

タグ(3)
0 件の賞賛
返信
1 解決策
1,032件の閲覧回数
anca_codreanu
NXP Employee
NXP Employee

Hi @FedericoWegher ,

Duration and period parameters are not part of the legacy Scan Enable command. They are included only in Extended Scan Enable command.

legacy_scan.PNG

extended.PNG

In our API, they are used only when extended scanning is enabled, otherwise they are ignored.

The support for Bluetooth 5.0 Extended Advertising/Scanning comes in separate host libraries in our SDK. The Bluetooth LE examples from our SDK use the legacy host libraries. To support the extended advertising/scanning, the corresponding host libraries need to be used ( they have _AE_ in their name).

Taking as example the project w_uart from the SDK ( it can be found at the following path sdk_folder\boards\frdmkw38\wireless_examples\bluetooth ), to enable the extended scanning please do the following steps:

  • use lib_ble_5-0_AE_host_cm0p_iar.a instead of lib_ble_5-0_host_cm0p_iar.a

lib.PNG

 

  • add #define gAppExtAdvEnable_d 1 in app_preinclude.h file

 

If you need more details please let us know.

Best regards,

Anca

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,033件の閲覧回数
anca_codreanu
NXP Employee
NXP Employee

Hi @FedericoWegher ,

Duration and period parameters are not part of the legacy Scan Enable command. They are included only in Extended Scan Enable command.

legacy_scan.PNG

extended.PNG

In our API, they are used only when extended scanning is enabled, otherwise they are ignored.

The support for Bluetooth 5.0 Extended Advertising/Scanning comes in separate host libraries in our SDK. The Bluetooth LE examples from our SDK use the legacy host libraries. To support the extended advertising/scanning, the corresponding host libraries need to be used ( they have _AE_ in their name).

Taking as example the project w_uart from the SDK ( it can be found at the following path sdk_folder\boards\frdmkw38\wireless_examples\bluetooth ), to enable the extended scanning please do the following steps:

  • use lib_ble_5-0_AE_host_cm0p_iar.a instead of lib_ble_5-0_host_cm0p_iar.a

lib.PNG

 

  • add #define gAppExtAdvEnable_d 1 in app_preinclude.h file

 

If you need more details please let us know.

Best regards,

Anca

0 件の賞賛
返信