Passive scanning returns matches for channels that are not enabled (ch 1 specifically)

Hi,

I am using passing scanning to scan for APs and forward the data upstream. The scan channels are configurable, and I am noticing when we enable only 5GHz channels (36,40,44,48), I am seeing a couple of channel 1 matches and I cant explain why.

Channels are enabled via “wifi_set_pscan_chan” and then scanning is started with “wifi_scan(RTW_SCAN_TYPE_PASSIVE, RTW_BSS_TYPE_ANY, &scan_buf)”.

It does not happen every time. If present, channel 1 matches are always returned in the beginning of the results, maybe that can help explain why this is the case.

We can ignore matches on channels we did not enable, but this is extra CPU processing. I wanted to see if this has happened to others and how was it fixed? Or, is it a SDK bug of some sort?..

Here is a firmware log showing results for channel 1 when it is not supposed to be enabled:
(I am confident channel 1 was never enabled in “wifi_set_pscan_chan” call)

"2025-02-12 18:48:45:638",[0000000000292] af_wifi__scan_passive: starting passive scan 1/1

"2025-02-12 18:48:45:638",[0000000000298] af_wifi__scan_set_channels: enabling Wi-Fi channels: 36,40,44,48

"2025-02-12 18:48:45:638",[0000000000305] af_wifi__scan_set_channels: successfully configured Wi-Fi channels! channel_setting=0x1

"2025-02-12 18:48:46:413",[0000000000751] af_wifi__event_hdl: Wi-Fi event: WIFI_EVENT_SCAN_DONE

"2025-02-12 18:48:46:413",[0000000000767] af_wifi__scan_passive: Wi-Fi scanning success! Scan count = 1, results = 57

"2025-02-12 18:48:46:763",[0000000001358] af_wifi__scan_passive: Final/filtered Passive Scan Count = 55

"2025-02-12 18:48:46:764",[0000000001365] af_wifi__scan_list_print: [00] rssi=-57, ch=001, mac=5C:5B:35:01:B6:F1

"2025-02-12 18:48:46:764",[0000000001373] af_wifi__scan_list_print: [01] rssi=-42, ch=001, mac=48:B4:C3:B3:C9:E2

"2025-02-12 18:48:46:764",[0000000001380] af_wifi__scan_list_print: [02] rssi=-43, ch=001, mac=48:B4:C3:B3:C9:E3

"2025-02-12 18:48:46:764",[0000000001388] af_wifi__scan_list_print: [03] rssi=-33, ch=036, mac=F6:55:2D:C0:32:4E

"2025-02-12 18:48:46:764",[0000000001396] af_wifi__scan_list_print: [04] rssi=-63, ch=036, mac=3A:22:E2:A3:E1:07

"2025-02-12 18:48:46:764",[0000000001403] af_wifi__scan_list_print: [05] rssi=-32, ch=036, mac=CE:55:2D:C0:32:4E

"2025-02-12 18:48:46:765",[0000000001411] af_wifi__scan_list_print: [06] rssi=-77, ch=036, mac=A0:3D:6F:53:D7:7B

"2025-02-12 18:48:46:765",[0000000001419] af_wifi__scan_list_print: [07] rssi=-70, ch=036, mac=C8:78:67:17:84:51

"2025-02-12 18:48:46:765",[0000000001427] af_wifi__scan_list_print: [08] rssi=-70, ch=036, mac=C8:78:67:17:84:52

"2025-02-12 18:48:46:765",[0000000001434] af_wifi__scan_list_print: [09] rssi=-70, ch=036, mac=C8:78:67:17:84:53

"2025-02-12 18:48:46:765",[0000000001442] af_wifi__scan_list_print: [10] rssi=-55, ch=036, mac=A0:3D:6F:63:56:B1

"2025-02-12 18:48:47:102",[0000000001450] af_wifi__scan_list_print: [11] rssi=-48, ch=036, mac=48:B4:C3:B3:C9:F0

"2025-02-12 18:48:47:102",[0000000001458] af_wifi__scan_list_print: [12] rssi=-49, ch=036, mac=48:B4:C3:B3:C9:F1

"2025-02-12 18:48:47:102",[0000000001465] af_wifi__scan_list_print: [13] rssi=-48, ch=036, mac=48:B4:C3:B3:C9:F2

"2025-02-12 18:48:47:105",[0000000001473] af_wifi__scan_list_print: [14] rssi=-49, ch=036, mac=48:B4:C3:B3:C9:F3

"2025-02-12 18:48:47:105",[0000000001481] af_wifi__scan_list_print: [15] rssi=-47, ch=036, mac=48:B4:C3:B3:C9:F4

"2025-02-12 18:48:47:105",[0000000001488] af_wifi__scan_list_print: [16] rssi=-48, ch=036, mac=48:B4:C3:B3:C9:F5

"2025-02-12 18:48:47:106",[0000000001496] af_wifi__scan_list_print: [17] rssi=-48, ch=036, mac=48:B4:C3:B3:C9:F6

"2025-02-12 18:48:47:106",[0000000001504] af_wifi__scan_list_print: [18] rssi=-60, ch=036, mac=C8:78:67:17:FC:12

"2025-02-12 18:48:47:106",[0000000001512] af_wifi__scan_list_print: [19] rssi=-55, ch=036, mac=A0:3D:6F:63:56:BB

"2025-02-12 18:48:47:106",[0000000001519] af_wifi__scan_list_print: [20] rssi=-78, ch=036, mac=A0:3D:6F:53:D7:71

"2025-02-12 18:48:47:106",[0000000001527] af_wifi__scan_list_print: [21] rssi=-58, ch=036, mac=00:3E:73:DB:E0:E5

"2025-02-12 18:48:47:106",[0000000001535] af_wifi__scan_list_print: [22] rssi=-58, ch=036, mac=00:3E:73:DB:E0:E7

"2025-02-12 18:48:47:107",[0000000001542] af_wifi__scan_list_print: [23] rssi=-58, ch=036, mac=00:3E:73:DB:E0:E8

"2025-02-12 18:48:47:107",[0000000001550] af_wifi__scan_list_print: [24] rssi=-69, ch=040, mac=8E:18:98:43:C0:B3

"2025-02-12 18:48:47:107",[0000000001558] af_wifi__scan_list_print: [25] rssi=-69, ch=040, mac=B6:18:98:43:C0:B3

"2025-02-12 18:48:47:107",[0000000001566] af_wifi__scan_list_print: [26] rssi=-69, ch=040, mac=A6:18:98:43:C0:B3

"2025-02-12 18:48:47:107",[0000000001573] af_wifi__scan_list_print: [27] rssi=-59, ch=040, mac=8C:79:09:F4:18:70

"2025-02-12 18:48:47:107",[0000000001581] af_wifi__scan_list_print: [28] rssi=-59, ch=040, mac=8C:79:09:F4:18:71

"2025-02-12 18:48:47:107",[0000000001589] af_wifi__scan_list_print: [29] rssi=-46, ch=040, mac=5C:5B:35:01:F3:01

"2025-02-12 18:48:47:107",[0000000001597] af_wifi__scan_list_print: [30] rssi=-46, ch=040, mac=5C:5B:35:01:F3:03

"2025-02-12 18:48:47:107",[0000000001604] af_wifi__scan_list_print: [31] rssi=-46, ch=040, mac=5C:5B:35:01:F3:04

"2025-02-12 18:48:47:107",[0000000001612] af_wifi__scan_list_print: [32] rssi=-80, ch=044, mac=FE:9E:38:D6:F5:F3

"2025-02-12 18:48:47:107",[0000000001620] af_wifi__scan_list_print: [33] rssi=-58, ch=044, mac=1A:8D:CB:65:AF:0F

"2025-02-12 18:48:47:107",[0000000001627] af_wifi__scan_list_print: [34] rssi=-58, ch=044, mac=22:8D:CB:65:AF:0F

"2025-02-12 18:48:47:107",[0000000001635] af_wifi__scan_list_print: [35] rssi=-26, ch=044, mac=40:3F:8C:FE:B9:82

"2025-02-12 18:48:47:108",[0000000001643] af_wifi__scan_list_print: [36] rssi=-26, ch=044, mac=B2:3F:8C:FE:B9:84

"2025-02-12 18:48:47:108",[0000000001651] af_wifi__scan_list_print: [37] rssi=-64, ch=044, mac=D4:20:B0:04:8C:C1

"2025-02-12 18:48:47:108",[0000000001658] af_wifi__scan_list_print: [38] rssi=-64, ch=044, mac=D4:20:B0:04:8C:C2

"2025-02-12 18:48:47:108",[0000000001666] af_wifi__scan_list_print: [39] rssi=-64, ch=044, mac=D4:20:B0:04:8C:C3

"2025-02-12 18:48:47:108",[0000000001674] af_wifi__scan_list_print: [40] rssi=-58, ch=044, mac=32:8D:CB:65:AF:0F

"2025-02-12 18:48:47:108",[0000000001682] af_wifi__scan_list_print: [41] rssi=-52, ch=044, mac=5C:5B:35:01:B7:01

"2025-02-12 18:48:47:108",[0000000001689] af_wifi__scan_list_print: [42] rssi=-52, ch=044, mac=5C:5B:35:01:B7:03

"2025-02-12 18:48:47:109",[0000000001697] af_wifi__scan_list_print: [43] rssi=-53, ch=044, mac=5C:5B:35:01:B7:04

"2025-02-12 18:48:47:109",[0000000001705] af_wifi__scan_list_print: [44] rssi=-58, ch=048, mac=9E:15:54:AC:46:50

"2025-02-12 18:48:47:109",[0000000001713] af_wifi__scan_list_print: [45] rssi=-58, ch=048, mac=A6:15:54:AC:46:50

"2025-02-12 18:48:47:109",[0000000001720] af_wifi__scan_list_print: [46] rssi=-65, ch=048, mac=5C:5B:35:01:CD:E1

"2025-02-12 18:48:47:109",[0000000001728] af_wifi__scan_list_print: [47] rssi=-65, ch=048, mac=5C:5B:35:01:CD:E2

"2025-02-12 18:48:47:109",[0000000001736] af_wifi__scan_list_print: [48] rssi=-65, ch=048, mac=5C:5B:35:01:CD:E3

"2025-02-12 18:48:47:109",[0000000001743] af_wifi__scan_list_print: [49] rssi=-58, ch=048, mac=B6:15:54:AC:46:50

"2025-02-12 18:48:47:111",[0000000001751] af_wifi__scan_list_print: [50] rssi=-65, ch=048, mac=D4:20:B0:04:8C:F1

"2025-02-12 18:48:47:111",[0000000001759] af_wifi__scan_list_print: [51] rssi=-65, ch=048, mac=D4:20:B0:04:8C:F2

"2025-02-12 18:48:47:111",[0000000001767] af_wifi__scan_list_print: [52] rssi=-65, ch=048, mac=D4:20:B0:04:8C:F3

"2025-02-12 18:48:47:111",[0000000001774] af_wifi__scan_list_print: [53] rssi=-78, ch=048, mac=8C:79:09:F4:23:F0

"2025-02-12 18:48:47:111",[0000000001782] af_wifi__scan_list_print: [54] rssi=-77, ch=048, mac=8C:79:09:F4:23:F1

Here is a log where ch1 was not returned which is what we expect to see on every scan:

"2025-02-12 18:49:56:448",[0000000000284] af_wifi__scan_passive: START Passive Scan, wrxs_passive_scan_threshold == 80

"2025-02-12 18:49:56:449",[0000000000292] af_wifi__scan_passive: starting passive scan 1/1

"2025-02-12 18:49:56:449",[0000000000298] af_wifi__scan_set_channels: enabling Wi-Fi channels: 36,40,44,48

"2025-02-12 18:49:56:449",[0000000000305] af_wifi__scan_set_channels: successfully configured Wi-Fi channels! channel_setting=0x1

"2025-02-12 18:49:57:224",[0000000000751] af_wifi__event_hdl: Wi-Fi event: WIFI_EVENT_SCAN_DONE

"2025-02-12 18:49:57:224",[0000000000767] af_wifi__scan_passive: Wi-Fi scanning success! Scan count = 1, results = 41

"2025-02-12 18:49:57:571",[0000000001202] af_wifi__scan_passive: Final/filtered Passive Scan Count = 40

"2025-02-12 18:49:57:571",[0000000001209] af_wifi__scan_list_print: [00] rssi=-33, ch=036, mac=F6:55:2D:C0:32:4E

"2025-02-12 18:49:57:571",[0000000001216] af_wifi__scan_list_print: [01] rssi=-32, ch=036, mac=CE:55:2D:C0:32:4E

"2025-02-12 18:49:57:571",[0000000001224] af_wifi__scan_list_print: [02] rssi=-69, ch=036, mac=3A:22:E2:A3:E1:07

"2025-02-12 18:49:57:571",[0000000001232] af_wifi__scan_list_print: [03] rssi=-50, ch=036, mac=48:B4:C3:B3:C9:F2

"2025-02-12 18:49:57:572",[0000000001240] af_wifi__scan_list_print: [04] rssi=-32, ch=036, mac=DE:55:2D:C0:32:4E

"2025-02-12 18:49:57:572",[0000000001247] af_wifi__scan_list_print: [05] rssi=-55, ch=036, mac=00:3E:73:DB:E0:E5

"2025-02-12 18:49:57:572",[0000000001255] af_wifi__scan_list_print: [06] rssi=-56, ch=036, mac=00:3E:73:DB:E0:E7

"2025-02-12 18:49:57:572",[0000000001263] af_wifi__scan_list_print: [07] rssi=-56, ch=036, mac=00:3E:73:DB:E0:E8

"2025-02-12 18:49:57:572",[0000000001271] af_wifi__scan_list_print: [08] rssi=-72, ch=036, mac=C8:78:67:17:84:51

"2025-02-12 18:49:57:572",[0000000001278] af_wifi__scan_list_print: [09] rssi=-72, ch=036, mac=C8:78:67:17:84:52

"2025-02-12 18:49:57:573",[0000000001286] af_wifi__scan_list_print: [10] rssi=-72, ch=036, mac=C8:78:67:17:84:53

"2025-02-12 18:49:57:573",[0000000001294] af_wifi__scan_list_print: [11] rssi=-69, ch=040, mac=8E:18:98:43:C0:B3

"2025-02-12 18:49:57:573",[0000000001301] af_wifi__scan_list_print: [12] rssi=-70, ch=040, mac=B6:18:98:43:C0:B3

"2025-02-12 18:49:57:573",[0000000001309] af_wifi__scan_list_print: [13] rssi=-48, ch=040, mac=5C:5B:35:01:F3:01

"2025-02-12 18:49:57:573",[0000000001317] af_wifi__scan_list_print: [14] rssi=-48, ch=040, mac=5C:5B:35:01:F3:03

"2025-02-12 18:49:57:573",[0000000001325] af_wifi__scan_list_print: [15] rssi=-48, ch=040, mac=5C:5B:35:01:F3:04

"2025-02-12 18:49:57:573",[0000000001332] af_wifi__scan_list_print: [16] rssi=-70, ch=040, mac=A6:18:98:43:C0:B3

"2025-02-12 18:49:57:574",[0000000001340] af_wifi__scan_list_print: [17] rssi=-59, ch=040, mac=8C:79:09:F4:18:70

"2025-02-12 18:49:57:574",[0000000001348] af_wifi__scan_list_print: [18] rssi=-59, ch=040, mac=8C:79:09:F4:18:71

"2025-02-12 18:49:57:574",[0000000001356] af_wifi__scan_list_print: [19] rssi=-63, ch=044, mac=D4:20:B0:04:8C:C1

"2025-02-12 18:49:57:574",[0000000001363] af_wifi__scan_list_print: [20] rssi=-64, ch=044, mac=D4:20:B0:04:8C:C2

"2025-02-12 18:49:57:574",[0000000001371] af_wifi__scan_list_print: [21] rssi=-64, ch=044, mac=D4:20:B0:04:8C:C3

"2025-02-12 18:49:57:574",[0000000001379] af_wifi__scan_list_print: [22] rssi=-62, ch=044, mac=1A:8D:CB:65:AF:0F

"2025-02-12 18:49:57:575",[0000000001386] af_wifi__scan_list_print: [23] rssi=-62, ch=044, mac=22:8D:CB:65:AF:0F

"2025-02-12 18:49:57:575",[0000000001394] af_wifi__scan_list_print: [24] rssi=-80, ch=044, mac=F2:9E:38:D6:F5:F3

"2025-02-12 18:49:57:575",[0000000001402] af_wifi__scan_list_print: [25] rssi=-62, ch=044, mac=32:8D:CB:65:AF:0F

"2025-02-12 18:49:57:575",[0000000001410] af_wifi__scan_list_print: [26] rssi=-57, ch=044, mac=5C:5B:35:01:B7:01

"2025-02-12 18:49:57:575",[0000000001417] af_wifi__scan_list_print: [27] rssi=-57, ch=044, mac=5C:5B:35:01:B7:03

"2025-02-12 18:49:57:575",[0000000001425] af_wifi__scan_list_print: [28] rssi=-58, ch=044, mac=5C:5B:35:01:B7:04

"2025-02-12 18:49:57:575",[0000000001433] af_wifi__scan_list_print: [29] rssi=-57, ch=048, mac=9E:15:54:AC:46:50

"2025-02-12 18:49:57:576",[0000000001440] af_wifi__scan_list_print: [30] rssi=-57, ch=048, mac=A6:15:54:AC:46:50

"2025-02-12 18:49:57:576",[0000000001448] af_wifi__scan_list_print: [31] rssi=-77, ch=048, mac=8C:79:09:F4:23:F0

"2025-02-12 18:49:57:676",[0000000001456] af_wifi__scan_list_print: [32] rssi=-78, ch=048, mac=8C:79:09:F4:23:F1

"2025-02-12 18:49:57:676",[0000000001464] af_wifi__scan_list_print: [33] rssi=-68, ch=048, mac=5C:5B:35:01:CD:E1

"2025-02-12 18:49:57:676",[0000000001471] af_wifi__scan_list_print: [34] rssi=-68, ch=048, mac=5C:5B:35:01:CD:E2

"2025-02-12 18:49:57:676",[0000000001479] af_wifi__scan_list_print: [35] rssi=-69, ch=048, mac=5C:5B:35:01:CD:E3

"2025-02-12 18:49:57:676",[0000000001487] af_wifi__scan_list_print: [36] rssi=-57, ch=048, mac=B6:15:54:AC:46:50

"2025-02-12 18:49:57:676",[0000000001495] af_wifi__scan_list_print: [37] rssi=-61, ch=048, mac=D4:20:B0:04:8C:F1

"2025-02-12 18:49:57:677",[0000000001502] af_wifi__scan_list_print: [38] rssi=-61, ch=048, mac=D4:20:B0:04:8C:F2

"2025-02-12 18:49:57:677",[0000000001510] af_wifi__scan_list_print: [39] rssi=-62, ch=048, mac=D4:20:B0:04:8C:F3

which SDK you are using?
if it is freertos SDK, refer to GitHub - Ameba-AIoT/ameba-rtos-d: AmebaD SoC SDK

we are using SDK from this link:
Standard SDK – Realtek IoT/Wi-Fi MCU Solutions

and this actual SDK link is:
GitHub - ambiot/ambd_sdk: Release SDK for AmebaD

How is your link different than above? is this a newer version or has patches of some sort?