This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220MODA: How to remove non-existent AP from sl_WlanGetNetworkList()

Part Number: CC3220MODA
Other Parts Discussed in Thread: CC3220MOD, CC3200, CC3100, CC3220SF

Hi,

My customer uses CC3220MOD and found unexpected behavior of sl_WlanGetNetworkList().

Let’s say there are 3 APs in the area. All APs are now ON (active).
So sl_WlanGetNetworkList() returns a list with these 3 APs. It’s fine.
Then one AP is turned off, but sl_WlanGetNetworkList() still returns the list with all 3 APs.
Customer expects one AP is removed from the list then it should be 2 APs.
Note that sl_WlanPolicySet() is called just before sl_WlanGetNetworkList(), so active scan should be done to update the list.

The code sequence is below;
─────────────────────────────────────
policyOpt = SL_CONNECTION_POLICY(0, 0, 0, 0, 0);
lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION , policyOpt, NULL, 0);
ASSERT_ON_ERROR(lRetVal);

policyOpt = SL_SCAN_POLICY(1);
lRetVal = sl_WlanPolicySet(SL_POLICY_SCAN , policyOpt,
           (unsigned char *)(IntervalVal), sizeof(IntervalVal));
ASSERT_ON_ERROR(lRetVal);

Task_sleep(1000);

listnum = sl_WlanGetNetworkList(index, numOfEntries, netEntries);
ASSERT_ON_ERROR(listnum);

policyOpt = SL_SCAN_POLICY(0);
sl_WlanPolicySet(SL_POLICY_SCAN , policyOpt,
                  (unsigned char *)(IntervalVal), sizeof(IntervalVal));
ASSERT_ON_ERROR(lRetVal);
─────────────────────────────────────

In case 2 APs are active at first, then the 3rd AP is newly activated, sl_WlanGetNetworkList() is properly updated from 2 to 3.
What needs to be done to remove the AP from the list?

Thanks and regards,
KoT

  • KoT,

    Is the variable for the list being deleted before rescanning? the list could be holding onto the old values.

    VR
  • Hi VR,

    Thanks for your reply.
    Could you tell me how to delete the variable for the list ?
    Is there specific API for this purpose?

    Thanks and regards,
    KoT

  • Hi,

    I think important what number of networks is returned at listnum variable. You need read only number of entries which are returned by sl_WlanGetNetworkList(), because rest can be garbage or old values.

    BTW ... why in code is used set scan policy? This code comes from previous generation - CC3100/CC3200. With CC3220 should be enough call only sl_WlanGetNetworkList(). Please see www.ti.com/.../swru455 at chapter 3.7.2 (one-shot scan).

    Jan
  • Hi Jan,

    The listnum variable itself is not update either.

    Customer tested below sequence.
    Let’s say there are AP1, AP2, AP3 and AP4.
    AP1, AP2 and AP3 are ON. AP4 is OFF.

    At start-up the list table is taken first time.
    ────────
    listnum : 3
    APList :
    AP1
    AP2
    AP3
    ────────

    Then, AP2 is turned OFF.
    After a few minutes, the list table is taken again.
    ────────
    listnum : 3 <== listnum is still ‘3’
    APList :
    AP1
    AP2 <== AP2 is still here
    AP3
    ────────

    Then AP4 is turned ON. AP2 remains OFF.
    ────────
    listnum : 4 <== now listnum is ‘4’
    APList :
    AP1
    AP2 <== AP2 is still here
    AP3
    AP4 <== AP4 is added
    ────────

    Customer uses CC3200 SDK on CC3220, because http_client demo does not included in CC3220 SDK.
    This is why the code uses set scan policy.

    Thanks and regards,
    KoT

     

  • One correction: Customer ported CC3200 example to CC3220, so they use CC3220 SDK.

    According to API user’s guide, sl_WlanGetNetworkList does not initiate an active scan, so I thought sl_WlanPolicySet is needed to initiate another scan.

    Thanks and regards,
    KoT

  • Hi KoT,

    Now is question of your customer much clearer. I haven't experienced similar type of issue at CC3220. Can your customer reproduce issue with network_terminal demo in SDK.

    Maybe your customer should look how is scanning implemented in network_terminal demo (function cmdScanCallback in wlan_cmd.c).

    ... but maybe someone from App team have any idea

    Jan
  • KoT,

    I agree with Hnz.

    We would need to see how you setting up your scan and how you are saving the values for it. You can look at the network terminal example in the CC3220 SDK and see how scanning is implemented there. I would suggest using what you find there.

    VR
  • Hi,

    I found below code in cmdScanCallback.
    Is this the code clearing an old entries ?

        /* Clear the results buffer */
        memset(&app_CB.gDataBuffer, 0x0, sizeof(app_CB.gDataBuffer));


    Thanks and regards,
    KoT

  • Yes I would assume so. It is setting the memory at gDataBuffer address to zeroes.

    Did this work for you?

    Regards,

    VR

  • Hi VR, Jan,

    I tried network terminal demo and found below results.

    a) If the “scan” command (ex. “scan –n 30”) is used repeatedly, an old entry remains in the list even after the AP is actually OFF.
    b) If a new AP is turned ON during a) process, the AP list is updated and the new AP is added to the list.
    c) After “setpolicy” command (ex. “setpolicy –i 10”) is used, the AP list seems to be updated based on interval (10 second in this case).

    Please see the log. “tested AP” is the AP which is manually turned ON and OFF.

            ============================================
               Network Terminal Example Ver: 1.0.1.0
            ============================================
    
             CHIP: 0x31000019
             MAC:  2.0.0.0
             PHY:  2.2.0.5
             NWP:  3.5.0.0
             ROM:  0
             HOST: 2.0.1.26
             MAC address: d4:36:39:8b:91:8c
    
            ============================================
    
    ================================================================================
    Available commands:
    
    help                scan                setpolicy           wlanconnect
    wlan_ap_start       wlan_ap_stop        wlandisconnect      connected_stations
    ping                send                recv                createfilter
    enablefilter        disablefilter       deletefilter        enablewowlan
    mdnsadvertise       mdnsquery           radiotool           p2pstart
    p2pstop             clear
    
    ================================================================================
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    /* test AP is ON here */
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -81   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -81   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -82   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -81   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -81   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -82   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -81   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -81   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -82   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    /* test AP is OFF here */
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -82   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -83   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -82   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -82   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -83   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -82   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -82   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -83   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -82   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -80   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
     4  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -80   | 1  | NO     | WPA2     |
     5  | net4guest                        | ac:a3:1e:fd:eb:82 | -80   | 1  | NO     | WPA2     |
     6  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -83   | 11 | NO     | WPA2     |
     7  | net4guest                        | ac:a3:1e:fd:ed:c2 | -84   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -83   | 11 | NO     | WPA2     |
     9  | externalhotspot84                | ac:a3:1e:fd:ed:c1 | -83   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:setpolicy -i 10
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -81   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -81   | 1  | NO     | WPA2     |
     3  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -81   | 1  | NO     | WPA2     |
     4  | net4guest                        | ac:a3:1e:fd:eb:82 | -81   | 1  | NO     | WPA2     |
     5  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -83   | 11 | NO     | WPA2     |
     6  | net4guest                        | ac:a3:1e:fd:ed:c2 | -82   | 11 | NO     | WPA2     |
     7  | cpn84                            | ac:a3:1e:fd:ed:c3 | -83   | 11 | NO     | WPA2     |
     8  | externalhotspot84                | ac:a3:1e:fd:ed:c1 | -83   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    /* test AP is ON here */
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -80   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -80   | 1  | NO     | WPA2     |
     3  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -80   | 1  | NO     | WPA2     |
     4  | net4guest                        | ac:a3:1e:fd:eb:82 | -80   | 1  | NO     | WPA2     |
     5  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -82   | 11 | NO     | WPA2     |
     6  | net4guest                        | ac:a3:1e:fd:ed:c2 | -82   | 11 | NO     | WPA2     |
     7  | externalhotspot84                | ac:a3:1e:fd:ed:c1 | -82   | 11 | NO     | WPA2     |
     8  | cpn84                            | ac:a3:1e:fd:ed:c3 | -81   | 11 | NO     | WPA2     |
     9  | tested AP                        | aa:be:27:7c:32:2d | -35   | 1  | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    /* test AP is OFF here */
    user:scan -n 30
    ---------------------------------------------------------------------------------------------
        |               SSID               |       BSSID       | RSSI  | Ch | Hidden | Security |
    ---------------------------------------------------------------------------------------------
     1  | halekoa75                        | ac:a3:1e:fd:eb:80 | -79   | 1  | NO     | WPA2     |
     2  | cpn84                            | ac:a3:1e:fd:eb:83 | -79   | 1  | NO     | WPA2     |
     3  | externalhotspot84                | ac:a3:1e:fd:eb:81 | -80   | 1  | NO     | WPA2     |
     4  | net4guest                        | ac:a3:1e:fd:eb:82 | -80   | 1  | NO     | WPA2     |
     5  | halekoa75                        | ac:a3:1e:fd:ed:c0 | -84   | 11 | NO     | WPA2     |
     6  | net4guest                        | ac:a3:1e:fd:ed:c2 | -84   | 11 | NO     | WPA2     |
    ---------------------------------------------------------------------------------------------
    
    user:

    I added comments between /* and */ to show AP ON/OFF timing.
    Each “scan” command are issued ~30 seconds in between.

    According to Network Terminal demo document, Scan command supports two modes (“one shot” and “background”).
    C:\ti\simplelink_cc32xx_sdk_1_60_00_04\examples\rtos\CC3220SF_LAUNCHXL\demos\network_terminal\README.html

    I understood, “one shot” is used during a) and b). Then mode is changed to “background” in c). This is why table is updated properly.
    But it is not clear for me why a new AP is detected during “one shot” operation. Is this expected behavior?

    Thanks and regards,
    KoT

  • KoT,

    Yes this is expected Behavior. When using one shot mode, you will cal lsl_getNetworkEntries() to start the scan, then call sl_getNetworkEntries() to get the entries.

    In the network terminal example, when you do a one shot it does these two steps, and thus will return the APs it  sees during that scan.

    Please see below code snippet from the Network Terminal example in the wlan_cmd.c

  • Hi VR,

    So sl_getNetworkEntries() is called twice and AP list is updated at the second call in one shot mode.
    I think this is the case in “network_terminal_log.txt” line#52 to line#72.
    (please refer to the log I attached previous post)
    AP list is updated and “tested AP” (and other APs) are added.

    But at line#101 and after, AP list does not seem to be updated.
    The list is the same. Why?

    Thanks and regards,
    KoT