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.

CC3135MOD: Smart config is not working properly

Part Number: CC3135MOD
Other Parts Discussed in Thread: CC3135

We are using ti cc3135mod as wifi module.
It supports dual band 2.4GHz and 5gHz, we are using it for both AP mode and STA mode.
We tried using it for smart config to automatically switch between 2.4GHz and 5GHz based on the signal strength.
I mentioned the code I did for connecting the both:

for AP mode:

const _u8 val{SL_WLAN_SEC_TYPE_WPA_WPA2};
const _u8 channel{11 || 44};
slStartRetVal = sl_Start(0, 0, 0);
retVal = sl_WlanSetMode(ROLE_AP); //AP mode configured
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SSID, strlen(ssid),
                          reinterpret_cast<const _u8 *>(ssid)); // Obtained ssid

retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SECURITY_TYPE, 1,
                          (&val));  // setted security

sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_CHANNEL, 1, (&channel)); // channel setted 

for STA mode:


if ((startRetVal != static_cast<_i16>(ROLE_STA)) ||
          (startRetVal != SL_API_ABORTED)) {
        slStartRetVal = sl_Start(0, 0, 0);

        if ((slStartRetVal != static_cast<_i16>(ROLE_STA)) ||
            (slStartRetVal == SL_RET_CODE_DEV_ALREADY_STARTED)) {
          sl_WlanSetMode(ROLE_STA);

          slStartRetVal = sl_Start(0, 0, 0);
        }
      }
      _u8 Mode = 1;
   retVal= sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_ENABLE_5G,1, (_u8 *)&Mode); // Enabled 5g mode
  retVal = sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,
                                SL_WLAN_CONNECTION_POLICY(1U, 0, 0, 0), nullptr,
                                0); /*Policy is set to Auto and Fast*/

  retVal =
          sl_WlanPolicySet(SL_WLAN_POLICY_SCAN, SL_WLAN_DISABLE_SCAN, 0, 0);
 

I tried this code, mostly it works only for 2.4GHz, 
Kindlly help me to sort out the mistake I have done, and say if I missed anything. I want the wifi to work on smart config in both AP and STA mode.


  • Hey Kavya,

    I have assigned this to one of our SW experts to support. Please allow until Monday for a response.

  • Hi Kavya,

    As to be honest, your code does not make any sense.

    I don't see any relation to Smartconfig provisioning API sl_WlanProvisioning(). Your changing mode is not correct. After changing mode you need to restart NWP (sl_Stop()/sl_Start()). Why you disabling WLAN scan inside your STA code?

    btw ... why so weird mixing of C and C++ code?

    Jan

  • Hi Jan,

    I here meant smart config as setting my router in smart config which provides 2.4GHz and 5GHz with same SSID. So my device need get connected to it automatically based on the signal strength as either 2.4GHz or 5GHz.

  • Hi,

    CC3135 will works by default state generally as you want when connection profiles are used. When fast connect feature is used device will try to connect to previous SSID to reduce connection time. This may to introduce some uncertainty into connection behaviour.

    When you have AP at mixed mode (2.4+5GHz) with same SSID, it is likely that CC3135 will connect to 2.4GHz network. This is because 5GHz have smaller wavelength and this means lower range.

    If default connection logic of CC3135 does not fit for your purpose, nothing prevent you change this behaviour. You can do WLAN scan and use manual connection according results from this scan. For more details about sl_ API calls see SWRU455.

    Jan

  • Hi Jan,

    With your previous reply I understood that, if I specify one specific channel of 2.4GHz I can't automatically switch to the 5GHz channel in AP mode. Is this condition is only for AP or for STA also?

    And I have an other question if I specified a channel that belongs to 2.4GHz and configured in AP mode and by enabling the 5GHz with

     _u8 Mode = 1;

    sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_ENABLE_5G,1, (_u8 *)&Mode); // Enabled 5g mode

    and 5GHz scan 

    _i16 Status;

    SlWlanScanParamCommand_t ScanParamConfig;

    ScanParamConfig.RssiThershold = -70;

    ScanParamConfig.ChannelsMask = 0x421; /* channels 1,6,11 */

    Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS_5G, sizeof(ScanParamConfig), (_u8* )& ScanParamConfig);

    I can connect to 5GHz?

  • Hi,

    Connection profiles works for STA mode only, of course. As to be honest I am slightly confused that you even asking such question.

    No. That code is not correct. Why you set 2.4GHz channels into mask for 5GHz scan? Please see example in CC31xx/CC32xx Host Driver documentation:

    SlWlanScanParam5GCommand_t ScanParamConfig5G;
    _u16 Option = SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS_5G;
    _u16 OptionLen = sizeof(SlWlanScanParam5GCommand_t);
    // 5.0G channels bits order: 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132,
    //                          136, 140, 144, 149, 153, 157, 161, 165, 169, 184, 188, 192, 196 
    ScanParamConfig5G.ChannelsMask = 0x0000000F; // Select ChannelsMask for channels 36, 40, 44, 48 
    ScanParamConfig5G.RssiThreshold = -70;
    sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, Option, OptionLen, (_u8 *)&ScanParamConfig5G);

    Jan

  • Hi Jan,

    I apologize for any confusion caused by my previous question.


    In AP mode,If I set the channel 11 to configure with 2.4GHz using:

    sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_CHANNEL, 1, (&channel));
    In STA mode,I can enable 5GHz using:

    _u8 Mode = 1;

    sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_ENABLE_5G,1, (_u8 *)&Mode); // Enabled 5g mode

    And perform 5g scan using: 

    SlWlanScanParam5GCommand_t ScanParamConfig5G;
    _u16 Option = SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS_5G;
    _u16 OptionLen = sizeof(SlWlanScanParam5GCommand_t);
    // 5.0G channels bits order: 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132,
    // 136, 140, 144, 149, 153, 157, 161, 165, 169, 184, 188, 192, 196
    ScanParamConfig5G.ChannelsMask = 0x0000000F; // Select ChannelsMask for channels 36, 40, 44, 48
    ScanParamConfig5G.RssiThreshold = -70;
    sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, Option, OptionLen, (_u8 *)&ScanParamConfig5G);

    So that the STA  mode works with 5GHz?

    If my router has the same SSID for both 2.4GHz and 5GHz, will it connect to 5GHz. I am asking this because I am using 
    'sl_WlanPolicySet' to connect with STA mode:
    sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,SL_WLAN_CONNECTION_POLICY(1U, 0, 0, 0),NULL,0);
  • Hi,

    AP mode API (SL_WLAN_AP_OPT_CHANNEL) does not have any relation to STA mode.

    With such scan parameters and connection policy your CC3135 should be able connect to 5GHz network. But if you have infrastructure AP with mixed mode (2.4GHz + 5GHz) and same SSID, CC3135 device will likely connect via 2.4GHz, because 2.4GHz have higher range.

    Jan

  • Hi Jan,

    Thank you for the reply.

    For STA mode:
    1st step I set the policy, then I enabled 5GHz, then I scanned for 5GHz with below mentioned commands:

    1. sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,SL_WLAN_CONNECTION_POLICY(1U, 0, 0, 0),NULL ,0);
    2.
    _u8 Mode = 1;
    sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_ENABLE_5G, 1, (_u8 *)&Mode); // Enable 5g mode
    3.
    SlWlanScanParam5GCommand_t ScanParamConfig5G;
    _u16 Option = SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS_5G;
    _u16 OptionLen = sizeof(SlWlanScanParam5GCommand_t);

     // 5.0G channels bits order: 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132,
     // 136, 140, 144, 149, 153, 157, 161, 165, 169, 184, 188, 192, 196
     ScanParamConfig5G.ChannelsMask = 0x0000000F; // Select ChannelsMask for channels 36, 40, 44, 48
     ScanParamConfig5G.RssiThreshold = -70;
     sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, Option, OptionLen, (_u8 *)&ScanParamConfig5G);

    Is this the right procedure?
  • Hi,

    That code looks correct.

    But other your code with sl_ API may to affect behaviour.

    Jan

  • Hi,

    In STA mode do we have option to set specific channel for 5GHz?

  • Hi,

    At STA mode you cannot selected specific channel regardless 2.4GHz or 5GHz is used. This channel you need to select at your infrastructure AP (= your WiFi "router"). For more information please contact manufacturer of your infrastructure AP.

    At STA mode you can select channel mask which will be scanned. That means you can limit connection at particular channels.

    Jan

  • Hi,
    In STA mode in case of 5GHz I can connect to specific channel like 36,40,44 and 48. I'm not using the channel mask scan option also. 
    If I set my router's channel selection option as AUTO, I couldn't connect. I could connect only If I mention any one from 36,40,44 and 48 in my router's channel selection option.
    But in case of 2.4GHz if I mention AUTO in channel selection option of router I could connect.

  • Hi,

    Hard to say what is meaning of AUTO option at your WiFi "router". You need to ask manufacturer of your router.

    To be able connect with CC3135 to your WiFi "router" it need to match country code and channels at your WiFi "router" and CC3135.

    Jan

  • Hi,
    AUTO means we can connect to any of the 5GHz channel, instead of mentioning one particular channel.
    Do I need to mention the country code in STA mode?

  • Hi,

    No, definitely not. That option AUTO cannot mean that you can connect to any channel. It likely mean that your router select channel according own internal strategy.

    Sure. Country code is related to STA and AP mode. According country code are set regulatory limitation for particular countries, including limitation of using channels.

    Jan

  • Hi,

    In the case of STA mode, I specified the country code as 'US' with the following code:

    _u8 Str[] = "US";
    sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2,Str);

    However, I could only connect to channels 36, 40, 44, and 48.Is there any way to check whether the country is configured or not?
  • Hi,

    After changing country code you should restart NWP (sl_Stop()/sl_Start()). Current country code you can check using API sl_WlanGet().

    For more details about regulatory domain please check SWRU455 appendix C.

    Jan

  • Hi Dylan,

    Have you found any solution?
    I am currently facing the issue like I could only connect to the channels 36,40,44 and 48 while trying to connect with 5GHz.

  • Hi Jan,

    After setting the country code to US, I can only connect with channels 36, 40, 44, and 48.
    Do you have any solutions for this issue?
    Also, do you know if the CC3135 can only connect for channel widths of 20MHz or 40MHz?

  • Hi,

    I have not searching any solution, because I am not able say what is culprit your issue. Have you tested with another model of AP? I have done test with CC3235 and it have no issue to connect using other channels with my Ubiquiti AP. CC3135 and CC3235 have same NWP (WiFi coprocessor). When you set infrastructure AP to other channels are you able see the in AP SSID using WLAN scan command? What service pack do you have uploaded inside CC3135MOD? Please try with latest from CC32xx SDK. You may to update Host driver from this SDK also.

    CC135 devices support 20MHz channels only. 40MHz channels are not supported.

    Jan

  • Hi,
    Will CC3135 supports DFS channels?

  • Hi,

    Yes DFS is supported, see SWRU455 appendix C.

    Jan

  • Hi Jan,
    I could connect to all the channels of the 5GHz band after updating the SDK. Previously, I was using the older version.
    Thanks