Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

CC3235SF: config only conect 5g but can connect 2.4G

Part Number: CC3235SF

Tool/software:

Hi TI engineer

       I had build two firmware. one firmware is V1.0.1 ,can connect 2.4G/5G WIFI. Another is V1.0.2  ,only connect 5G WIFI(set 2.4G channel mask 0x0000)。

      I have a AP broadcast 2.4G/5G, the V1.0.1 can connect this AP by 2.4G/5G.   And V1.0.2 only connect 5G wifi.

     When V1.0.1 connect AP by 2.4g,and then OTA firmware to V1.0.2. After OTA success(CC3235 wifi config same),CC3235 still connect AP by 2.4G and not 5G wifi. Then Config dev to connect another 2.4g AP , dev can't connect.  config dev connect another 5G AP,dev connected. So i think CC3235 store connected wifi info,and use this wifi info to connect .

     Is my think correct?  If yes, how do I delete the connected wifi information?

     

  • Hi,

    Not very clear. Are you saying that v1.0.2 worked OK and connected to 5G only and after OTA it also connected to 2.4G? please clarify.

    in general, if you have auto connect and fast connect enabled, the profiles are stored in the file system and used. To delete the profiles, you need to use the sl_WlanProfileDel() API.

    Shlomi

  • Hi

        Thanks reply.

         If  flash firmware to V1.0.2,the CC3235 only connected 5G WIFI. Flash firmware to V1.0.1 and connected 2.4G wifi ,if OTA(OTA not modify the dev config) to V1.0.2 the CC3235  still connected to this 2.4Gwifi .

       My code will del the profile。 

    void sl_dev_init(void)
    {
        SPI_init();
    
        OS_TaskCreate(sl_Task, "sl_task", SL_STACK_SIZE,NULL, SL_TASK_PRIORITY,NULL);
    
        sl_dev_role = sl_Start(NULL,NULL,NULL);
        SYS_LOGI("SL_DEV_INIT","sl_Start sl_dev_role=%d",sl_dev_role);
        if(sl_dev_role<0)
        {
            SYS_LOGE("SL_DEV_INIT","sl_Start error=%d",sl_dev_role);
        }
        if(sl_dev_role==ROLE_STA)
        {
            int16_t Status;
            Status = sl_WlanProfileDel(SL_WLAN_DEL_ALL_PROFILES);
            if( Status )
            {
                SYS_LOGE("SL_DEV_INIT","sl_WlanSet sta del profile error Status=%d",Status);
            }
        }
    	sl_dev_running_flag = 1;
    	SYS_LOGI("SL_DEV_INIT","complete");
    }
    void wifi_init()
    {
    
        SlWlanSecParams_t SecParams;
        SlWlanSecParamsExt_t SecExtParams;
        memset(&SecParams,0,sizeof(SlWlanSecParams_t));
        memset(&SecExtParams,0,sizeof(SlWlanSecParamsExt_t));
    
        int16_t Status;
        SYS_LOGI(WIFI_TAG,"WIFI INIT role is %d,ssid is %s,passwd is %s",wifi_param.mode,wifi_param.ssid,wifi_param.passwd);
    
    
        if(sl_dev_role!=wifi_param.mode)
        {
            SYS_LOGI(WIFI_TAG,"change wifi mode ,current mode is %d",sl_dev_role);
            Status = sl_WlanSetMode(wifi_param.mode);
            SYS_LOGI(WIFI_TAG,"sl_WlanSetMode return is %x",Status);
            /* For changes to take affect, we restart the NWP */
            Status = sl_Stop(0);
    		sl_dev_running_flag = 0;
            if (Status < 0)
            {
                SYS_LOGE(WIFI_TAG,"sl_Stop error Status=%d",Status);
            }
    
            sl_dev_role = sl_Start(0, 0, 0);
    		sl_dev_running_flag = 1;
            if (sl_dev_role < 0)
            {
                SYS_LOGE(WIFI_TAG,"sl_Start error Status=%d\r\n",Status);
            }
            wifi_sta_get_ip_flag = 0;
            wifi_connect_flag = 0;
        }
    
        if(wifi_param.mode ==ROLE_AP)
        {
            SYS_LOGI(WIFI_TAG,"WIFI AP CONFIG PARAM,ssid is %s\r\n",wifi_param.ssid);
    
            //AP param
            Status=sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SSID, strlen((const char *)wifi_param.ssid),wifi_param.ssid);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap ssid error Status=%d\r\n",Status);
            }
    
            Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2,(uint8_t*)wifi_country_code[wifi_param.country_seq]);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet country code error Status=%d\r\n",Status);
            }
            //can config 5g channel
            _u8 channel = 6;
            Status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_CHANNEL, 1, (_u8 *)& channel);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap channel code error Status=%d\r\n",Status);
            }
            _u8 val = SL_WLAN_SEC_TYPE_WPA_WPA2;
            Status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SECURITY_TYPE, 1, (_u8 *)&val);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap security error Status=%d\r\n",Status);
            }
    
            Status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_PASSWORD, strlen((const char *)wifi_param.passwd), wifi_param.passwd);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap passwd error Status=%d\r\n",Status);
            }
            _u8 max_ap_stations = 1;
            Status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_MAX_STATIONS, sizeof(max_ap_stations), (_u8
            *)&max_ap_stations);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap max connect num error Status=%d\r\n",Status);
            }
    
            //offset 0 is max POWER
            _u8 ApPower = 0;
            Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(_u8
            *)& ApPower);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap tx power error Status=%d\r\n",Status);
            }
    
    
            SlNetCfgIpV4Args_t ipV4;
            ipV4.Ip = (_u32)SL_IPV4_VAL(192,168,4,1); // _u32 IP address
            ipV4.IpMask = (_u32)SL_IPV4_VAL(255,255,255,0); // _u32 Subnet mask for this STA/P2P
            ipV4.IpGateway = (_u32)SL_IPV4_VAL(192,168,4,1); // _u32 Default gateway address
        //    ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(8,8,8,8); // _u32 DNS server address
            Status = sl_NetCfgSet(SL_NETCFG_IPV4_AP_ADDR_MODE,SL_NETCFG_ADDR_STATIC,sizeof(ipV4),
            (_u8*)&ipV4);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap static ip error Status=%d\r\n",Status);
            }
            _i16 Status;
            SlNetAppDhcpServerBasicOpt_t dhcpParams;
            _u8 outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
            dhcpParams.lease_time = 4096; // lease time (in seconds) of the IP    Address
            dhcpParams.ipv4_addr_start = SL_IPV4_VAL(192,168,4,100); // first IP Address for allocation
            dhcpParams.ipv4_addr_last = SL_IPV4_VAL(192,168,4,200); // last IP Address for allocation.
            Status = sl_NetAppStop(SL_NETAPP_DHCP_SERVER_ID); // Stop DHCP server before settings
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap dhcp server error Status=%d\r\n",Status);
            }
            Status = sl_NetAppSet(SL_NETAPP_DHCP_SERVER_ID, SL_NETAPP_DHCP_SRV_BASIC_OPT, outLen,(_u8* )&dhcpParams);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap dhcp server error Status=%d\r\n",Status);
            }
            Status = sl_NetAppStart(SL_NETAPP_DHCP_SERVER_ID); // Start DHCP server with new settings
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet ap start dhcp server error Status=%d\r\n",Status);
            }
    
            _u8 *eap_domain_id = "www.myDomain.net";
    
            Status = sl_NetAppSet(SL_NETAPP_DEVICE_ID,SL_NETAPP_DEVICE_DOMAIN,strlen((const char *)eap_domain_id),(_u8 *)
            eap_domain_id);
            if( Status )
            {
             // error
            }
    
        }
        else if(wifi_param.mode == ROLE_STA)
        {
            SYS_LOGI(WIFI_TAG,"WIFI STA CONFIG PARAM\r\n");
    
    
    
            _u8 StaPower = 0;
            Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(_u8*)& StaPower);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet sta tx power error Status=%d\r\n",Status);
            }
    
            if(wifi_param.country_seq>=MAX_WIFI_COUNTRY_SIZE)
            {
                SYS_LOGE(WIFI_TAG,"wifi_param.country_seq=%d error,and use 0",wifi_param.country_seq);
                wifi_param.country_seq = 0;
            }
            Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2,(uint8_t *)wifi_country_code[wifi_param.country_seq]);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet sta country code error Status=%d\r\n",Status);
            }
    
    
    
            if(wifi_param.dhcpc_en)
            {
                Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,SL_NETCFG_ADDR_DHCP,0,0);
            }
            else
            {
                SlNetCfgIpV4Args_t ipV4;
                ipV4.Ip = wifi_param.ip;//(_u32)SL_IPV4_VAL(192,168,4,1); // _u32 IP address
                ipV4.IpMask = wifi_param.netmask;//(_u32)SL_IPV4_VAL(255,255,255,0); // _u32 Subnet mask for this STA/P2P
                ipV4.IpGateway = wifi_param.gw;//(_u32)SL_IPV4_VAL(192,168,4,1); // _u32 Default gateway address
                ipV4.IpDnsServer = wifi_param.dns;//(_u32)SL_IPV4_VAL(8,8,8,8); // _u32 DNS server address
                Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,SL_NETCFG_ADDR_STATIC,sizeof(ipV4),(_u8*)&ipV4);
            }
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet sta ip  error Status=%d\r\n",Status);
            }
    
            _u8  Enabled5GStatus = 1;
            sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_ENABLE_5G, 1, (_u8 *)&Enabled5GStatus);
    
            SlWlanScanParamCommand_t ScanParamConfig;
            _u16 OptionLen = sizeof(ScanParamConfig);
            // 2.4G channels bits order:  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
            ScanParamConfig.RssiThreshold = -70;
            ScanParamConfig.ChannelsMask = 0x0000;
            Status =   sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS, OptionLen, (_u8 *)&ScanParamConfig);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet sta channel code error Status=%d\r\n",Status);
            }
    
           // auto
            Status = sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,SL_WLAN_CONNECTION_POLICY(1,0,0,0),NULL,0);
            if( Status )
            {
                SYS_LOGE(WIFI_TAG,"sl_WlanSet sta policy error Status=%d\r\n",Status);
            }
    
            if(wifi_param.security_type == WIFI_SECURITY_PERSONAL)
            {
                _i16 Index;
                SecParams.Key = (int8_t *)wifi_param.passwd;
                SecParams.KeyLen = strlen ((const char *)SecParams.Key);
    			if(SecParams.KeyLen==0)
    				 SecParams.Type = SL_WLAN_SEC_TYPE_OPEN;
    			else
    				SecParams.Type = SL_WLAN_SEC_TYPE_WPA_WPA2;
                SYS_LOGI(WIFI_TAG,"STA CONNECT AP SSID is %s,passwd is %s\r\n",wifi_param.ssid,SecParams.Key);
                Index = sl_WlanProfileAdd((int8_t *)wifi_param.ssid, strlen((const char *)wifi_param.ssid), NULL, &SecParams, NULL, 7 , 0);
                SYS_LOGI(WIFI_TAG,"sl_WlanProfileAdd INDEX is %d\r\n",Index);
            }
            else
            {
                SecParams.Type = SL_WLAN_SEC_TYPE_WPA_ENT;
                SecParams.Key = (int8_t*)wifi_param.eap_passwd;
    
                if(wifi_param.eap_type == WIFI_EAP_PEAP)
                {
                    SecParams.KeyLen = strlen((char *)SecParams.Key);
                    SecExtParams.EapMethod = SL_WLAN_ENT_EAP_METHOD_PEAP0_MSCHAPv2;
                    SecExtParams.User = (int8_t *)wifi_param.eap_username;
                }
                else if(wifi_param.eap_type == WIFI_EAP_TTLS)
                {
                    SecParams.KeyLen = strlen((char *)SecParams.Key);
                    SecExtParams.EapMethod = SL_WLAN_ENT_EAP_METHOD_TTLS_MSCHAPv2;
                    SecExtParams.User = (int8_t *)wifi_param.eap_username;
                }
                else if(wifi_param.eap_type == WIFI_EAP_TLS)
                {
                    SecParams.KeyLen = 0;
                    SecExtParams.EapMethod = SL_WLAN_ENT_EAP_METHOD_TLS;
                    SecExtParams.User = (int8_t *)wifi_param.eap_domain_id;
                }
    
                SecExtParams.UserLen = strlen((char *)SecExtParams.User);
                _i16 Index = sl_WlanProfileAdd((int8_t *)wifi_param.ssid, strlen((char *)wifi_param.ssid), NULL, &SecParams, &SecExtParams, 7 , 0);
                SYS_LOGI(WIFI_TAG,"sl_WlanProfileAdd INDEX is %d\r\n",Index);
    
            }
        }
        _u8  authentication_cert=wifi_param.authentication_cert; // 0 means disable the server authentication  //文档错误
        Status =  sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,SL_WLAN_GENERAL_PARAM_DISABLE_ENT_SERVER_AUTH,1,&authentication_cert);
        if( Status )
        {
            SYS_LOGE(WIFI_TAG,"sl_WlanSet authentication_cert error Status=%d\r\n",Status);
        }
    
    }

  • What does this OTA contains?

  • OTA only update firmware from V1.0.1 to V1.0.2. Compared to v1.0.1, V1.0.2 only sets the 2.4G channel to 0X0000.   CC3235 will load wifi config file  when boot ,nd the config not modify when ota. After OTA to V1.0.2,the CC3235 will connect to the AP configured from V1.0.1 firmware.  But CC3235 connected a 2.4GWIFI not 5G wifi

  • HI,

    It is the "chicken and the egg" since v1.0.1 stores the 2.4 profile and during the OTA procedure this profile is not deleted. After the OTA to v1.0.2 is completed, the sl_Start() API is called and before the profiles are deleted, the 2.4 profile is invoked and connected. This is why you are not able to connect to a new 2.4 AP.

    According to this theory, after the profiles are deleted and you disconnect from the AP (via sl_wlanDisconnect()), reloading the application should not allow you to connect.

    Shlomi