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.

CC3200通过SmartConfig配置的问题

Other Parts Discussed in Thread: CC3200

我用HttpServer例子,CC3200先自动连接AP,连接不上后,我用手机的SmartConfig设置找到CC3200设备后,能够正常访问CC3200自带的网页,但是,如果重启CC3200后,又不能自动连接刚才的那个AP了。程序是写到Flash里的。

  • 我的意思是,每次都要SmartConfig去配置一下。

  • 你可以看下你的程序里面有没有调用保存AP的profile的操作。

    谢谢

  • 发现这一句,sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES),是不是可以这样认为,通过SmartConfig让3200连上Ap后,程序不需要写代码,内核自动将SSID,密码等信息保存起来了,下次板子运行,自动将profile调出使用,把这句sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES)去掉就行吧

  • 这个函数确实是删除掉了所有的profile。你可以调用profileadd的函数来把AP的profile加上,然后connect policy设置位auto fast connect。

    这样每次它都会快速重连了。

    谢谢

  •  lRetVal = sl_WlanSmartConfigStart(0,                /*groupIdBitmask*/
                               SMART_CONFIG_CIPHER_NONE,    /*cipher*/
                               0,                           /*publicKeyLen*/
                               0,                           /*group1KeyLen*/
                               0,                           /*group2KeyLen */
                               NULL,                        /*publicKey */
                               NULL,                        /*group1Key */
                               NULL);                       /*group2Key*/

    这一句是连接手机SmartConfig的,是在他后面加上sl_WlanProfileAdd吗,但SSIDNAME,password从哪里得到呢

    sl_WlanProfileAdd(const _i8*  pName,const  _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams,const _u32 Priority,const _u32  Options);

  • 我看了一下代码,你可以不用加add profile函数,只需要将sl_WlanProfileDel()注释掉就行。

    因为smartconfig会自动的得到SSID和密码,并保存这个profile。

    谢谢

  • 下次断电后, 怎么再次连接到上次的AP了?

  • 1、将sl_WlanProfileDel()注释掉,不要将保存的profile删除掉。

    2、smartconfig会自动的得到SSID和密码,并保存这个profile。smart config配置完成SSID和密码当CC3200掉电后,都能以自动模式连接之前通过smart config保存的SSID和密码。即通过自动模式连接上AP

    //set AUTO policy automatically reconnect to one of its stored profiles 自动模式下CC3200会从SPI_Flash中读取存储的profile配置AP信息并连接AP

    3、lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,1),&policyVal, 1 /*PolicyValLen*/);---设置为Auto+smartconfig的形式

  • Hi Ti han,

    我按照你的方法在 Ti示例SmartConfig demo上注释,下载到Ti开发板上。每次重启怎么不自动连接到WiFi,而停留在sl_WlanSmartConfigStart()等待APP的配置呢?

    代码如下,请指点下。

    int SmartConfigConnect()
    {
    unsigned char policyVal;
    long lRetVal = -1;

    // Clear all profiles
    // This is of course not a must, it is used in this example to make sure
    // we will connect to the new profile added by SmartConfig
    //
    // lRetVal = sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES);
    // ASSERT_ON_ERROR(lRetVal);

    //set AUTO policy
    lRetVal = sl_WlanPolicySet( SL_POLICY_CONNECTION,
    SL_CONNECTION_POLICY(1,0,0,0,1),
    &policyVal,
    1 /*PolicyValLen*/);
    ASSERT_ON_ERROR(lRetVal);

    // Start SmartConfig
    // This example uses the unsecured SmartConfig method
    //
    lRetVal = sl_WlanSmartConfigStart(0, /*groupIdBitmask*/
    SMART_CONFIG_CIPHER_NONE, /*cipher*/
    0, /*publicKeyLen*/
    0, /*group1KeyLen*/
    0, /*group2KeyLen */
    NULL, /*publicKey */
    NULL, /*group1Key */
    NULL); /*group2Key*/
    ASSERT_ON_ERROR(lRetVal);

    // Wait for WLAN Event
    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    {
    _SlNonOsMainLoopTask();
    }
    //
    // Turn ON the RED LED to indicate connection success
    //
    GPIO_IF_LedOn(MCU_RED_LED_GPIO);
    //wait for few moments
    MAP_UtilsDelay(80000000);
    //reset to default AUTO policy
    lRetVal = sl_WlanPolicySet( SL_POLICY_CONNECTION,
    SL_CONNECTION_POLICY(1,0,0,0,0),
    &policyVal,
    1 /*PolicyValLen*/);
    ASSERT_ON_ERROR(lRetVal);

    return SUCCESS;
    }

    (在用例里只是注释了sl_WlanProfileDel,其他原封未动)

  • 重启在后再调用smartconfig不行的把,可以看看OOB例程里面那个网络配置,他是自动连接超时之后在进行smartconfig的

  • 是的,例程每次启动的时候都会恢复出厂值才会继续往下运行的。所以如果你要它保存,是需要修改代码的。

    让程序启动的时候不要恢复出厂。

  • 你好,我想问下不要恢复出厂设置的话,代码要怎么修改?是我把profiledel注释掉还是不行

  • 可以的。可以测试一下!