我用HttpServer例子,CC3200先自动连接AP,连接不上后,我用手机的SmartConfig设置找到CC3200设备后,能够正常访问CC3200自带的网页,但是,如果重启CC3200后,又不能自动连接刚才的那个AP了。程序是写到Flash里的。
janemxq janemxq:
我的意思是,每次都要SmartConfig去配置一下。
Ken Wang:
回复 janemxq janemxq:
你可以看下你的程序里面有没有调用保存AP的profile的操作。
谢谢
janemxq janemxq:
回复 Ken Wang:
发现这一句,sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES),是不是可以这样认为,通过SmartConfig让3200连上Ap后,程序不需要写代码,内核自动将SSID,密码等信息保存起来了,下次板子运行,自动将profile调出使用,把这句sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES)去掉就行吧
Ken Wang:
回复 janemxq janemxq:
这个函数确实是删除掉了所有的profile。你可以调用profileadd的函数来把AP的profile加上,然后connect policy设置位auto fast connect。
这样每次它都会快速重连了。
谢谢
janemxq janemxq:
回复 Ken Wang:
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);
Ken Wang:
回复 janemxq janemxq:
我看了一下代码,你可以不用加add profile函数,只需要将sl_WlanProfileDel()注释掉就行。
因为smartconfig会自动的得到SSID和密码,并保存这个profile。
谢谢
th smi:
回复 Ken Wang:
下次断电后, 怎么再次连接到上次的AP了?
Terry Han:
回复 th smi:
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的形式
hc x:
回复 Terry Han:
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,其他原封未动)
Samuel Wu:
回复 hc x:
重启在后再调用smartconfig不行的把,可以看看OOB例程里面那个网络配置,他是自动连接超时之后在进行smartconfig的
TI中文支持网


