ESP32 device performance issues - ttyUSB vs Wall Wart powered

#1

Hi all,

I’ve been building with MOS for a little while now and am mostly happy with how my device functions, so I wanted to detach from my computer and power via a 5v wall adaptor.
I’m using an ESP 32 dev board with an SPI screen attached.

I’ve noticed some strange behaviour that I was hoping someone might be able to help me solve:

  1. When plugged in to my laptop with serial logging enabled I see my device has great up time and I’ve never really seen an unintended network disconnection or reboot. I always see it available on my network and I can get it do respond almost always instantly. The buttons I’ve wired in always work too.

  2. Using the same USB cable with a USB2.0 header that I only pull power from (no data) I see my device becomes unresponsive to web requests (it drops off the network) after a few hours, but the screen still functions and it appears as though the device is still functioning. If I start to press the buttons on the device it seems OK for a few seconds then reboots.

First things that come to mind that I wanted to test/ask:
A. Is there anything I should be doing to disable logging or something if my device is never getting to write the logs? I’m thinking maybe like serial buffer overflow or something if the logs are not being read.
B. I might be running out of memory somehow? I’m monitoring free heap now and logging to the cloud, so hoping that might show something. Seems unlikely though.
C. I’m going to test that the USB2.0 header I’m using isn’t limiting the current the device can pull. It seems odd to me that the screen and device would still function, but I don’t really have any other ideas.

Any other suggestions for things I should look at/try?
Thanks.

#2

I’m more inclined to think of current spikes wreaking havoc in either the cable or the adapter.
Did you observe the power lines with an oscilloscope ? The ESP32 has a moderate current consumption with high current spikes on startup and on soft-AP setup or when as a station it connects to an AP. Images correspond to measurements with a .47 ohm resistor in series with an ESP-WROOM-32. Yellow is power supply rail (before the resistor), cyan is after the resistor (device supply rail), magenta is the difference.
Even though that looks within the USB specs, might not play fair to the walwart adapter or a thin cable. perhaps a 100uF + .1 uF decoupling at the device end of the wire might help, but without seeing what is going on is just guessing.
tif tif tif

1 Like
#3

Thanks for the tip Sergio, I’ll take a look at what the devices are putting out in terms of power.

I don’t think it a thin USB cable, I’m using the same one from my laptop as the wall.

I think I may have found the issue: a memory leak
I started logging free heap size at 30s intervals and it looks like my free heap runs down then the device reboots.

I have never paid much attention to this so seems like I need to! Might need to connect back to the computer and see if I can catch a reboot/dump.

Apart from using free() are the any tips on running out of memory?
Scratch that, feels like I’ve moved too far away from the original post

Thanks.