-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Expected behavior
esp8266 does not hang
Actual behavior
esp8266 hangs (does not return from sleep no matter the level changes on the trigger pin)
Test code
Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.
-- Physically grounding D7 with INT_LOW specified hangs ESP with node.sleep
gpio.mode(7,0); print("start",gpio.read(7),"\n")
cfg={}
cfg.wake_pin=7
cfg.int_type=node.INT_LOW
cfg.resume_cb=function() print("resume",gpio.read(7),wifi.sta.getip()) end
cfg.preserve_mode=true
node.sleep(cfg)
Terminal
test 1: ok: high to low
gpio.mode(7,0); print("start",gpio.read(7),"\n")
start 1
cfg={}
cfg.wake_pin=7
cfg.int_type=node.INT_LOW
cfg.resume_cb=function() print("resume",gpio.read(7),wifi.sta.getip()) end
cfg.preserve_mode=true
node.sleep(cfg)
resume 0 nil
test 2: ok: low to high
gpio.mode(7,0); print("start",gpio.read(7),"\n")
start 0
cfg={}
cfg.wake_pin=7
cfg.int_type=node.INT_HIGH
cfg.resume_cb=function() print("resume",gpio.read(7),wifi.sta.getip()) end
cfg.preserve_mode=true
node.sleep(cfg)
resume 1 nil
test 3: hangs: high to high (no change), but use INT_HIGH so level should trigger immediately, fails with hang
print("now start with the trigger level already set")
now start with the trigger level already set
gpio.mode(7,0); print("start",gpio.read(7),"\n")
start 1
cfg={}
cfg.wake_pin=7
cfg.int_type=node.INT_HIGH
cfg.resume_cb=function() print("resume",gpio.read(7),wifi.sta.getip()) end
cfg.preserve_mode=true
node.sleep(cfg)
Soft restart by user command
Soft restart by user command
r$
test 4: hangs: D7 is low and start node.sleep with INT_LOW hangs just like test 3.
Furthermore no amount of high and low cycling on D7 returns the ESP from sleep.
Hard reset required as with test 3.
test 5: hangs: any edge trigger, hangs
INT_UP, INT_DOWN and INT_BOTH hang the ESP
Other things tried
- a really old build with release DTS: 202002231746 with the same result.
- minimum module builds for new and old. just
modules: file,gpio,net,node,tmr,uart,wifi. - Pins D1, D2, D5, D6 tested with current build
- Same result in all cases
NodeMCU startup banner
NodeMCU 3.0.0.0 built with Docker provided by frightanic.com
branch: release
commit: 36cb f9f017d356319a6369e299765eedff191154
release: 3.0.0-release_20211229 +25
release DTS: 202402250804
SSL: false
build type: float
LFS: 0x40000 bytes total capacity
modules: adc,bit,cron,dht,file,gpio,i2c,net,node,ow,pwm,rtcmem,rtctime,sntp,spi,struct,tmr,uart,wifi
build 2024-09-12 18:10 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
cannot open init.lua:
user_config.h snippet
// GPIO_INTERRUPT_ENABLE needs to be defined if your application uses the
// gpio.trig() or related GPIO interrupt service routine code. Likewise the
// GPIO interrupt hook is required for a few modules such as rotary. If you
// don't require this functionality, then commenting out these options
// will remove any associated runtime overhead.
#define GPIO_INTERRUPT_ENABLE
#define GPIO_INTERRUPT_HOOK_ENABLE
// If your application uses the light sleep functions and you wish the
// firmware to manage timer rescheduling over sleeps (the CPU clock is
// suspended so timers get out of sync) then enable the following options
#define TIMER_SUSPEND_ENABLE
#define PMSLEEP_ENABLE
Hardware
Describe which ESP8266/ESP32 device you use and document any special hardware setup
required to reproduce the problem.
ESP8266: D1 Mini, 12E, 12F with 10k pullup on D7 with push button switch to ground
D7=high and INT_LOW works when D7 pulled down
D7=low and INT_HIGH works when D7 pulled high
D7=low and INT_LOW hangs ESP and requires hard reset
INT_UP, INT_DOWN and INT_BOTH hang the ESP
Hard to imagine this is a bug, but nothing in the docs
https://nodemcu.readthedocs.io/en/dev/modules/node/#nodesleep
indicates additional hardware or software setup required
Perhaps this just requires an update to the documentation with the missing element(s).
Build Environment
- Docker Desktop 4.33.1 (161083)
- Git-2.46.0-64-bit
- Windows 11