Wierd crashing issue with ESP32 - Page 1
Forum section: electronics / general

author: MatCat
author_rank: Frequent Contributor
timestamp: May 20, 2018, 11:20:24 pm
content: I just got back a board for a deisgn I am using ESP32 Wrover module, I have an FTDI header for programming, DTR and RTS go to transistor pair as shown in espressif layouts, VCC from FTDI is not used. Now here is the wierd part, Everything runs fine and stable IF I am not using WiFi, BUT as soon as I use WiFi, board becomes unstable and freezes or resets (with no FTDI plugged in), NOW IF I plug in the FTDI, all of a sudden WHAM everything works PERFECT, No crashing, no resetting, WiFi works like a champ. Unplug the FTDI, and freeze or reset loops. Turn off WiFi function and works just fine with or without FTDI. Now even more wierd is the FTDI doesn't even need power! I can plug it in with no USB going to it, and the board runs perfectly stable, unplug it, crash. Without the FTDI plugged in I measure infinite resistence from GND to DTR / RTS, with it plugged in and not powered I measure 35M from DTR and RTS to both VCC AND GND, which results in 2.5V potential on DTR / RTS with no power to FTDI. I tried pull ups AND pull downs on DTR / RTS lines, makes no difference for stability. So I am really stumped on this one.

author: lucazader
author_rank: Regular Contributor
timestamp: May 21, 2018, 03:56:55 am
content: You should check that the 3v3 line can sustain peak currents of 500mA at a minimum without dropping too low.The esp32 has rather large current peaks.The chip could be drawing just enough power from the DTR, CTS, TX and RX lines from the FTDI to sustain it'self when the wifi is on, compared to when the FTDI is disconnected.I have had many issues over the years with debug UART lines supplying power to a device causing it to not reset, or have different behaviour during debugging.

author: MatCat
author_rank: Frequent Contributor
timestamp: May 21, 2018, 06:13:27 am
content: I could understand this if the FTDI was plugged in, but I don't understand how this could happen with in unpowered? (Granted it does suck in power from the other lines), The voltage isn't sagging, though it does get quite noisy

author: MatCat
author_rank: Frequent Contributor
timestamp: May 21, 2018, 06:24:11 am
content: So I gave it a try just to see, I hooked up the 3.3V rail to lab supply with 5A limit, it never drew more tehn 160mA (1117 onboard was also getting powered from 5V rail), so plenty enough current available but still same issues.

author: Psi
author_rank: Super Contributor
timestamp: May 21, 2018, 06:46:37 am
content: Need full schematic.Something about your DTS/RTS circuit doesn't sit right with me.I know you said you tried pullup/down on DTR/RTS but need to scope the reset line to be sure that's not the issue.Also check the ESP32 IO for any that are special purpose or used by the bootloader.Maybe one IO is for an LED to show when WIFI is connected and you're trying to use it for something else

author: georges80
author_rank: Frequent Contributor
timestamp: May 21, 2018, 03:48:12 pm
content: Disconnect Collector of Q3 from your ESP reset input and see what happens - that will isolate all your FTDI 'stuff'.Note, that WIFI can/does draw high peak currents, so looking at a power supply and saying it never draws more than xyz mA is not a valid measure. The PS will only display average current. You want to use a regulator that has fast transient response and also ensure you have enough bulk capacitance on the regulator output.cheers,george.

author: lucazader
author_rank: Regular Contributor
timestamp: May 21, 2018, 07:14:22 pm
content: georges80 is right about the transient nature of wifi power draw.If you put a current shunt in the circuit and looked at the current through it you would see very short spikes, in the order of 10s of uS, up to around the 500mA region.In saying this, unless the wires you are using to hook up to your supply are terrible quality and have high resistance, with the 5A limit you mentioned i no longer think it is a power issue.

author: MatCat
author_rank: Frequent Contributor
timestamp: May 21, 2018, 08:16:04 pm
content: Quote from: lucazader on May 21, 2018, 07:14:22 pmI really do not think it's a power issue either, I am using 1117 which is rated for 800mA, and only dropping down from 5V I have used them before on ESP32's with a TFT and haven't had a problem. Even then it's stable with the FTDI plugged in BUT NOT POWERED, which means when it's plugged in it's not providing any more power then the 3.3V rail can push anyway. I am starting to wonder if the PCB antenna itself is creating currents on the circuitry, since this design really isn't going to be using Wifi in production, and I didn't really do proper clearance on the PCB GND plane like recommended. As far as capacitance goes that was one of my very first thoughts and I soldered a 470uF directly to the ESP32 3.3V pin, made no difference.

author: julianhigginson
author_rank: Frequent Contributor
timestamp: May 22, 2018, 05:46:30 am
content: how are you dealing with the serial port in firmware? interrupt driven?And what does the cmos level serial line look like going from the ftdi chip to the ESP32? vs how it looks when disconnected?if you are sending that line permanently low (or allowing it to flap around in the breeze) is that being seen by the serial port peripheral as "data" which then causes interrupts to fire in order to process it, and then chokes out your WIFI related interrupts?

author: MatCat
author_rank: Frequent Contributor
timestamp: May 22, 2018, 09:48:25 am
content: Quote from: julianhigginson on May 22, 2018, 05:46:30 amThere is no code running to handle receive of serial, I think I did try pulldowns at one point on serial lines, but I may try that again, I am not checking for serial data or clearing it, I am not sure how Arduino ESP32 implementation handles that, though I have done a lot of code in the past where I use serial only for debugging info as is the case here, and never had that be an issue.Note that the FTDI being plugged in makes it stable EVEN IF the FTDI is NOT plugged into USB, I.E. just floating and left to whatever internal pullups and pull downs exist.

author: MatCat
author_rank: Frequent Contributor
timestamp: May 22, 2018, 10:09:03 am
content: I tried some pull downs on serial lines just for the heck of it, made no difference.

author: julianhigginson
author_rank: Frequent Contributor
timestamp: May 22, 2018, 10:19:40 am
content: I'd try pull ups. CMOS serial is active low. But yeah, it was a guess.Try connecting one line (plus ground) at a time between the processor and the ftdi module, and see if just one connection makes the pain go away.

author: MatCat
author_rank: Frequent Contributor
timestamp: May 23, 2018, 02:47:37 am
content: Quote from: julianhigginson on May 22, 2018, 10:19:40 amOMG Why didn't I think of this!!!! I did this, and found RTS when connected alone made the system stable, all it's got going for it is 10M to 5V rail, that wasn't it, but then I got a thought, WHAT if I stick a cap on it? Put 100nF, nothing ok kind of expected it, as there is nothing to feed the cap, so I put as 100k pull up with the cap (happened to have one on desk), and BAM, stable!

author: julianhigginson
author_rank: Frequent Contributor
timestamp: May 24, 2018, 06:18:48 am
content: you're welcome!knowing that's a thing to try comes from years of dealing with similar experiences.