{"action":"closed","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/5413","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/5413/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/5413/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/5413/events","html_url":"https://github.com/esp8266/Arduino/issues/5413","id":386578108,"node_id":"MDU6SXNzdWUzODY1NzgxMDg=","number":5413,"title":"Can't ever connect to WiFi when USB connected","user":{"login":"teo1978","id":542107,"node_id":"MDQ6VXNlcjU0MjEwNw==","avatar_url":"https://avatars2.githubusercontent.com/u/542107?v=4","gravatar_id":"","url":"https://api.github.com/users/teo1978","html_url":"https://github.com/teo1978","followers_url":"https://api.github.com/users/teo1978/followers","following_url":"https://api.github.com/users/teo1978/following{/other_user}","gists_url":"https://api.github.com/users/teo1978/gists{/gist_id}","starred_url":"https://api.github.com/users/teo1978/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teo1978/subscriptions","organizations_url":"https://api.github.com/users/teo1978/orgs","repos_url":"https://api.github.com/users/teo1978/repos","events_url":"https://api.github.com/users/teo1978/events{/privacy}","received_events_url":"https://api.github.com/users/teo1978/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-12-02T17:00:35Z","updated_at":"2018-12-02T18:16:53Z","closed_at":"2018-12-02T18:16:53Z","author_association":"CONTRIBUTOR","body":"### Basic Infos\r\n\r\n- [X] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).\r\n- [X] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.\r\n- [X] I have tested that the issue is present in current master branch (aka latest git).\r\n- [X] I have searched the issue tracker for a similar issue.\r\n- [X] If there is a stack dump, I have decoded it.\r\n- [X] I have filled out all fields below.\r\n\r\n#### Platform\r\n\r\n- Hardware:\t\t\t\t\t[SparkFun ESP8266 Thing Dev]\r\n- Core Version:\t\t\t[latest git]\r\n- Development Env:\t\t[Arduino IDE|]\r\n- Operating System:\t\t[Ubuntu]\r\n\r\n### Settings in IDE\r\n\r\n- Module:  \t\t\t[SparkFun ESP8266 Thing Dev]\r\n- Flash Mode:\t\t\t??\r\n- Flash Size: \t\t512K no SPIFFS (is what was selected by default in the Arduino IDE, no freaking idea what this is)\r\n- lwip Variant:   [v2 Lower Memory]\r\n- Reset Method:\t\t??\r\n- Flash Frequency:\t??\r\n- CPU Frequency:\t\t80 MHz\r\n- Upload Using:\t\t[SERIAL]\r\n- Upload Speed:   [other] (serial upload only)\r\n\r\n\r\n### Problem Description\r\n\r\nDetailed problem description goes here.\r\n\r\nI have a sketch (see code below) that **used to work perfectly** fine both when connected via USB and when powered from external power supplies, which is 3 AAA batteries.\r\n\r\nNow, when powered from batteries it works fine, but **when powered from USB it systematically cannot connect to Wifi** (to the exact same wifi network, of course).\r\n\r\nI haven't touched my code between when it used to work and when it stopped working, and I'm testing it on the exact same board with the exact same settings in the exact same environment (i.e. physical place and the wifi network it tries to connect to). And I don't even think I have updated the version of the esp8266 arduino core, so in theory I **haven't touched anything that should explain why it stopped working**. The only thing I did was install the board definitions for ESP32 boards (without attempting to use them, as this is NOT an ESP32 board), then the sketch wouldn't compile anymore (I know, it doesn't make any sense: I installed a new set of boards but I didn't select any of them: I kept trying to compile the sketch for the same old board, but it wouldn't compile anymore; something is seriously fucked up at https://github.com/espressif/arduino-esp32). So I uninstalled that board and now here I am. So, this should be irrelevant as everything is (supposed to be) back to how it was before I even tried to install the ESP32 boards (without ever using them). \r\n\r\nThe sketch now compiles again and generally works, but when connected to USB it exhibits the issue at hand. My guess is that the whole install-Esp32-boards-and-uninstall-them had absolutely nothing to do and this is just a random issue that for some random reason has started to show up now. \r\n\r\nI don't know how to interpret the debug output, or what the messages like \"state X -> Y\", \"scandone\", and \"reconnect\" are supposed to mean, but to me those \"reconnect\" messages that show up several times look very suspicious. \"Reconnect\"?? You never even managed to connect, so why reconnect?\r\n\r\nBTW are those debug messages documented anywhere? They are very cryptic.\r\n\r\n\r\n### [MCVE](https://stackoverflow.com/help/mcve) Sketch\r\n\r\n```cpp\r\n  WiFi.mode(WIFI_OFF);\r\n  WiFi.persistent(false);\r\n\r\n  WiFi.mode(WIFI_STA);\r\n  WiFi.begin(client_ssid.c_str(), client_password.c_str());\r\n\r\n  for (int i=0; i<20; i++) {\r\n    Serial.printf(\"Trying to connect to Wifi '%s' with password '%s'\\n\", client_ssid.c_str(), client_password.c_str());\r\n    if (WiFi.status()==WL_CONNECTED) {\r\n      Serial.printf(\"...connected succesfully\\n\");\r\n  }\r\n  Serial.printf(\"Cannot connect to WiFi!\\n\");\r\n```\r\n\r\n### Debug Messages\r\n\r\n```\r\nmode : sta(60:01:94:3f:eb:a9)\r\nadd if0\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nstate: 2 -> 0 (2)\r\nreconnect\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nstate: 2 -> 0 (2)\r\nreconnect\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nstate: 2 -> 0 (2)\r\nreconnect\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nstate: 2 -> 3 (0)\r\nstate: 3 -> 0 (4)\r\nreconnect\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nstate: 2 -> 0 (2)\r\nreconnect\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nTrying to connect to Wifi 'Sixty-Seven' with password '*******'\r\nCannot connect to WiFi!\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nstate: 2 -> 0 (2)\r\nreconnect\r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"devyte"}}