Starting wifi trips brownout

J00003
Posts: 13
Joined: Sun Mar 04, 2018 10:14 pm

Starting wifi trips brownout

Postby J00003 » Sun Mar 04, 2018 11:32 pm

Hello, I'm sorry to ask this question again, as I've been reading about this topic in the forum already for a while, but I'm just stuck right now.

I'm porting a project from the esp12e to the esp32, using the following: I'm trying to enable Wifi and observe that when the code calls esp_wifi_start() this trips the brownout detector and restarts the module. I've tried the wifi scan example code, and it does the same. So pretty sure it's not the code.

The last logs printed before restart are:

Code: Select all

I (89) wifi: wifi firmware version: ebd3e5d
I (89) wwifi: config NVS flash: enabled
I (89) wifi: config nano formating: disabled
I (89) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (99) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (129) wifi: Initt dynamic tx buffer num: 32
I (129) wifi: Init data frame dynamic rx buffer num: 32
I (129) wifi: Init management frame dynamic rx buffer num: 32
I (129) wifi: wifi driver task: 3ffc031c, prio:23, stack:4096
I (139) wifi: Init static rx buffer num: 10
I (139) wifi: Init dynamic rx buffer num: 32
I (139) wifi: wifi power manager task: 0x3ffc4f5c prio: 21 stack: 2560
W (149) phy_init: failed to load RF calibration data (0x1102), falling bacck to fullcalibration

Brownout detector was triggered
I've read here in this forum that enabling wifi, and specifically doing full calibration uses a lot of current (upto 500mA), so I suspect that I have some power issue here.

Here's why I'm stuck.
I've hooked up a scope and traced the power line on pin2.
When the module is idling (ie: waiting for download), I measure 3.26V.
When I start my test code (bootup; reset gpio23, wait for 10s; enable gpio23; try to enable wifi). I can see there is a small dip on the power line but only to about 3.10V for ~20ms. (See attached jpg).
Note: I used a gpio23 pin to drive a LED on ch2, and enable it just before calling esp_wifi_start().

But if setup a single mode falling edge trigger for 3.00V, it never fires.
The brownout level is configured at the default 2.43V.

I've tried a number of things:
  • - different external USB power supply
    - change clock rate from 160MHz to 80MHz
    - disable brownout detection; bad idea anyway as this caused weird crashing elsewhere (as also documented in this forum).
    - try a different module (and breakout board) I have 2 of the same.
    - solder 10uF cap. (electrolytic) across pin 1 & 2 on the seeed breakout board
    - tried a 1000uF cap on the breadboard
    - tried ESP-IDF v3.0 - rc1
    - updated to the latest version of ESP-IDF (git log -1: Merge: b6fae219 9fb2d459; Author: Jiang Jiang Jian <jack@espressif.com>; Date: Fri Mar 2 18:54:39 2018 +0800)
    - tried to erase the NVS as suggested in this forum
The only thing I haven't tried yet is a different USB cable (from PC to the breadboard supply).

From my measurements, I'm not even close to the 2.43 brownout level, so not sure why it's triggered here.
Also curious about the time the power would have to dip below 2.43 for the BOD to fire.

Any other ideas or suggestions to get this working?
Thanks,
J

J00003
Posts: 13
Joined: Sun Mar 04, 2018 10:14 pm

Re: Starting wifi trips brownout

Postby J00003 » Mon Mar 05, 2018 1:31 am

See the trace below.
Last edited by J00003 on Fri Mar 09, 2018 12:27 am, edited 2 times in total.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Starting wifi trips brownout

Postby ESP_Sprite » Mon Mar 05, 2018 1:47 am

Are you sure the timebase of your measurement is correct? Calibration tends to give very quick spikes of power use; if your timebase is incorrect you may miss those. Also, what does your wiring look like? If you have a breadboard and breadboard wires between the ESP32 and power supply, these may have too large a resistance/impedance to feed the ESP32 power when these spikes happen.

J00003
Posts: 13
Joined: Sun Mar 04, 2018 10:14 pm

Re: Starting wifi trips brownout

Postby J00003 » Mon Mar 05, 2018 2:24 am

IMG_0303.jpg
scope trace 1
IMG_0303.jpg (127.42 KiB) Viewed 18670 times
Above is the scope trace that I referred too, so you can see the timeline.
The trace's timebase is course (@ 50ms/div) to show how long the gpio pin (ch2) is high. It is enabled right before the call to esp_wifi_start(), and reset to low, on test code startup. I am using this as a reference to see when the start function is called.

The wiring is as follows:
- breadboard supply has pins that plug directly into the power rails of the breadboard
- using jumper wires from the power rail to pin 2 and from the ground rail to the GND pin (next to pin 37) of the seeed board
- scope probe connected to the +ve lead of the 10uF cap solder directly to the seeed breakout board. (I left a short 3mm pigtail on the bottom of the cap for the probe).

The scope is not top-notch, but still pretty good at 60MHz. I try to capture something with the trigger level at 3.00V and 5ns. But no trigger after many attempts. (over 20).
I have the probe connect on the cap, as noted above, avoiding all the resistance, and other artifacts from the breadboard.
Does this seem reasonable?

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: Starting wifi trips brownout

Postby Vader_Mester » Mon Mar 05, 2018 9:22 am

IS there anything else on the board that can be powered up while you are trying this?

Also the breadboard is not so power efficient, and a good quality USB cable is required.
I hade the same issue before, then I swapped the USB cable, and problem gone.
I always used the one of the Devkit boards, nothing else and it seems to work either from an externally powered USB hub, or from my Laptop's USB port.
I used my phone charger cable from my LG, which is rated to 2A charging current, and it's a pretty good cable. It is also short (about 1m), so it's not problematic.

Also, how do you get your 3.3V-s to the ESP? I guess your board has an LDO (Low Dropout Voltage Regulator) which generates the 3.3V from the 5V supply. Make sure you have a capacitor before and after the LDO as well.
An LDO is a stable device, but the voltage difference from 5V to 3.3V (1.7V) is dropped accross it, and this power difference is dissipated as heat. Additionally if the LDO is has a lower power rating, the dropout voltage will be higher.
If your LDO must supply power over it's rated voltage, it might not be able to keep the voltage stable, and it will drop down.

So if your LDO must supply 300mA for example for a short amount of time, it means that you need at least 5V, and 300mA plus about 10% driveing power.
If you only use a big capacitor at the ESP side, then after the capacitor discarges to supply the ESP current spike it needs to be recharged, which can come up to 500mA-s for a short time depending on capacitor size. This is sometimes too much for the LDO and it will drop down it's voltage from 3.3V, addionally, the bigger current draw is sensed by the USB supply very slowly, and might not have time to compensate so everything is overloaded.
So make sure your wiring and USB supply is good enough.
(Additionally, usually on these boards, you have tons of other ICs that use the 3.3V supply even when not needed, like the USB-UART converter, LEDs on the board, etc. LEDs are about 10-20mA each.

You can also try to measure current. Since you have the scope, you can measure the current, using Ohm's law.
If you have a low value shunt resistor, in your case 0,5ohm is good, then you connect this between the ground of your ESP board and the ground of your power supply. (Essentially in seires with the grounds).

With your scope, try to measure the voltage across the resistor, which will determine the current through the entire system.
(R= U/I) => U=RxI, where U is the voltage between the 2 pins of the resistor, I is the current through the system.

Based on Ohm's law, the current thoguh your resitor is the same as through the entire system.
So in case of the 0,5ohm resistor, at 500mA load, the voltage across the resistor is 0,25V. If your scope is sensitive enough, you can use a smaller resistor (In case of a 0,1ohm resistor, at 500mA load, the voltage is 0,05V (50mV) on the resistor).

If you have 2 probes on the scope (as you do), 1 probe on 3.3V supply at the ESP, 1probe across the resistor, and there you have both current and voltage on the same display, which can debug the issue further more.
If you can measure the standby current (ESP doing nothing), you can see the static current consumption, which will inducate is if something is eating more current than it should.

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

J00003
Posts: 13
Joined: Sun Mar 04, 2018 10:14 pm

Re: Starting wifi trips brownout

Postby J00003 » Wed Mar 07, 2018 1:41 am

Thanks for your comments & suggestions.
Here are some answers to the questions you posted:
- no, there is nothing else on the breadboard, other than the seeed breakout and one LED+2K on gpio23.
- I've tried different power sources (pc's, wall-wart's), no difference
- I've not tried a different USB cable yet. I need to find a different one to try.
- I've also re-soldered the power and gnd pins of the ESP-WROOM-32 on the breakout board, did see a suggestion to try this to ensure a good solder joint. (no change).
- As mentioned, my 3.3V power source is a YwRobot breadboard power supply. It uses ams117, which is not a LDO.
- As mentioned, I have tried caps on pin 1 & 2 of the breakout board.
- I understand your explanation regarding the cap recharging, etc, but the scope trace doesn't show anywhere near the voltage drop to trigger the BOD at 2.43V. If the scope showed a significant drop, I could understand why BOD is tripping.
- I did attempt to measure current with a 1ohm shunt, but it was only 1/2W and getting too warm from carrying too much current. I need to find a higher wattage version and try again. This may shed some light, as you have described.

I'll try a different cable and report back.

J00003
Posts: 13
Joined: Sun Mar 04, 2018 10:14 pm

Re: Starting wifi trips brownout

Postby J00003 » Fri Mar 09, 2018 12:25 am

So, I have solved the problem. I believe that there was some kind of grounding issue.
As mentioned above, I had grounded the Seeed breakout board from the gnd pin on the bottom of the board, ie: beside pin #37 to my bottom breadboard rail. Now, in addition to that ground, I have also connected pin 1 on the Seeed breakout board to the top ground rail of my breadboard. This is working as I hoped, ie: can start Wifi without BOD.

This does make some sense as this is were I have the cap wired in, ie: across pin 1 & 2.
But, if I remove the cap, it still works properly, which is not what I expected.

I also did another trace with the scope, and found that the power dip is a little more (down to ~2.90V, roughly 200mV more than before), but the BOD does not trip.

Thanks for the help, hopefully someone else finds this post useful.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Starting wifi trips brownout

Postby snahmad75 » Thu Feb 21, 2019 2:55 pm

I need to detect brownout early. I manage to check my GPIO pin if goes down which is working for me.

I will stop any writing to SD card. but I also need to stop Wifi as well. how can I do Wifi stop. Is there any method.

RickTracer
Posts: 1
Joined: Wed Jun 03, 2020 7:21 am

Re: Starting wifi trips brownout

Postby RickTracer » Wed Jun 03, 2020 7:26 am

Just posting this if it helps anyone else as I too struggled with WiFi startup causing brownout errors and panic attacks, even with a decent LDO. In my case I had the T5 Touch 5 (GPIO 12 MTDI which impacts boot mode and Flash voltage) hooked up as a capacitive touch sensor. If I unhooked this then the startup worked (so I just switched to the T2 GPIO 2 pin instead, could have played with setting the pin as input after wifi start but this was simplest for my case).

Hope that helps someone!

Who is online

Users browsing this forum: No registered users and 126 guests