Why I stopped using the ESP8266 SDK

Update: The issues I had with the ESP8266 SDK Version 1.0 have been fixed with the Version 1.0.1 release dated 24 April 2015. And now, Version 1.1.1 has been released with even more enhancements.

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.

The issues I had were corrected with the addition of the mDNS (multicast domain name server) API. This feature has the ESP8266 advertise  it’s presence, which has made firmware developed using the SDK and my router accessible from the global internet.

Original post (no longer applicable):

esp8266-sdk-ISSUES

I was very hopeful that the ESP8266, with it’s rich programming environment, would overcome the shortcomings that forced me to abandon the NodeMCU/Lua setup for code development.

Wrong!!!

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.

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:

1. The server stopped responding to “http GET” requests

2. The server will not respond to “http GET” requests without initializing a DNS

Issue1: The server stopped responding to “http GET” requests

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 “http GET” requests. Great! Or was it?

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 “http GET” requests.

The ESP8266 did not respond to the ARP queries.

I tried to spoof the ARP response with a packet generator but that did not satisfy the router and the network access remained blocked.

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’s ARP cache by sending an ARP request to the ESP8266.

I did set up a DHCP reservation for my ESP8266 in the router, but that did not resolve the problem.

I never did get to the bottom of this and could not find an answer on-line from searches and posing a forum question.

Issue2: The server will not respond to “http GET” requests without initializing a DNS

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 “http GET” 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 Google DNS IP (8.8.8.8 and 8.8.4.4). Neither one of those worked!

I am not sure if the server’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.

With that in mind, I switched development platforms again. This time, to the Arduino IDE version 1.6.1  for ESP8266. This platform did not exhibit any “http GET” drop-outs during a 23 hours stress test.

Share This:
Facebooktwittergoogle_plusredditpinterestlinkedintumblrFacebooktwittergoogle_plusredditpinterestlinkedintumblr

12 Responses to Why I stopped using the ESP8266 SDK

  1. Chumpon says:

    You may report these issue to the espressif to get $1000 in their bugs bunty program.

    • Thanks for the tip. I am gathering some data for espressoif to support the issue. I’ll post a reply here to let you know how it turns out after I hear back from espressif. A solution to the problem would be the best outcome.

      • facebook-profile-picture Dave St. Aubin says:

        The issues I had with the ESP8266 SDK Version 1.0 have been fixed with the Version 1.0.1 release dated 24 April 2015. As result I am once again using the EspressIf SDK, my preferred development platform for the ESP8266. The problems were corrected with the addition of the mDNS (multicast domain name server) API. This feature has the ESP8266 advertise it’s presence, which has made firmware developed using the SDK and my router accessible from the global internet.

        But since then, SDK version 1.1 dated 26-May-2015 was released. This new version has introduced a couple of new issues which is causing compile/build errors with code that worked flawlessly with version 1.0.1. I have passed these new findings on to EspressIf, hopefully there will be prompt resolution. Until then, I recommend sticking with SDK version 1.0.1 24-April-2015 for code development.

  2. Atif says:

    Hi dear, Thank you for your sharing !
    I’m starting with ESP8266 and my question is : What is actually the more stable to use ? Lua SDK ? Arduino SDK ? or the Espressif SDK ?

    Thank you again

    • facebook-profile-picture InternetOfHomeThings says:

      Thanks for your comment.

      Contrary to what I wrote this post last year, my preferred platform is the EspressIF SDK. However….

      The EspressIF SDK is more complicated, and can be overwhelming for some.

      If you are new to the ESP8266, it would be wise to start off using the Arduino IDE. It is stable, very easy to use and should satisfy almost all of your needs. There are others with different opinions, but I would run as fast and as far as you can from LUA.

      It is important not to overlook your hardware layout. You can avoid many problems and frustrations with a clean setup with proper filter capacitor placement. I have written several articles on this subject.

      Have fun with your projects! ESP8266 is a powerful system on a chip in such a tiny package.

  3. Rohit says:

    hey can i use esp8266 sdk api on ti launchpads or arduino uno to program and communicate with esp8266

    • facebook-profile-picture InternetOfHomeThings says:

      The ESP has a serial interface which provides a method to communicate with any device with a serial port, including the ti launchpad and the Arduino Uno.

      Here are 2 of my implementations:

      http://internetofhomethings.com/homethings/?p=1277

      http://internetofhomethings.com/homethings/?p=1069

      • Rohit says:

        Have you used it on TI Launchpad? If yes, how? If not, what would you suggest me to do, so that I can do the same on TI Launchpad?

        Regards,
        Rohit

        • facebook-profile-picture InternetOfHomeThings says:

          Sorry, I have no experience using the TI LaunchPad. I had a quick looks at the specs and even the lowest end package includes a UART. That would be the obvious and most straight-forward way to communicate with an ESP. But the TI documentation did not wow me with a sense that this would be simple to pick up without some significant learning. It also has a SPI bus that could be used, but that would require some custom software on both ends.

          What is your application that makes the TI LaunchPad so attractive?

  4. Praveen Kumar says:

    I'm facing a problem in stable operation of NodeMcu, I used the same code on to Blink an LED from browser, but it becomes unstable after few operations, if I close the tab and try to type same IP(Of Nodmc) on browser the page won't load(Html code on NodeMcu), it stop responding, how can I solve my problem? Will disconnecting client which is previously connected will help? If yes, how to do that? If No, can I get a solution from you?

    Waiting for your reply

  5. Praveen Kumar says:

    I'm facing a problem in stable operation of NodeMcu, I used the same code on to Blink an LED from browser, but it becomes unstable after few operations, if I close the tab and try to type same IP(Of Nodmc) on browser the page won't load(Html code on NodeMcu), it stop responding, how can I solve my problem? Will disconnecting client which is previously connected will help? If yes, how to do that? If No, can I get a solution from you?

    • facebook-profile-picture InternetOfHomeThings says:

      Are you using Lua?

      If so, I would suggest dumping it ASAP. While there are loyal fans of it, that platform was very unstable in my experiences. I wasted way too much time trying to make it work. That was 1.5 years ago.

      But if you insist on using Lua, I suggest you add some debug code to figure out what is going on. Since you are losing the http interface accessible from a browser, I would add print statements to the serial link and monitor the output during operation. Perhaps a heartbeat message at a one second interval in your loop() function. If this message is not coming out when your browser interface fails, the code has crashed. You can also output something when the get request is received from the browser. I would also monitor the heap to see if you have a memory leak.

      I have several posts on my blog with very stable Web servers. My recommendation is that you try one of these solutions. You will be pleased with the results.

      I have an ESP running continuously for over 8 days now with my server with no disruption in connectivity. Check out the live results here.

      https://thingspeak.com/channels/33251

      Here is my most current Web server framework. Please feel free to use it. It will certainly resolve the stability issues you are experiencing.

      http://internetofhomethings.com/homethings/?p=1486

Trackbacks/Pingbacks

  1. Usando LUA en ESP8266 / NodeMCU con LuaLoader y ESPlorer – Mind Powered

Leave a Reply