Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

8266 Weirdness (was: LUA weirdness)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by HowardP on Sat May 20, 2017 3:20 pm

So here's an update after much research, testing, and many discussions elsewhere.

I hope Adafruit will update several things accordingly.

First, please consider shipping the Huzzah ESP 8266's with a current build because the LUA 0.9.5 build 20150318 shipped is considered ancient, buggy, and is missing a lot of things unwitting users won't know are missing.

I understand reflashing the devices creates an extra labor step, but considering the aggravation it will save others, I think it is well worth it. Many of the problems I and others have written about on the forums here simply go away when the latest NodeMCU firmware is flashed.

Granted, the Huzzah ESP8266 learn page does say :

Each HUZZAH ESP8266 breakout comes pre-programmed with NodeMCU's Lua interpreter. As of this writing, we ship with NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4 but it may be more recent [sic]


But if you all decide it's too much of a hassle to upgrade it before shipping, the above should read, at the very least: "powered by Lua 5.1.4, but there are more recent versions that may solve many problems you might encounter at the early stages."

These problems, some of which have been documented here, but latest firmware solves, include:

  • tmr.delay's below 100000 microseconds in a tight loop cause resets every c.a. 1.5 seconds.

The tmr.delay() is used in at least two of the learn page's examples. It is natural hacking instinct to take that code, and just tweak the timer shorter, as I and at least one other person here did. As soon as you do that, the device starts resetting. The next natural instinct of both a newbie and an experience developer is to assume Adafruit's provided a reasonably working platform, so: "the problem must be my code." And we go hunt down the documentation. Here's where the timer problems get more squirrely and we go down the rabbit hole. Some of the basic timer functions are not implemented in that ancient LUA version, but the docs do not present that info without a lot of digging (which a newbie won't know how to do).

Also, please note that the tmr.delay() is frowned on by the NodeMcu dev's - they are strongly pushing for its deprecation, suggesting the use of tmr.alarm() and callbacks, but if you don't (know to) upflash, then:

  • tmr.create() is nil (undefined)

Unfortunately, tmr.create() is what you'd use for almost all basic timer functions found in the docs - but it's undefined in the old LUA version.

I don't think it should be a concern that having to show how to flash a .bin into the device might be more documentation work than you want, because, as you know, it's actually pretty easy. Especially since they've set up a cool "cloud build" https://nodemcu-build.com/index.php and the NodeMCU Programmer or the PYProgrammer are simple.

I do realize of course, that the Arduino IDE approach is better for many people, but the LUA platform, when it is set up correctly, is actually very convenient for initial testing and prototyping. - not to mention the bazillion useful examples out there now using LUA.


thanks for your time (and maybe tmr.create() too? :)
- Howard
Last edited by HowardP on Sat May 20, 2017 8:29 pm, edited 1 time in total.

HowardP
 
Posts: 91
Joined: Fri Apr 03, 2015 6:42 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by adafruit2 on Sat May 20, 2017 4:48 pm

hiya thanks! we've put in a link to how to create custom Lua firmware for your ESP8266 and then how to flash it!

adafruit2
Site Admin
 
Posts: 19370
Joined: Fri Mar 11, 2005 7:36 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by duaneohall on Tue Jul 18, 2017 7:22 pm

I just received a shipment with Adafruit ESP-12S modules from Digi-Key. The datasheet associated with these parts indicates a UART interface, but when I installed the module in my embedded system, it is spitting out LUA information and wont respond to AT commands. It would appear that either the datasheet on Digi-Key is the wrong one or the wrong modules were supplied to Digi-Key., and I can't use them with the LUA firmware. How can I program these modules to the correct firmware? I don't have any programming interface modules, as I expected them to perform per the spec sheet.

duaneohall
 
Posts: 2
Joined: Tue Jul 18, 2017 7:18 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by adafruit2 on Tue Jul 18, 2017 7:28 pm

hmm dunno anything about an AT interface - we've only sold it with LUA. you can try checking out
http://www.electrodragon.com/w/ESP8266_ ... d_firmware
?

adafruit2
Site Admin
 
Posts: 19370
Joined: Fri Mar 11, 2005 7:36 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by duaneohall on Tue Jul 18, 2017 7:34 pm

Then there should be some sort of LUA documentation with Digi-Keys module. I now have modules with documentation that doesn't match. Do you have a link to LUA documentation and command set?

duaneohall
 
Posts: 2
Joined: Tue Jul 18, 2017 7:18 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by adafruit2 on Tue Jul 18, 2017 7:38 pm


adafruit2
Site Admin
 
Posts: 19370
Joined: Fri Mar 11, 2005 7:36 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by normlane on Mon Aug 07, 2017 8:25 pm

Im getting what I think is the same problem but I'm not using Lua. I'm using Arduino 1.8.3

I took off everything but the servo board and the feather but it didn't make any difference. When the code hits a tight loop the 8266 crashes with a stack dump and then restarts.

attachment=0]servo.txt[/attachment]
New Text Document.txt
Output and stack dump
(892 Bytes) Downloaded 41 times
New Text Document.txt
Output and stack dump
(892 Bytes) Downloaded 41 times
I'
Attachments
servo.txt
(1.59 KiB) Downloaded 39 times

normlane
 
Posts: 128
Joined: Thu Apr 01, 2010 5:39 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by normlane on Mon Aug 07, 2017 9:16 pm

This fixed the problem but it sure seems like a bug.

void loop(){
do {
delay(1000);
}
while (true);
}

normlane
 
Posts: 128
Joined: Thu Apr 01, 2010 5:39 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by HowardP on Mon Aug 07, 2017 9:48 pm

Hi Normlane,

can you list the Adafruit part numbers for each thing you're using?


Code: Select all | TOGGLE FULL SIZE
    void loop(){
    do {
    delay(1000);
    }
    while (true);
    }

where in the servo code did you put that code?

It might be obvious - and now may be irrelevant : make sure you have enough power (amperage) to the board(s) and servos. If a servo kicks in and draws more power, it can cause an "under volt" - when the voltage drops too low, all microcontrollers do weird things --- usually they just reset over and over, but they can also keep going with lost marbles ...

hth
- Howard

HowardP
 
Posts: 91
Joined: Fri Apr 03, 2015 6:42 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by normlane on Mon Aug 07, 2017 10:33 pm

2821 - feather huzzah 8266
2928 - servo featherwing
1404 - 2X Analog Feedback Servo


_________ does not affect bug
1083 - ADS1015 12-Bit ADC - 4 Channel with Programmable Gain Amplifier on proto board - to read servo feedback

normlane
 
Posts: 128
Joined: Thu Apr 01, 2010 5:39 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by normlane on Tue Aug 08, 2017 4:32 am

I put the delay in the loop() function.

normlane
 
Posts: 128
Joined: Thu Apr 01, 2010 5:39 pm

Re: LUA Weirdness (was: How thoroughly does Adafruit test pr

by HowardP on Tue Aug 08, 2017 3:17 pm

Can you post the entire code including the delay ?

I'd like to replicate this.

Partly due to experiments related to this thread, I've learned and seen that the 8266 has some odd (counter-intuitive) behavior in looping. It seems to be independent of language, but does depend on chip version.

There is a version 0 and 1 ... if you're interested in determining which you have, I can post the code ...

HowardP
 
Posts: 91
Joined: Fri Apr 03, 2015 6:42 pm

Please be positive and constructive with your questions and comments.