Lightsleep failing on some boards and a question about the WIFI firmware. #12589
Replies: 4 comments 2 replies
-
A long-shot ... similar to the issues I was having on a PICO W until the latest nightly build sorted it. I have been using light and deepsleep on the ESP32-WROOM-32U for a couple of years now without any issues. One test that seems to provide insight is to use a simple program: from time import sleep
from machine import lightsleep
while True:
print ('waiting 2 seconds for a CTRL-C')
sleep(2)
print ('going to lightsleep for 2 seconds')
sleep(0.1)
lightsleep(2000)
print ('woke-up again')
sleep(0.1) and either monitor the supply current or flash an "off-board" LED when it is NOT connected to rshell or Thonny. Your test program should work as well, but I find that when you call deepsleep and maybe lightsleep the print statement does not get executed. So, I use a short sleep() after print statements. |
Beta Was this translation helpful? Give feedback.
-
I assumed you were using a Windows PC. Can you try running your test script directly from a terminal program such as PuTTY? I think the problem is with Thonny, the connection got disconnected while the board went to lightsleep(). This is what I got when I tried to run the test script from Thonny on my Linux PC:
I have no problem while running your test program using a terminal program, for example:
However, some of the output lines were missing. |
Beta Was this translation helpful? Give feedback.
-
I've got some ESP32-S3 DevKit N16R8 (16MB Flash, 8MB PSRAM) boards. This board has 2 USB ports, one marked COM and the other marked USB. Now that I have built my own custom firmwares for all my boards. One firmware (A) has REPL on USB-CDC. The other firmware (B) I disable USB altogether and has REPL on UART. Running your test in a loop on firmware A, I can see that lightsleep() disconnects and reconnects the board from the terminal connection.
I have no issue with firmware-B
The debug messages are due to firmware-B being compiled with With firmware-A I connect the USB port of the board to my Linux PC. With firmware-B I have to use the COM port. Interestingly, the dmesg reports a different USB device type for firmware-A and firmware-B. dmesg for firmware-A:
dmesg for firmware-B:
For now, I am building firmware with "MICROPY_HW_ENABLE_UART_REPL" set to 1 and disabled "USB-REPL" on all boards that support "USB Single Serial". Perhaps I will try to use the USB for other things in a future project, such as connecting it to a USB camera. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the info. It's an very unlikely use case so I'm not going to bugger on about it. I can use and light and deep sleep just fine within normal situations. The thing I found a bit strange is with deepsleep i'm still pulling about 7ma during sleep. I have a soil sensor that I turn on for 5 minutes every hour, the rest of that time its in deepsleep and pulling 7ma according to my power profiler kit. Not sure why but not worth fussing about 7ma on the battery packs I have will last a lifetime! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello brilliant minds,
I have been experimenting with some different variants of the ESP32 which I'm new too. I mostly have used RP2040s in the past.
I purchased a book for Micropython on the ESP32. The book describes the MCU to purchase which appears to be a very old or as some have called it the "original" ESP32. The MCU first up is the Adafruit HUZZAH 32 feather with 4MB Flash (per the bottom of the board).
The silver top of the chip says: ESP32-WROOM-32E.
Of the boards tested, this was the only one the lightsleep example worked as expected. I could re-run it over and over in Thonny (and other IDEs) and there were no issues.
I decided I wanted to learn on a more "modern" board that I could use later for projects.
I picked up an Espressif ESP32-S3 DevKitC-1 N8R8 from an official vendor. This MCU of course looked nothing like the other one I had it was way bigger in size with 22 pins on each side. Silver chip says ESP32-S3-WROOM-1
On this board the light sleep example would work the first time. If you tried to re-run it again it would crash the IDE forcing you to have to pull the plug and plugging in back in. Sometimes it would start to work on the 2nd run but it would die at any given point and also run really slow.
I then tested the Arduino ESP32NANO. This one completely crashed even on the first run, it got partially through and then crashed.
I tried with an Unexpected Maker ProS3 and it would only run once, if I tried to rerun it it would crash. Everytime.
All chips were tested with the stable release of MP and also with the latest build available at the time (a few days ago). Results were the same.
Is there a different way to implement this code on newer ESP32s? Since it only seemed to work on the really old board.
interestingly. a deep sleep version that saves the value of 'i' to the RTC memory worked on all the versions. The code is a bit different and I'm more interested in lightsleep.
Thoughts?? I was going to reach out on Discord and see if the Unexpected Maker can chime in on his boards.
Lastly, is there a way for me to check what the Wifi Firmware version is and how to upgrade it? I found an a step by step from Adafruit for circuitpython but I dont want to load CP just for that purpose. Surely it can be done in MP. Or is the latest and greatest firmware part of the Micropython build you install? Sorry I'm new :(
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions