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.

  • Resolved

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

Prodigy 60 points

Replies: 8

Views: 144

Part Number: SIMPLELINK-WIFI-CC3120-SDK-PLUGIN

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

  • In reply to Sarah P:

    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

  • In reply to Owen CyberTAN:

    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

  • In reply to Sarah P:

    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

  • In reply to Owen CyberTAN:

    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

  • In reply to Sarah P:

    Hi Sarah,

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

    cc3120_nwp.log

  • In reply to Owen CyberTAN:

    Hi Sarah,

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

    host_driver.log

    Thanks,

    Owen

  • In reply to Owen CyberTAN:

    Hi Sarah,

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

    Thanks,

    Owen

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.