Big ESP32 + SX127x topic part 2

Andreas Spies newest excellent video abou antenna basics, as of today:

1 Like

I have a strange effect with my TTGOv2 board:

If i run it on USB power, my application code works as expected.
With the same code, when i run the board from battery, it crashes at a certain point.

Debugging is difficult, since using a USB cable surpresses the failure.

The crash is not erratic, it seems it happenes always at the same point in the code, but i can’t figure out where exactly this happenes.

Has anyone an idea, how battery operation could affect code execution behaviour in TTGOv2?

1 Like

Does your TTGO board have TXD from USB\Download connection on one of its pins ?

When connecting the USB except for it’s +5V line and power the TTGO separately via battery, you can use the serial port without having to power the TTGO via the serial port.
This will require of course some custom cabling.

Another option is to output diagnostic messages to the OLED display instead of to the serial port.

Meanwhile i checked the battery is full. And yes, it was fully loaded from TTGOv2 socket. If i start the board and app code with USB power cable connected it runs, even if i unplug the USB power cable after startup it continues running on battery.

But when it is started from battery, it crashes at a certain point in the app. Strange!

TTGOv2 is reported to feature a USB/UART CP2104 chip, instead of a CP2102, as found on TTGOv1 and heltec boards. Maybe this has influence on this effect?

I think that should not make any difference.
https://www.silabs.com/community/interface/knowledge-base.entry.html/2016/01/13/differences_between-nLJ7

My TTGO v2 runs just fine when I start it from a LiPo battery.

Meanwhile i checked this with a tweaked USB cable. It turns out the board throws a “brownout detector was triggered”.

That’s still strange, because when i start it from USB power, then detach USB power, it keeps running on battery for 2 hours.

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:11404
entry 0x40078a28

Brownout detector was triggered

Have you tried to use another battery?

Have you checked if the battery wiring (including connector) is ok?

The issue can be board related but may also be related to a battery issue, or poor battery wire/contact/connector.

This appears like an issue where the voltage drops when switching it on, not ably to sufficiently handle the switch-on current peak.

This seems to be a common problem with power design on ESP32 boards, meanwhile i found several reports on this issue in the ESP32 forum.

My code runs on Heltec and LoPy and LoPy4 boards without any battery problems, but not on TTGOv2.

I discovered that the OLED display on TTGOv2 does not behave like the display on Heltec: it remains on while flashing. Maybe it’s powered by 3,3V not 5V and this makes the power situation on the board fragile, but this is pure speculative so far.

Meanwhile i tried it with a second TTGOv boars, and another (bigger) LiPo battery.

Same problem. It seems TTGOv2 has a hardware related problem when enabling Wifi, BLE and LoRa on battery :frowning:

Display staying on when flashing is quite common. It probably has to do with lack of (or not using) reset. This is normal behavior with the SSD1306 OLED displays that do not have a reset pin (with the U8g2 library at least).
If you don’t clear the display it will show its contents as long as the display stays powered.

I power all my OLED displays from 3.3V, no problems with that.
Why complicate things and power OLED display from 5V on a 3.3V device. That would be very impractical and/or inefficient.

Add code to toggle spare GPIO pins high at certain points in your code. e.g. pin 1 at start, pin 2 after serial defined. etc
Put a cheap logic analyser on these pins, press record and start up the ESP32.
It should help to narrow down things?

N.B. this is interesting to know
"the green BAT trace is the current consumed from a 5v battery…(The ESP32) wakes at 60-70mA, rising to around 140mA once wifi is turned on, with short spikes to over 350mA.
Total usage is 204mAs…
_ the esp8266 uses around 50mAs (maybe less, I forget the latest results)…"_
ESP32%20current

https://forum.makehackvoid.com/t/playing-with-the-esp-32/1144/6

Another option is to use a spare USB cable and cut the power line. That way you get serial messages while the circuit is powered by battery

An ‘enabled’ LoRa device uses very little current, only 2mA in standby mode.

So if the addtional current consumption of LoRa receive or transmit were the cause of the problem, you would be able to identify that by monitoring the serial console output on the TXD pin.

Another option to work around the issue (not a fix) may be to throttle the current usage during power-up, i.e. gradually start initializing/using Wifi and Bluetooth interfaces with some pauses in between from startup.

This may help prevent the voltage sink during start-up from battery that causes the brown-out.

The question here is probably: How is the power circuit on the TTGOv2 board designed?
I assume that the 3,7V battery drives some kind of step-up/step-down circuit, and maybe this circuit lacks of peak power.

350mA spikes @5V is 1,75W peak. This shouldn’t be a problem for a LiPo cell?

Lipos have a very low internal resistance, so should handle such current spikes easily.

So what does the VCC power rail, 3.3V, to the CPU look like on a scope ?

Unlikely to work, but try putting a 100uF cap across the 3.3V / ground.
Chances are, the power circuit is similar to a feather board as per here
In this board there are 2 separate chips (circuits) involved with power.

  1. MCP738312 - Battery charge circuit (5v Vbus to battery Vbat)
  2. AP2112 - Power supply Circuit - Linear Regulator - 2 inputs of battery Vbat and 5v Vbus, with a regulated output of 3.3v

N.B. Make sure you check the lipo battery voltage and 3.3v supply when not connected to USB - you may have a bad battery?
feather_schem

Hi!

I am playing with the TTGO V1 OLED and I am trying to make GPS work. I ordered an GN-801 from Aliexpress.
I could not find good examples for this particular GPS module because this one has 6 pins ; GND, VCC, TX,RX, PPA and EN.
I connected everything but PPA and EN. I am not sure what to do with these. Here is what I have :
on top:
#define GPS_RX 23
#define GPS_TX 17
HardwareSerial GPSSerial(2);
SETUP:
GPSSerial.begin(9600, SERIAL_8N1, GPS_RX, GPS_TX);
LOOP:
while (GPSSerial.available() > 0)
{
Serial.print(GPSSerial.read());
}

The GPS MODULE:

20228dea-2ef8-43ce-a687-ffe4e05c30dd

It might help you to take a look at post 191 in this topic or search the LABS page for my node example.

I think PPA would be a pulse per second output and the EN pin is internally pulled high, so both can be left disconnected

Issue fond.
esp_deep_sleep_start() - causes spikes in some GPIO - e.g SPI SCK pin, at the same time GPIO14(LoRa RST ) seems to be hi-Z -> spike occures in this pin. The result is reset SX1276.
Temrorary I added pull up 2KOhm and SW reinitialize of SCK as input.

maybe graceful stop of spi before esp_deep_sleep_start() coud be the final solution. Needs to be tested . Sorry No time for it.

2 Likes