9 years, 1 month ago.

"wifi.connect" hang up

By problems such as access point, in a case where the connection destination is no longer, and repeat the initialization of the following, you can hang up in the "wifi.connect" several times. Will there countermeasures like? Nice to meet you. Matsuda

--------------- Wifi接続 --------------- int Wifi_Connect() { int ret = 0;

Initialize Wi-Fi interface ret = wifi.init(); if(ret != 0){ printf("Wi-Fi initial failed %d\r\n", ret); return ret; } wait(0.5);

ret = wifi.disconnect(); if(ret != 0) { printf("on the disconnect state %d\r\n", ret); return ret; } wait(0.3);

E_SECURITY SecuriryType; if (strcmp(WifiSet.Wifi_SECURITY_TYPE,"WEP")== OK) SecuriryType = e_SEC_WEP; else if (strcmp(WifiSet.Wifi_SECURITY_TYPE,"WPA-PSK(TKIP)")==OK) SecuriryType = e_SEC_WPA_TKIP; else if (strcmp(WifiSet.Wifi_SECURITY_TYPE,"WPA2-PSK(AES)")==OK) SecuriryType = e_SEC_WPA2_AES; else if (strcmp(WifiSet.Wifi_SECURITY_TYPE,"WPA2-PSK(TKIP/AES)")==OK) SecuriryType = e_SEC_WPA2_MIXED; else if (strcmp(WifiSet.Wifi_SECURITY_TYPE,"WPA-PSK(AES)")==OK) SecuriryType = e_SEC_WPA_AES; else SecuriryType = e_SEC_OPEN;

ret = wifi.connect( WifiSet.Wifi_SSID, strlen(WifiSet.Wifi_SSID) , SecuriryType , WifiSet.Wifi_SECURITY_KEY, strlen(WifiSet.Wifi_SECURITY_KEY) ); if(ret != 0) { printf("Connect AP is failed %d\r\n", ret); return ret; } wait(0.5);

DHCPでIPアドレスを取得 int retIp = wifi.setIPConfig(true); wait(0.5); printf("IP Address Get!!! %d\n", retIp);

return(true); }

Question relating to:

Murata TypeYD - NTPClient example.
Be the first to answer this question.