{"id":426,"date":"2015-04-24T13:41:25","date_gmt":"2015-04-24T20:41:25","guid":{"rendered":"http:\/\/internetofhomethings.com\/homethings\/?p=426"},"modified":"2015-06-12T14:43:50","modified_gmt":"2015-06-12T21:43:50","slug":"why-i-had-to-abandon-the-esp8266-sdk","status":"publish","type":"post","link":"https:\/\/internetofhomethings.com\/homethings\/?p=426","title":{"rendered":"Why I stopped using the ESP8266 SDK"},"content":{"rendered":"<p><strong>Update: The issues I had with the ESP8266 SDK Version 1.0 have been fixed\u00a0with the Version 1.0.1 release dated 24 April 2015. And now, Version 1.1.1 has been released with even more enhancements. <\/strong><\/p>\n<p><strong><span style=\"color: green;\">As result I am once again using the EspressIf SDK, my preferred development platform for the ESP8266. It is feature rich, offers low-level control and a very large pool of programming memory space for your application.<\/span><\/strong><\/p>\n<p><strong>The issues I had\u00a0were corrected with the addition of the mDNS (multicast domain\u00a0name server) API. This feature has the ESP8266\u00a0advertise\u00a0 it&#8217;s presence, which has made firmware developed using the SDK and my router accessible from the global internet.<\/strong><\/p>\n<p>Original post (no longer applicable):<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/04\/esp8266-sdk-ISSUES.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-628 size-full\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/04\/esp8266-sdk-ISSUES.png\" alt=\"esp8266-sdk-ISSUES\" width=\"812\" height=\"526\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/04\/esp8266-sdk-ISSUES.png 812w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2015\/04\/esp8266-sdk-ISSUES-300x194.png 300w\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" \/><\/a><\/p>\n<p>I was very hopeful that the ESP8266, with it&#8217;s rich programming environment, would overcome the shortcomings that forced me to <a title=\"abandon the NodeMCU\/Lua\" href=\"http:\/\/wp.me\/p5NRQ8-6Q\" target=\"_blank\">abandon the NodeMCU\/Lua<\/a> setup for code development.<\/p>\n<p>Wrong!!!<\/p>\n<p>After working with the SDK for a couple of weeks (perhaps 60 hours), I was ready to put up the white flag and surrender. This ESP8266 was just too much of a time suck, with no payoff. The SDK also has issues.<\/p>\n<p>Despite the seeming lower level control of the code than the highly abstracted Lua language, I found calls to the compiled SDK core objects that would, for no apparent reason, stop working as expected. Without a clue as to why. The two issues that I could not get a grasp on, and could not find an answer in any on-line sources were:<\/p>\n<p>1. The server stopped responding to &#8220;http GET&#8221; requests<\/p>\n<p>2. The server will not respond to &#8220;http GET&#8221; requests without initializing a\u00a0DNS<\/p>\n<p><strong>Issue1: The server stopped responding to &#8220;http GET&#8221; requests<\/strong><\/p>\n<p>I started with the SDK example IoT_Demo. This compiled easily, and soon after flashing it to my ESP8266, I was able to see web browser replies from my &#8220;http GET&#8221; requests. Great! Or was it?<\/p>\n<p>It did not take long for me to discover two issues. First, I notice that after running some web browser tests for a minute or so, the ESP8266 would suddenly just stop responding to the requests. In order to verify whether the ESP8266 had crashed, I put a print statement out to the serial port periodically with a timer callback. A new message was sent every 2 seconds. What I noticed was that the serial port messages would still occur after the ESP8266 stopped responding. And using Wireshark to monitor network traffic, my router started sending ARP request to the ESP8266 soon after it stopped responding to &#8220;http GET&#8221; requests.<\/p>\n<p>The ESP8266 did\u00a0not respond to the ARP queries.<\/p>\n<p>I tried to spoof the ARP response with a packet generator but that did not satisfy the router and the network access remained blocked.<\/p>\n<p>The network connectivity is always restored by resetting the ESP8266. That is probably because the WIFI connection and IP\/MAC relationship with the router is established at that time. It seems that there is a timeout period after ESP8266 connection to my WIFI network. After that timeout period, the router wants to renew or refresh it&#8217;s ARP cache by sending an ARP request to the ESP8266.<\/p>\n<p>I did set up a DHCP reservation for my ESP8266 in the router, but that did not resolve the problem.<\/p>\n<p>I never did get to the bottom of this and could not find an answer on-line from searches and posing a forum question.<\/p>\n<p><strong>Issue2:\u00a0The server will not respond to &#8220;http GET&#8221; requests without initializing a\u00a0DNS<\/strong><\/p>\n<p>Determined to find the root cause of the first issue noted above, I dug deep into the exampe IoT_demo code, I found that a DNS was started during initialization. Was that really needed? I did not think so, especially since I wanted to operate in station only mode, not AP mode. But what I found was that if the DNS was not started, the ESP simply would not respond at all to &#8220;http GET&#8221; requests. After tracing deep into the code, the DNS used was located in China (EspressIf of course!). This made me both uneasy and suspicious. So I changed the DNS to the\u00a0Google DNS IP (8.8.8.8 and 8.8.4.4). Neither one of those worked!<\/p>\n<p>I am not sure if the server&#8217;s failure to respond to requests with starting the DNS was related to the DNS link or something in the callback that periodically (once each 1000 ms) checked the DNS. But this was getting way too complicated for what has been touted as a simple, easy IoT development platform.<\/p>\n<p>With that in mind, I switched development platforms again. This time, to the Arduino IDE version 1.6.1 \u00a0for ESP8266. This platform did not exhibit any &#8220;http GET&#8221; drop-outs during a 23 hours stress test.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: The issues I had with the ESP8266 SDK Version 1.0 have been fixed\u00a0with the Version 1.0.1 release dated 24 April 2015. And now, Version 1.1.1 has been released with &hellip;<\/p>\n","protected":false},"author":1,"featured_media":461,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10],"tags":[],"class_list":["post-426","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alltheposts","category-esp8266"],"_links":{"self":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=426"}],"version-history":[{"count":17,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/426\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/426\/revisions\/651"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/media\/461"}],"wp:attachment":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}