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在AP模式下设置密码

Other Parts Discussed in Thread: CC3200

最近需要使用CC3200的AP模式,并设置密码,但是经过几天的研究,翻阅了很多资料都没能设置成功。

sl_WlanSetMode(ROLE_AP);

sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen("cc_ap_test1"), (unsigned char *)"cc_ap_test1");

sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2,(unsigned char *)"US");

sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (unsigned char*)channel);

sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (unsigned char*)hidden);

sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned char *)sec_type);
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen("password123"), (unsigned char *)"password123");

sl_Stop(100);

sl_Start(NULL, NULL, NULL);

这部分是我目前设置的代码。是根据swru368.pdf中网络部分的示例代码进行简化的。


lRetVal = sl_WlanSetMode(ROLE_AP);
ASSERT_ON_ERROR(lRetVal);

lRetVal = sl_WlanSet(SL_WLAN_CFG_AP_ID,WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned char * )"SL_SEC_TYPE_WPA");
ASSERT_ON_ERROR(lRetVal);

lRetVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen(passwd),(unsigned char*)passwd);
ASSERT_ON_ERROR(lRetVal);


lRetVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(pcSsidName),
(unsigned char*)pcSsidName);
ASSERT_ON_ERROR(lRetVal);

UART_PRINT("Device is configured in AP mode\n\r");

/* Restart Network processor */
lRetVal = sl_Stop(SL_STOP_TIMEOUT);

// reset status bits
CLR_STATUS_BIT_ALL(g_ulStatus);

return sl_Start(NULL,NULL,NULL);

而这部分是我之前根据wlan_ap的代码改写的。

但是两部分代码都无法将AP设置为WPA认证,运行后均为OPEN模式。

请各位大神们帮忙分析分析