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.

CC3000 problem in connecting to WAP2 AP

Other Parts Discussed in Thread: TM4C1230H6PM

Hi,,

I am using the TM4C1230H6PM & Basic wifi application, I have Dlink router as AP.

The CC3000 will get connected to AP by using smart_config application, when security is disable.

But If i enable security WPA2 its not getting connected.

I have updated the firmware patch to 1.24 in CC3000.

Can you tell me what could be issue and how to over come this problem.


Also when check the key option in my android phone, START button gets disabled.

Regards,

Kiran Neve.

  • Can you paste the code you are using to connect?

  • Hi Ivor,

    I am using the smart config application to connect.

    here is the wlan_smart_config_process().

    long wlan_smart_config_process()
    #endif /* __ENABLE_MULTITHREADED_SUPPORT__ */
    {
        signed long returnValue;
        unsigned long ssidLen, keyLen;
        unsigned char *decKeyPtr;
        unsigned char *ssidPtr;

        // read the key from EEPROM - fileID 12
        returnValue = c_aes_read_key(key);

         if (returnValue != 0)
            return returnValue;

        // read the received data from fileID #13 and parse it according to the followings:
        // 1) SSID LEN - not encrypted
        // 2) SSID - not encrypted
        // 3) KEY LEN - not encrypted. always 32 bytes long
        // 4) Security type - not encrypted
        // 5) KEY - encrypted together with true key length as the first byte in KEY
        //   to elaborate, there are two corner cases:
        //      1) the KEY is 32 bytes long. In this case, the first byte does not represent KEY length
        //      2) the KEY is 31 bytes long. In this case, the first byte represent KEY length and equals 31
        returnValue = c_nvmem_read(NVMEM_SHARED_MEM_FILEID, SMART_CONFIG_PROFILE_SIZE, 0, profileArray);
        if (returnValue != 0)
            return returnValue;

        ssidPtr = &profileArray[1];

        ssidLen = profileArray[0];

        decKeyPtr = &profileArray[profileArray[0] + 3];

        c_aes_decrypt(decKeyPtr, key);
        if (profileArray[profileArray[0] + 1] > 16)
            c_aes_decrypt((unsigned char *)(decKeyPtr + 16), key);

        if (*(unsigned char *)(decKeyPtr +31) != 0)
        {
            if (*decKeyPtr == 31)
            {
                keyLen = 31;
                decKeyPtr++;
            }
            else
            {
                keyLen = 32;
            }
        }
        else
        {
            keyLen = *decKeyPtr;
            decKeyPtr++;
        }

        // add a profile
         switch (profileArray[profileArray[0] + 2])
         {
            case WLAN_SEC_UNSEC://None
            {
                returnValue = c_wlan_add_profile(profileArray[profileArray[0] + 2],     // security type
                                                 ssidPtr,                               // SSID
                                                 ssidLen,                               // SSID length
                                                 NULL,                                  // BSSID
                                                 1,                                     // Priority
                                                 0, 0, 0, 0, 0);

                break;
            }

            case WLAN_SEC_WEP://WEP
            {
                returnValue = c_wlan_add_profile(profileArray[profileArray[0] + 2],     // security type
                                                 ssidPtr,                               // SSID
                                                 ssidLen,                               // SSID length
                                                 NULL,                                  // BSSID
                                                 1,                                     // Priority
                                                 keyLen,                                // KEY length
                                                 0,                                     // KEY index
                                                 0,
                                                 decKeyPtr,                             // KEY
                                                 0);

                break;
            }

            case WLAN_SEC_WPA://WPA
                  case WLAN_SEC_WPA2://WPA2
                  {
                    returnValue = wlan_add_profile(WLAN_SEC_WPA2,     // security type
                                                     ssidPtr,
                                                     ssidLen,
                                                     NULL,                                  // BSSID
                                                     1,                                     // Priority
                                                     0x18,                                  // PairwiseCipher
                                                     0x1e,                                  // GroupCipher
                                                     2,                                     // KEY management
                                                     decKeyPtr,                             // KEY
                                                     keyLen);                               // KEY length

                break;
            }
         }

         return returnValue;
    }

    I have written a state machine in the main as follow

    switch(wifiAppState){
                case WIFI_DRIVER_INIT:
                    // Initialize all board specific components.
                    blink = false;
                    g_ui32CC3000DHCP = 0;
                    g_ui32CC3000Connected = 0;
                    g_ui32Socket = SENTINEL_EMPTY;
                    g_ui32BindFlag = SENTINEL_EMPTY;
                    g_ui32SmartConfigFinished = 0;
                    initDriver();
                    wifiAppState = WIFI_SSID_ASSOC;
                    break;

                case WIFI_SSID_ASSOC:
                    //wait to Associate with AP whose SSID is stored in CC3000 (using previous smart config)
                    //if no AP stored start smartconfig with desired AP

                    //blink LED upto device gets associated to the AP
                    if(ui32Loop > 20000){
                        ui32Loop = 0;
                        blink = !blink;
                    }
                    if(blink){
                        MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0x00);
                    } else {
                        MAP_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3);
                    }
                    ui32Loop++;
                    //END : blink LED upto device gets associated to the AP

                    if(Rx0Count < 12){
                        if((g_ui32CC3000DHCP == 1) && (g_ui32CC3000Connected == 1)){
                            wifiAppState = WIFI_SERVER_INIT;
                        }
                    }
                    u0_cInput[11] = 0;
                    if(! strcmp(u0_cInput,"smartconfig")){
                        StartSmartConfig();
                        memset(u0_cInput, 0, sizeof(u0_cInput));
                        Rx0Count= 0;
                    }

                    // After Complete smart config process:
                    // 1. if smart config is done
                    // 2. CC3000 established AP connection
                    // 3. DHCP IP is configured
                    // then send mDNS packet to stop external SmartConfig application
                    //
                    if((g_ui8StopSmartConfig == 1) && (g_ui32CC3000DHCP == 1) &&
                       (g_ui32CC3000Connected == 1))
                    {
                        unsigned char loop_index = 0;

                        while(loop_index < 3)
                        {
                            mdnsAdvertiser(1, g_pcdevice_name, sizeof(g_pcdevice_name));
                            loop_index++;
                        }
                        g_ui8StopSmartConfig = 0;
                        wifiAppState = WIFI_SERVER_INIT;
                    }
                    break;
                case WIFI_SERVER_INIT:
                    if((g_ui32CC3000DHCP == 1) && (g_ui32CC3000Connected == 1)) {
                        UART0Send("\r\nInitialising Server... ", 25);
                        initServer();
                        wifiAppState = WIFI_WAIT_CIENT_COMM;
                    } else {
                        wifiAppState = WIFI_SSID_ASSOC;
                    }
                    break;
                case WIFI_WAIT_CIENT_COMM:
                    if(currentCC3000State() & CC3000_SERVER_INIT)
                    {
                        UART0Send("Done..\r\nWaiting for connection", 30);
                        waitForConnection();
                    }
                    break;

    The statements in bold will change the state only when IP address is acquired by cc3000, Other wise it will be in WIFI_SSID_ASSOC  state only.

    Smart Config is completed but looks like it is not able to get IP address. The same code with unsecured AP works well.

    thanks for reply,

    Regards,

    Kiran Neve.

  • Hi,


    i have Host driver 1.11.1 (DRIVER_VERSION_NUMBER   14) requires 1.24 patch program. its been done.

    Dose it support connection for WPA2 enabled APs.

     

    Also do i need CC3000_UsynchCallback function.

    Thanks.&regards,

    Kiran Neve

  • Hi Kiran,

    The first thing to do is determine if you can connect to your WPA2 enabled AP without using smart config. So just try connecting using wlan_connect(...).

  • Hi Ivor,

    I tried Using wlan_connect(WLAN_SEC_WPA2, "buffalo", 7, NULL, "technosphere123", 15);

    If i keep running in debug mode for a whileit does not get IP address.

    Then after pausing to see where its stuck it will be there in hci_event_handler(....) ->in while(1)-> if (tSLInformation.usEventOrDataReceived != 0). and if i run again, I can see IP address. but still it does not proceed further.

    and also i dont see CC3000 in the network only my PC IP address & router IP address is seen.

  • Any reason why you are not using SDK 1.12 with firmware version 1.26?

  • As 1.12 & 1.26 SP is not straight away available for M4 tiva ware, and only available for MSP430

    If you can tell how can it be done for tiva ware, i'll try to do that. Also do you think 1.13 & 1.28 will be better..?

    for patch 1.28/1.26 changing wlan_drv_patch[...] & fw_patch[..] is sufficient..?

    & as per my understanding do i need to take independent host driver from 1.13/1.12 version.

    let me know i should proceed with which version for tiva ware.

    thanks for reply.

    Kiran Neve.

  • The two arrays you mentioned above contain the entire firmware. You can flash different version by simply changing those arrays until you find one that works.

    You can also diff the different SDKs and see what are the changes between the MSP430 versions and port those changes to your code (there are very few). I use KDiff3, which can do entire directories very nicely.

    The getting stuck in this infamous while loop happens for so many different reasons, that it is almost impossible to determine the cause based on it.

    The only thing I can suggest to you at this point is try different firmwares. Also now that you know it is not a SmartConfig issue it might be good to start another topic asking a very specific question - why does wlan_connect(...) work with WLAN_SEC_UNSEC and not with WLAN_SEC_WPA2 on the Tiva.

    You should also find out if WLAN_SEC_WEP is working.

  • I am on the 1.26 patch and 1.12 host driver issue still remains,i will need to try to update to 1.13 & 1.28.

  • I don't think you need to try 1.28. I know for a fact that WPA2 works on the 1.26 firmware and 1.12 of the SDK, at least on the MPS430, since this is what I am using on my device.

    There must be some other Tiva specific issue at play.