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.

WLAN_CONNECT for connecting to a BSSID

Other Parts Discussed in Thread: MSP430FG4618, MSP430FR5739

Hi,

I am using CC3000 together with MSP430FG4618. I have to connect to an AP which is part of  an ESS. So in the wlan_connect function I  also need to specify the BSSID (i.e. MAC address) of the particular AP I want to connect to.

The code is the following:

 //Direct connection to an AP
 
    //reset policy
    wlan_ioctl_set_connection_policy(0,0,0);
    value = wlan_connect(WLAN_SEC_UNSEC,"APname",APname_length, bssid,NULL,0);
    while(ulCC3000Connected==0);
    SmartConfigLedOn(TRUE);
    while(1);

The wlan_connect function returns correcly the value 0, but the CONNECT unsolicited event never arrives.

I read on the new errata of CC3000 that the device is not able to connect to a specific AP with a given BSSID, so maybe the problem can be this. Do you have any suggestion?

Thank you and Best Regards,

Mario Demaria

  • Hi,

    Some of the forum members seems to connect to APs by using 'wlan_add_profile()' API. That seems to take a BSSID input.

    Could you try with that API ?

    Thanks,

    -VR Shankar.

  • Dear VR Shankar,

    Thanks a lot for your answer. I have tried to use the wlan_add_profile API but the UNSOL_CONNECT event still not arrives. I post the code I have written for the whole connection procedure, maybe there is something incorrect:

    //In this initialization function, wlan_init,wlan_start and wlan_set_event_mask are properly called
        DemoInitDriver();
        
        //Direct connection to an AP
     
        //Add the profile of the AP we want to connect   
        wlan_add_profile(WLAN_SEC_UNSEC,"polito",0x06,bssid,0,0,0,0,NULL,0); //priority of the profile is set to 0, there is only this profile and so there is no need higher priority values. Other parameters are set to 0 since they are useless for a unsecured network.


        //apply policy in order to connect to the profile
        wlan_ioctl_set_connection_policy(0,0,1);
        
        //Reset CC3000 in order to apply changes (according to the CC3000 guide)
        wlan_stop();
        wlan_start(0);
        wlan_set_event_mask(HCI_EVNT_WLAN_KEEPALIVE|HCI_EVNT_WLAN_UNSOL_INIT|HCI_EVNT_WLAN_UNSOL_DHCP|HCI_EVNT_WLAN_ASYNC_PING_REPORT);
        
        while(ulCC3000Connected==0);//Waiting for UNSOL_CONNECT_EVENT (from IRQ line)
        SmartConfigLedOn(TRUE);
     } //end of the main function

    The programs remains in the while(ulCC3000Connected==0) since the Connect unsolicited event does not arrive. The signal strength from the AP is good enough, it's around -65 dBm. I have not yet updated driver/firmware and this may be the issue if the code is correct.

    Again thanks for your attention and Best Regards,

    Mario Demaria


  • Hi Mario Demaria,

    Two suggestions :

    1) From the posted code :

        //In this initialization function, wlan_init,wlan_start and wlan_set_event_mask are properly called
        DemoInitDriver();

     Can you check if UNSOL_CONNECT is NOT masked in the 'wlan_set_event_mask' call inside DemoInitDriver() ?

    2) Instead of a 'tight' while(1) loop for checking WLAN connection, try this :

         while (ulCC3000Connected == 0)
        {
           hci_unsolicited_event_handler();
     
           __delay_cycles(1000);
         }

    Thanks,

    -VR Shankar.

  • Dear VR Shankar,

    After some attempts, I have decided to change strategy. I was trying to connect to an ESS network which has many APs, all with the same name but with different BSSIDs. This network actually requires to authenticate on an initial Web page (it's an university network) to enstabilish the connection and I don't think CC3000 has the capability to do this.

    So now I'm trying to have an explicit connection with a more simple AP located at home. This AP is unsecured, so the code I'm using now is the following:

     

     DemoInitDriver();         //Direct connection to an AP

      //apply policy in order to connect to the profile    

    wlan_ioctl_set_connection_policy(0,0,0);        

    wlan_connect(WLAN_SEC_UNSEC,"SpeedTouchCDB4BE",16,NULL,NULL,0);       

     while(1);

    In DemoInitDriver() the wlan_set_event_mask does not mask the UNSOL_CONNECT event. And I think the while(1) at the end should be okay. In fact, the timer ISR is called every 500 ms and in the ISR the hci_unsolicited_event_handler is called to check if usolicited events are arrived. This is indicated in the Host Programming Guide and  I have checked that this behavior is correct.

    I don't know where to start in order to solve my problem, because in principle it can be everything.

    The wlan_connect returns 0 (correct operation), which means that the CC3000 understands and replies correctly to the connect request, but then it never sends the unsol_connect. Moreover, do I need to restart the CC3000 (wlan_stop-->wlan_start-->wlan_set_event_mask) after the policy is set and before the wlan_connect is called?

    It is possible that the connection is not set because Driver/Firmware are not updated?

     

    I'm using the code provided in the BasicWifiApplication for msp430fr5739 provided by TI and I have changed nothing, I have just ported SPI.

    Please let me know if you have any suggestion on how to proceed in order to solve this problem,

    Thanks for your kind attention and Best Regards,

    Mario Demaria