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.

SIMPLELINK-WIFI-CC3120-SDK-PLUGIN: miss disconnect event

Part Number: SIMPLELINK-WIFI-CC3120-SDK-PLUGIN
Other Parts Discussed in Thread: CC3120

Hi,

I am using simplelink_sdk_wifi_plugin_4_20_00_10 to port sl API in my host to control CC3120.

It looks the sl APIs are working well, can get device information, set to STA role and connect to an AP with sl APIs.

When I test to call sl_WlanConnect() to connect an AP, it can correct to connect the AP and can receive the SL_WLAN_EVENT_CONNECT event in SimpleLinkWlanEventHandler().

But when I try to call sl_WlanDisconnect() to disconnect the AP, looks cc3120 will disconnect from the AP as expect, but the SL_WLAN_EVENT_DISCONNECT is never to receive.

Is there something I missed to configure?   

  • Hi Owen,

    Can you share your SimpleLinkWlanEventHandler? Also be sure you have the latest servicepack flashed to the CC3120 using ImageCreator.

    Best regards,

    Sarah

  • Hi Sarah,

    Thanks for reply.

    Below is my device version information that got with sl_DeviceGet(SL_DEVICE_GENERAL);

    CC3120VerseionInfos: Chip ID=0x31000000
    CC3120VerseionInfos: MAC Version=2.0.0.0
    CC3120VerseionInfos: Phy Version=2.2.0.7
    CC3120VerseionInfos: NWP Version=3.16.0.1
    CC3120VerseionInfos: ROM Version=0x0
    CC3120VerseionInfos: Host Driver Version=3.0.1.65

    My SimpleLinkWlanEventHandler as below:

    void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
    {
    /*    rtems_status_code   sc = RTEMS_SUCCESSFUL ;*/
    
    	if (NULL == pWlanEvent) return;
    
    	printf("\r\n%s: SimpleLinkWlanEventHandler event\r\n", __func__) ;
    
        switch(pWlanEvent->Id)
        {   /* Check event ID */
            case SL_WLAN_EVENT_CONNECT:
            {
                SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION) ;
    
                printf("\r\n%s: STA Connected to the AP: %s, "
                    "BSSID: %x:%x:%x:%x:%x:%x\r\n", __func__,
                    pWlanEvent->Data.Connect.SsidName,
                    pWlanEvent->Data.Connect.Bssid[0],
                    pWlanEvent->Data.Connect.Bssid[1],
                    pWlanEvent->Data.Connect.Bssid[2],
                    pWlanEvent->Data.Connect.Bssid[3],
                    pWlanEvent->Data.Connect.Bssid[4],
                    pWlanEvent->Data.Connect.Bssid[5]) ;
            }
                break ;
    
            case SL_WLAN_EVENT_DISCONNECT:
            {
                SlWlanEventDisconnect_t     *pEventData = NULL ;
    
                printf("\r\n%s: SL_WLAN_EVENT_DISCONNECT event\r\n", __func__) ;
    
                pEventData = &pWlanEvent->Data.Disconnect ;
    
                if (SL_WLAN_DISCONNECT_USER_INITIATED == pEventData->ReasonCode)
                {
                    if (pWlanEvent->Data.Connect.SsidName[0] != 0)
                    {
                        printf("\r\n%s: Device disconnected from the AP: %s  "
                            "BSSID: %x:%x:%x:%x:%x:%x on app's request\r\n",
                            __func__, pWlanEvent->Data.Connect.SsidName,
                            pWlanEvent->Data.Connect.Bssid[0],
                            pWlanEvent->Data.Connect.Bssid[1],
                            pWlanEvent->Data.Connect.Bssid[2],
                            pWlanEvent->Data.Connect.Bssid[3],
                            pWlanEvent->Data.Connect.Bssid[4],
                            pWlanEvent->Data.Connect.Bssid[5]) ;
                    }/* End of if valid SSID */
                    else
                        printf("\r\n%s: Device disconnected from the AP "
                            "on app's request\r\n", __func__) ;
                }
                else
                {
                    if (pWlanEvent->Data.Connect.SsidName != NULL)
                    {   /* Valid SSID */
                        printf("\r\n%s: Device disconnected from the AP: %s  "
                            "BSSID: %x:%x:%x:%x:%x:%x\r\n",
                            __func__, pWlanEvent->Data.Connect.SsidName,
                            pWlanEvent->Data.Connect.Bssid[0],
                            pWlanEvent->Data.Connect.Bssid[1],
                            pWlanEvent->Data.Connect.Bssid[2],
                            pWlanEvent->Data.Connect.Bssid[3],
                            pWlanEvent->Data.Connect.Bssid[4],
                            pWlanEvent->Data.Connect.Bssid[5]) ;
                    }/* End of if valid SSID */
                    else
                        printf("\r\n%s: Device disconnected from the AP\r\n",
                            __func__) ;
                }
            }
                break ;
    
            default:
                printf("%s: Unexpected event [0x%lx]\r\n", __func__,
                    pWlanEvent->Id) ;
                break ;
        }
    }

    Owen

  • Hi Owen,

    I tested the same host driver and servicepack with my own host, and the event triggered as expected. Are you missing any other asynchronous events? Can you try increasing the priority of your sl_Task?

    Best regards,

    Sarah

  • Hi Sarah,

    I tested with sl_WlanConnect(), the event SL_WLAN_EVENT_CONNECT and SL_NETAPP_EVENT_IPV4_ACQUIRED can receive.

    But test with sl_WlanDisconnect(), there is no any expect events about disconnected connection  can receive, likes SL_WLAN_EVENT_DISCONNECT, SL_NETAPP_EVENT_IPV4_LOST, ...

    I run a process to run sl_WlanConnect() and sl_WlanDisconnect() loop testing, only connected event can receive.

    Thanks,

    Owen

  • Hi Owen,

    Can you capture NWP logs? You can find instructions in the NWP Programmer's Guide.

    Also, can you set a breakpoint inside _SlDrvHandleWlanEvents() in source/ti/drivers/net/wifi/source/driver.c?

    Best regards,

    Sarah

  • Hi Sarah,

    The attached is my NWP log. My host control the cc3120 connect and disconnect every 10 seconds.

    cc3120_nwp.log

  • Hi Sarah,

    Please help to analyze the attached log, I added debug print in the _SlDrvClassifyRxMsg() to show the received Opcode.

    host_driver.log
    
    *** below log timestamp format is [hour:minute:second] ***
    
    [0:0:2] _SlDrvClassifyRxMsg: Opcode[0x8], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:2] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:2] _SlDrvClassifyRxMsg: Opcode[0x466], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:2] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:2] CC3120VerseionInfos: Chip ID=0x31000000
    [0:0:2] CC3120VerseionInfos: MAC Version=2.0.0.0
    [0:0:2] CC3120VerseionInfos: Phy Version=2.2.0.6
    [0:0:2] CC3120VerseionInfos: NWP Version=3.10.0.5
    [0:0:2] CC3120VerseionInfos: ROM Version=0x0
    [0:0:2] CC3120VerseionInfos: Host Driver Version=3.0.1.65
    [0:0:2] _SlDrvClassifyRxMsg: Opcode[0x473], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:2] _SlDrvClassifyRxMsg: Opcode[0x73], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:7] wifi_task: connect to AP ...
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0x8], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:7] wifiSta: Start wifi mode=0
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0xc86], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0xc85], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0x432], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0x432], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:7] _SlDrvClassifyRxMsg: Opcode[0xc86], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0xcb5], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0xc86], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x1c34], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0xcb5], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0xcb4], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x473], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x73], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x8], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x464], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:8] wifiSta: Try connect dvtboards(9), key=dvtboards(9), type=2
    [0:0:8] _SlDrvClassifyRxMsg: Opcode[0xc80], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:9] _SlDrvClassifyRxMsg: Opcode[0x880], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:9] _SlDrvHandleWlanEvents: [1]
    [0:0:9] SimpleLinkWlanEventHandler: SimpleLinkWlanEventHandler event
    [0:0:9] SimpleLinkWlanEventHandler: STA Connected to the AP: dvtboards, BSSID: b4:75:e:63:b3:61
    [0:0:9] _SlDrvClassifyRxMsg: Opcode[0x1825], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:9] SimpleLinkNetAppEventHandler: IP Acquired: IP=192.168.60.128, Gateway=192.168.60.1
    [0:0:10] wifiSta: Got connected after 1500 ms.....
    [0:0:10] wifiSta: got ip after 0 ms.....
    [0:0:20] wifi_task: disconnect from AP ...
    [0:0:20] _SlDrvClassifyRxMsg: Opcode[0xc81], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:30] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:30] _SlDrvClassifyRxMsg: Opcode[0x473], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:30] _SlDrvClassifyRxMsg: Opcode[0x73], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:32] wifi_task: connect to AP ...
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0x8], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:32] wifiSta: Start wifi mode=0
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0xc86], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0xc85], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0x432], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0x432], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0xc86], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0xcb5], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0xc86], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0x1c34], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:32] _SlDrvClassifyRxMsg: Opcode[0xcb5], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0xcb4], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0x473], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0x73], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0x8], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0x464], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0x63], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:33] wifiSta: Try connect dvtboards(9), key=dvtboards(9), type=2
    [0:0:33] _SlDrvClassifyRxMsg: Opcode[0xc80], SL_OPCODE_SYNC & Opcode = [1024]
    [0:0:36] _SlDrvClassifyRxMsg: Opcode[0x880], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:36] _SlDrvHandleWlanEvents: [1]
    [0:0:36] SimpleLinkWlanEventHandler: SimpleLinkWlanEventHandler event
    [0:0:36] SimpleLinkWlanEventHandler: STA Connected to the AP: dvtboards, BSSID: b4:75:e:63:b3:61
    [0:0:36] _SlDrvClassifyRxMsg: Opcode[0x1825], SL_OPCODE_SYNC & Opcode = [0]
    [0:0:36] SimpleLinkNetAppEventHandler: IP Acquired: IP=192.168.60.128, Gateway=192.168.60.1
    [0:0:36] wifiSta: Got connected after 3000 ms.....
    [0:0:36] wifiSta: got ip after 0 ms.....
    [0:0:46] wifi_task: disconnect from AP ...
    [0:0:46] _SlDrvClassifyRxMsg: Opcode[0xc81], SL_OPCODE_SYNC & Opcode = [1024]
    
    

    Thanks,

    Owen

  • Hi Sarah,

    It it my fail, my host control was masked the SL_WLAN_EVENT_DISCONNECT event.
    This issue is resolved.

    Thanks,

    Owen