Skip to content

Latest version draws too much energy - seems that WiFi is enabled by default #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elFallino opened this issue Nov 29, 2016 · 22 comments
Closed

Comments

@elFallino
Copy link

I updated today and now the esp32 fails to boot. It seems that the FTDI adapter can not provide enough energy.
I already had that problem before (with previous versions of this plugin) as I tried to run a sketch that uses WIFI without additional power source.

So I guess that the latest commits enable WiFi by default. In that case I think that WiFi should explicit be enabled by user code.

@me-no-dev
Copy link
Member

the stack is not started, just the radio. You should not power the esp from FTDI though. Get a proper LDO to 3.3V

@elFallino
Copy link
Author

I added a 3.3V buck converter, but radio was not started automagically in previous version, was it?
If so, I still think that it would be better to keep radio disabled until user code activates WiFi / BT.

@igrr
Copy link
Member

igrr commented Nov 29, 2016

The difference from the previous version is in RF calibration process. Now it takes slightly longer and needs more current.

@clowrey
Copy link

clowrey commented Dec 1, 2016

The latest version is also running at 240mhz vs 160mhz previously which means it draws more power overall too, I know that will be configurable in the future. My Espressif dev board draws 160ma now from 120ma previously.

Do you have plans/is it possible to have the RF calibration and all radio functions not start up until they are called/initialized by the Arduino IDE? maybe this is already possible from the IDF directly?

@igrr
Copy link
Member

igrr commented Dec 1, 2016

There seems to be a regression in the ESP-IDF that wifi initialization only works correctly when it is called pretty early on. Someone (myself or one of my colleagues) will look into this next week. Once we fix this, WiFi initialization can be moved to a later stage, when e.g. WiFi.begin is called. @me-no-dev has already done all the work on Arduino side, we just need to figure out what goes wrong with WiFi init. Once WiFi init is moved from startup code, we can postpone RF init as well.

Edit: ESP-IDF does have an option not to initialize RF in startup code.

@me-no-dev
Copy link
Member

The force has been restored!
Do not include WiFi.h and phy will not start.

@clowrey
Copy link

clowrey commented Dec 1, 2016

Now the dev board only draws 80ma at 240mhz when previously it was 150ma with WiFi always on :)
I have a speed comparison of some different Arduino boards including current build of ESP32 here if you're interested: https://hilo90mhz.com/arduino-esp32-esp8266-101-speed-test-comparison-chart/

@me-no-dev
Copy link
Member

Oh this is really good! I can tell I need to optimize pinMode pulls to drop it under 1us :)
What I would really like to see in the table are some STM32 MCUs :) Other than that ESP32 seem to top them all :P

@clowrey
Copy link

clowrey commented Dec 1, 2016

I'm guessing something changed in the pinMode function since earlier Nov as my previous test shows it 0.526 us even at the lower clock speed.. I was having trouble getting the STM32Duino core working with some STM32 dev boards so cant include those yet.. But I did just add a comparison to the Teensy 3.6 board with NXP K66 Cortex M4 that someone else ran these same tests on. The ESP32 compares pretty well against that chip, some areas are a little slower, some faster. I bet there is room for improvement with some optimization too ;)

@me-no-dev
Copy link
Member

yes pinMode has changed because some pins have pull up/down settings elsewhere. I'll try to improve speed there, but some pins will always pinMode slower than others. If you pinMode pins 16 or 17 you will see a difference (closer to what you had before). I can probably run this against STM32F1 board

@elFallino
Copy link
Author

Thank you for solving this issue.
Where can I buy you a beer? :)

@me-no-dev
Copy link
Member

I live in Bulgaria. You coming by? :D

@me-no-dev
Copy link
Member

@clowrey here are my measurements with the latest commits (note I pinMode pin 16 which is not RTC pin) Added a couple STMs
screen shot 2016-12-02 at 2 14 23 pm

@clowrey
Copy link

clowrey commented Dec 2, 2016

Great! Can you share the google docs file so I can copy some of the results into my spreadsheet for comparison? It might be neat to create a record of improvements from current to future versions of the Arduino ESP32 core

@me-no-dev
Copy link
Member

@sinelabore
Copy link

Hello ,

is there a way to keep WIFI switched off for EPS8266? I did not find any kind of documentation so far. I want to start WIFI in the Arduino sketch later on once needed.

Thanks,
Peter

@me-no-dev
Copy link
Member

ESP8266?

@sinelabore
Copy link

Sorry yes, typo.

@me-no-dev
Copy link
Member

Why ask here :) this is the ESP32 repository. ESP8266 Arduino is here

@pctj101
Copy link

pctj101 commented May 6, 2017

Minor detail

@me-no-dev In regards to your Numbers spreadsheet, I believe the NRF52832 is 64Mhz. (Not sure if your original clock speed was in reference to something else though...)

http://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.3.pdf
7.2.1 CPU performance
The CPU clock speed is 64 MHz.

@me-no-dev
Copy link
Member

@pctj101 It was mostly already made spreadsheet. I added some of the boards, but not the NRF :) do not have one

@Ajioz
Copy link

Ajioz commented Sep 24, 2019

I am having similar bug. This time I lost wifi connection and the router rebooted and got on track. My esp32 displayed correctly and also updated me through the serial monitor that I am connected, however, my esp itself just got stock without actually doing anything. Below is the message print_out:

Connecting to MQTT... [D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:351] _eventCallback(): Reason: 201 - NO_AP_FOUND
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:379] _eventCallback(): STA IP: 192.168.0.142, MASK: 255.255.255.0, GW: 192.168.0.1

Lzw655 pushed a commit to Lzw655/arduino-esp32 that referenced this issue Oct 12, 2023
This is a highly requested item in message boards.  Is there a blocker to enabling it?
blue-2357 pushed a commit to blue-2357/arduino-esp32 that referenced this issue Jul 17, 2024
brentru pushed a commit to adafruit/arduino-esp32 that referenced this issue Oct 22, 2024
…DME (espressif#72)

* Install pip3 which is required for adafruit-nrfutil

* Update travis example in README
dash0820 added a commit to dash0820/arduino-esp32-stripped that referenced this issue Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants