ESP32 boot time with Arduino

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

ESP32 boot time with Arduino

Postby dmaxben » Thu Nov 16, 2017 6:31 pm

Hi everyone...not new to Arduino, but new to the ESP32...very excited about working with it!

Quick question I had, how quickly can the ESP32 go from initial power on (ie, applying 3.3v) to setting a GPIO "high"?

The reason I ask, is because I have an external CAN transceiver that automatically controls the enable pin on the voltage regulator for my circuit. When CAN bus traffic is detected, the CAN transceiver applies voltage to the enable pin of the voltage regulator to power up the ESP32.

The CAN transceiver also has a separate "mode" input pin on it that is attached to a GPIO of the microcontroller. When the mode pin is set HIGH by the microcontroller, the CAN transceiver knows to stay awake and keep the voltage regulator ON.

If the CAN transceiver wakes up, turns on the voltage regulator, but then does not see the "mode" input from the microcontroller go HIGH within 150ms or so, the CAN transceiver goes back to sleep and turns the voltage regulator back off (thus killing power to the ESP32).

SO my question is, running Arduino, is the time period from "power applied to ESP32" to ESP32 booting, and setting an output pin HIGH....under roughly ~100mS?

Thanks
Ben

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 boot time with Arduino

Postby chegewara » Fri Nov 17, 2017 4:07 pm

This is not exactly answer on you question, but i think you may be interested. ESP32 has deep sleep mode and can be wake up by signal on gpio and ready to work faster than you need.
http://esp-idf.readthedocs.io/en/v2.1/a ... ep%20sleep

http://esp-idf.readthedocs.io/en/latest ... ep%20sleep

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: ESP32 boot time with Arduino

Postby dmaxben » Fri Nov 17, 2017 4:15 pm

chegewara wrote:This is not exactly answer on you question, but i think you may be interested. ESP32 has deep sleep mode and can be wake up by signal on gpio and ready to work faster than you need.
http://esp-idf.readthedocs.io/en/v2.1/a ... ep%20sleep

http://esp-idf.readthedocs.io/en/latest ... ep%20sleep
I did some reading on that and considered it....but ideally I would like the whole thing to just be completely shut down for true ZERO current draw when the vehicle is off.

Between a couple other things in the circuit, quiescent draws of the 5v and 3.3v voltage regulators, sleeping current draw of the ESP32 etc....it would really be preferred to just shut everything off completely at the main 5v voltage regulator itself.

I guess I could do some tests here on the bench to time the actual delay from power on, booting the Arduino sketch, and setting GPIO 18 "high"........but just to be sure it would be nice to have something backing it up, I checked the datasheet and couldnt find much.

I dont need any of the other peripherals booted until later, literally all I need to do as priority #1 when power is first applied, is immediately set GPIO-18 "high"

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: ESP32 boot time with Arduino

Postby dmaxben » Fri Nov 17, 2017 6:00 pm

Ok I did some simple tests with the ESP32 hooked up to an Arduino Due.

It looks like the boot time from off to setting the GPIO-18 high is 517ms? Does that sound right? Seems awful slow...... half a second for the ESP32 to boot????

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: ESP32 boot time with Arduino

Postby dmaxben » Fri Nov 17, 2017 6:45 pm

I guess maybe I could also put a pullup resistor or a capacitor or something on that pin??

So when the CAN transceiver enables the voltage regulator, the CAN transceiver will see the "mode" pin immediately go high for 100mS or so, to give the ESP32 a chance to boot, and then set/hold the pin high by itself???

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Re: ESP32 boot time with Arduino

Postby dmaxben » Sun Nov 19, 2017 6:03 pm

Ok how about this workaround...

Two options could theoretically work, let me know what you guys think.

Option 1, add a weak pull-up resistor to the "MODE" control from the ESP32 to the CAN transceiver.

I assume at boot up, all the GPIO's on the ESP32 are initially configured as inputs. So with a pullup resistor on there, as soon as the CAN transceiver powers up the voltage regulator, it sees +3.3v on its "mode" pin and transitions to normal awake/running mode...this should give the ESP32 a chance to boot, set the GPIO as an output, and keep it high. Then when the ESP32 wants to power down the system, it pulls the GPIO "low" (current is limited via the resistor though to prevent the ESP32 from shorting/burning out), and then the CAN transceiver kills the voltage regulator as its supposed to when it sees its "mode" pin go low.

I figure if I use a 680 ohm resistor, that should limit the current flow through the ESP32's GPIO to around 5mA when it pulls the pin low to make the CAN transceiver go to sleep and disable the voltage regulator.

Option 2, add a capacitor between the regulator enable pin, and +12v input. Then, when the CAN transceiver gets the CAN bus wake up signal and applies +12v to the voltage regulator enable pin, this charges the capacitor which holds the voltage regulator enable input "high" for an extra 200mS to give the ESP32 a chance to boot and "take over" (set the CAN transceivers mode pin high) even though the CAN transceivers initial "power up" pulse to the voltage regulator enable input is only a short 100mS long.

Thoughts?

In my option, it was pretty dumb of the CAN transceiver's manufacturer to design it so the "enable" transition period/delay is such a short interval before it says "ok I got no response from the microcontroller, back to sleep/regulator off".

Unless there is a way to make the ESP32 boot faster? The 500mS I measured really is agonizingly slow...
IMG_6613.JPG
IMG_6613.JPG (126.49 KiB) Viewed 14393 times

EdHayes3
Posts: 5
Joined: Sun Feb 21, 2021 1:30 am

Re: ESP32 boot time with Arduino

Postby EdHayes3 » Thu Aug 11, 2022 9:03 pm

I know this is way old, but the deep sleep with an interrupt is the best solution. deep sleep uses near zero power. It could last on a small battery for months and months without being woken up. I think Deep Sleep power consumption is 10-15 uA. Also, get a better voltage regulator if you have quiescent power issues. You should be able to find a regulator with 10-40 uA of quiescent current for an LDO type, maybe 100-200 uA for a buck regulator that allows for 12v input. But you probably don't need a buck since the car will be running when the device is using power.

Your whole solution would be less than 250 uA quiescent current when all in deep sleep, likely much less if using an LDO. Your car will still have no problem being unpowered for months.

Who is online

Users browsing this forum: Google [Bot] and 127 guests