{"action":"created","issue":{"url":"https://api.github.com/repos/arduino-libraries/WiFi101/issues/214","repository_url":"https://api.github.com/repos/arduino-libraries/WiFi101","labels_url":"https://api.github.com/repos/arduino-libraries/WiFi101/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/arduino-libraries/WiFi101/issues/214/comments","events_url":"https://api.github.com/repos/arduino-libraries/WiFi101/issues/214/events","html_url":"https://github.com/arduino-libraries/WiFi101/issues/214","id":292142348,"number":214,"title":"Lockup upon call for client after WiFi.end()","user":{"login":"BrunDog","id":28807709,"avatar_url":"https://avatars0.githubusercontent.com/u/28807709?v=4","gravatar_id":"","url":"https://api.github.com/users/BrunDog","html_url":"https://github.com/BrunDog","followers_url":"https://api.github.com/users/BrunDog/followers","following_url":"https://api.github.com/users/BrunDog/following{/other_user}","gists_url":"https://api.github.com/users/BrunDog/gists{/gist_id}","starred_url":"https://api.github.com/users/BrunDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrunDog/subscriptions","organizations_url":"https://api.github.com/users/BrunDog/orgs","repos_url":"https://api.github.com/users/BrunDog/repos","events_url":"https://api.github.com/users/BrunDog/events{/privacy}","received_events_url":"https://api.github.com/users/BrunDog/received_events","type":"User","site_admin":false},"labels":[{"id":291904850,"url":"https://api.github.com/repos/arduino-libraries/WiFi101/labels/waiting%20for%20feedback","name":"waiting for feedback","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-01-27T18:36:43Z","updated_at":"2018-02-14T15:41:04Z","closed_at":"2018-02-14T15:13:17Z","author_association":"NONE","body":"Hi,\r\n\r\nI have found an odd aberration that afflicts certain WINC1500 modules. For example, the code below will cause a lockup on a ATWINC1500-MR210xB D/C: M1613 but not on D/C: D1532 or D1621. These are all Adafruit Feather M0 WINC1500 modules.\r\n\r\nThe lockup occurs on the call of 'WiFiClient client = server.available();' following the call to WiFi.end();. Certainly, the call to check for a client may not seem normal when disconnected (it is in another application I am using), but shouldn't cause a hard lockup either, so I thought I would post it.\r\n\r\nThe restart sequence is initiated by sending a ! to the server via a TCP packet. The onboard LED is blinked to demonstrate its lockup.\r\n\r\n```\r\n#include <SPI.h>\r\n#include <WiFi101.h>\r\n\r\n#include \"arduino_secrets.h\"\r\nchar ssid[] = SECRET_SSID;\r\nchar pass[] = SECRET_PASS;\r\nIPAddress IP = {192, 168, 1, 240};\r\nint status = WL_IDLE_STATUS;\r\nint restartLevel = 0;\r\n\r\nWiFiServer server(23);\r\n\r\nboolean alreadyConnected = false;\r\nunsigned long oldtime;\r\n\r\nvoid setup() {\r\n  WiFi.setPins(8, 7, 4, 2);\r\n  Serial.begin(115200);\r\n  pinMode(LED_BUILTIN, OUTPUT);\r\n  while (!Serial) {\r\n    ;\r\n  }\r\n  initNetwork();\r\n}\r\n\r\n\r\nvoid loop() {\r\n  WiFiClient client = server.available();\r\n\r\n  if (client) {\r\n    if (!alreadyConnected) {\r\n      client.flush();\r\n      Serial.println(\"We have a new client\");\r\n      client.println(\"Hello, client!\");\r\n      alreadyConnected = true;\r\n    }\r\n\r\n    if (client.available() > 0) {\r\n      char thisChar = client.read();\r\n      server.write(thisChar);\r\n      Serial.write(thisChar);\r\n      if (thisChar == '!') restartLevel = 1;\r\n    }\r\n  }\r\n  if ((millis() - oldtime) >= 3000) {\r\n    printWiFiStatus();\r\n    if (digitalRead(LED_BUILTIN)) digitalWrite(LED_BUILTIN, LOW);\r\n    else digitalWrite(LED_BUILTIN, HIGH);\r\n    if (restartLevel) restartSequence();\r\n    oldtime = millis();\r\n  }\r\n}\r\n\r\n\r\nvoid printWiFiStatus() {\r\n  Serial.print(\"SSID: \");\r\n  Serial.println(WiFi.SSID());\r\n  IPAddress ipx = WiFi.localIP();\r\n  Serial.print(\"IP Address: \");\r\n  Serial.println(ipx);\r\n  long rssi = WiFi.RSSI();\r\n  Serial.print(\"RSSI:\");\r\n  Serial.print(rssi);\r\n  Serial.println(\" dBm\");\r\n}\r\n\r\nvoid initNetwork() {\r\n  WiFi.setPins(8, 7, 4, 2);\r\n  WiFi.config(IP);\r\n  if (WiFi.status() == WL_NO_SHIELD) {\r\n    Serial.println(\"No WiFi hardware\");\r\n    while (true);\r\n\r\n  status = WiFi.begin(ssid, pass);\r\n  while ( status != WL_CONNECTED) {\r\n    Serial.print(\"Connecting: \");\r\n    Serial.println(ssid);\r\n\r\n    status = WiFi.begin(ssid, pass);\r\n    delay(10000);\r\n  }\r\n  server.begin();\r\n  printWiFiStatus();\r\n}\r\n\r\nvoid restartSequence() {\r\n  switch (restartLevel) {\r\n    case 1:\r\n      WiFi.disconnect();\r\n      restartLevel = 2;\r\n      Serial.println(\"WiFi Disconnected\");\r\n      break;\r\n    case 2:\r\n      WiFi.end();\r\n      restartLevel = 3;\r\n      Serial.println(\"WiFi Ended\");\r\n      break;\r\n    case 3:\r\n      initNetwork();\r\n      restartLevel = 0;\r\n      break;\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/arduino-libraries/WiFi101/issues/comments/365646359","html_url":"https://github.com/arduino-libraries/WiFi101/issues/214#issuecomment-365646359","issue_url":"https://api.github.com/repos/arduino-libraries/WiFi101/issues/214","id":365646359,"user":{"login":"sandeepmistry","id":1163840,"avatar_url":"https://avatars1.githubusercontent.com/u/1163840?v=4","gravatar_id":"","url":"https://api.github.com/users/sandeepmistry","html_url":"https://github.com/sandeepmistry","followers_url":"https://api.github.com/users/sandeepmistry/followers","following_url":"https://api.github.com/users/sandeepmistry/following{/other_user}","gists_url":"https://api.github.com/users/sandeepmistry/gists{/gist_id}","starred_url":"https://api.github.com/users/sandeepmistry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandeepmistry/subscriptions","organizations_url":"https://api.github.com/users/sandeepmistry/orgs","repos_url":"https://api.github.com/users/sandeepmistry/repos","events_url":"https://api.github.com/users/sandeepmistry/events{/privacy}","received_events_url":"https://api.github.com/users/sandeepmistry/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T15:41:04Z","updated_at":"2018-02-14T15:41:04Z","author_association":"CONTRIBUTOR","body":"@BrunDog thank you for your feedback a new 0.15.1 library release which includes both fixes will be available in the library manager shortly."}}
{"actor":{"display_login":"sandeepmistry"}}