ESP32 BUG with Battery backed & BOD + RTC ON

User avatar
urbanze
Posts: 295
Joined: Sat Jun 10, 2017 9:55 pm
Location: Brazil

ESP32 BUG with Battery backed & BOD + RTC ON

Postby urbanze » Mon May 13, 2019 9:37 pm

Hi little guys! I found bad notices about esp32 with power supplied by (old) litio battery.

I keep esp32 powered by battery until battery die (~2.1V) just to test, but sometimes, esp32 not turn on even I put power supply (providing to battery & circuit)...

Putting esp32 in serial debug to view ROM info, after some time of poor voltage, esp32 suddenly enter in DOWNLOAD MODE, then, even putting main power supply again to recharge battery/etc, esp32 still in download mode, only manual reset on ENABLE works.

I would like to know how to avoid this, because this can a bad situation for all devices (even if rtc wdt and bod on)

Details:
ESP32 WROVER B.
This bug occur when has ~1.6V in 3.3V line (battery > LDO > 3.3V line).
RTC/TSK WDT ON.
BOD ON (by menuconfig).
Code are just an blink.

ROM OUTPUT example:

Code: Select all

rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0xcf3f00c7,len:12583887*here, esp32 never more works without manual reset on ENABLE*
1162 mmu set 00010000, pos 00010000
1162 mmu set 00020000, pos 00020000
1162 mmu set 00030000, pos 00030000
1162 mmu set 00040000, pos 00040000
1162 mmu set 00050000, pos 00050000
1162 mmu set 00060000, pos 00060000
1162 mmu set 00070000, pos 00070000
1162 mmu set 00080000, pos 00080000
1162 mmu set 00090000, pos 00090000
1162 mmu set 000a0000, pos 000a0000
1162 mmu set 000b0000, pos 000b0000
1162 mmu set 000c0000, pos 000c0000
1162 mmu set 000d0000, pos 000d0000
1162 mmu set 000e0000, pos 000e0000
1162 mmu set 000f0000, pos 000f0000
1162 mmu set 00100000, pos 00100000
1162 mmu set 00110000, pos 00110000
1162 mmu set 00120000, pos 00120000
1162 mmu set 00130000, pos 00130000
1162 mmu set 00140000, pos 00140000
1162 mmu set 00150000, pos 00150000
1162 mmu set 00160000, pos 00160000
1162 mmu set 00170000, pos 00170000
1162 mmu set 00180000, pos 00180000
1162 mmu set 00190000, pos 00190000
1162 mmu set 001a0000, pos 001a0000
ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0xcf3f00c7,len:12583887
1162 mmu set 00010000, pos 00010000
1162 mmu set 00020000, pos 00020000
1162 mmu set 00030000, pos 00030000
1162 mmu set 00040000, pos 00040000
1162 mmu set 00050000, pos 00050000
1162 mmu set 00060000, pos 00060000
1162 mmu set 00070000, pos 00070000
1162 mmu set 00080000, pos 00080000
1162 mmu set 00090000, pos 00090000
1162 mmu set 000a0000, pos 000a0000
1162 mmu set 000b0000, pos 000b0000
1162 mmu set 000c0000, pos 000c0000
1162 mmu set 000d0000, pos 000d0000
1162 mmu set 000e0000, pos 000e0000
1162 mmu set 000f0000, pos 000f0000
1162 mmu set 00100000, pos 00100000
1162 mmu set 00110000, pos 00110000
1162 mmu set 00120000, pos 00120000
1162 mmu set 00130000, pos 00130000
1162 mmu set 00140000, pos 00140000
1162 mmu set 00150000, pos 00150000
ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00��2:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLA_BOOT)
flash read err, 1000
ets_�������ͺ�jRT�́)չ���������Ғ�Ҫ�j2
rst:0x10 (RTCWDT_RTC_RESET),boot:����B�A%}MQ}1M!}	==Q�5R2��͡�ɕ����rr, 1000
ets_main.c 371 
ets Ju��n 8 2016 00:22:57

rst:0x10 (RTCWD���TC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
.'&^LL���TCWDT_RTC_RESET),boot:0x17 (SPI_FAST_F��*�%�ꊕjRd��͡�ɕ�����ɱ�����jRT��}�������ͺ�jRT���
}�RSET),boot:0x17 (SPI_FAST_FLASH_BOOT)Ԥ$�������B�Q
flash read err, 1000
]Q%E5�%U5UE�b��������B�A%}MQ}1M!}��==Q�5R2��͡�ɕ�����ɱ��Y].$��
                                                                 	�����}IMQ�����:x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c71 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),oot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
}IQ����������B�A%}MQ}1M!}Ҫ�jRԤ$��==QJR2��͡�ɕ�����ɱ�����jRT��}�������ͺ�jRT�́)չ����������2:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH�����jRd��͡�ɕ�����ɱ�����jRT��}�������ͺ�jRT�́)չ��������00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_�ASH_BOOT)
flash read err, 1000
ets_main.c 371 
}IMQ�bz�������B�A%}MQ}1M!}B�Q    ==Q�5R2��͡�ɕ�����ɱ�����jRT��}�X�i
                                                                        ��S�H������
}IMQ����������B�A%}MQ}1M!}�==Q�5R2��͡�ɕ�����ɱ�����jRes_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT.��%U5UE�b��������B�A%}MQ}1M!}	==Q�5R2��͡�ɕ�����ɱ����jR*��}�������ͺ�jRT�́)չ���������Ғ�Ҫ�jRԤ$�������B���%E5�%U5UE�b��������B�A%}MQ}1M!}	==Q�5R2��͡�ɕ����r, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x� (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash r��ed err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

}IMQ����������B�A%�MQ}1M!}	==Q�5R2��͡�ɕ���ɱ�����jRT��}�������ͺ�jRT�́)չ���������Ғ�Ҫ�jRԤ$��:x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
fla��������ɱ�����jRT��}�������ͺ�j
ts Jun  8 2016 00:22:57

}IMQ����������B�A%}MQ}1M!}	==Q�5R2��͡�������ɱ�����jRT��}�������ͺ�jRT�́)չ���������Ғ�Ҫ�jRԤ$�:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
fl�����ɕ�����ɱ�����jRT��}�������ͺ�jRT�́)չ���������Ғ�Ҫ�j
rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT�)
flash read err, 1000
ets_main.c 371 
}IMQ����������B�A%}MQ}1M!�ꊕjRd��͡�ɕ�����ɱ�����jRT��}�������ͺ�jRT�́)չ������� 0:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_ASH_BOOT)
flash read err, 1000
ets_main.c 371 
}IMQ���������݂B�A%}MQ}1M!���ꊕjRd��͡�ɕ�����ɱ�����jRT��}�������ͺ�jR����l���HR�	���it��#A�$�隘�,&$�u�%������+�����Q�Ei�b��
T�%
   ������
}IMQ����������B�A%}MQ}1M!�_OOT)������B�Q
flash read err, 1000
ets_main.c 371 
]Q}I��T_RESET),boot:0x17 (SPI_FAST_FLAS!	==Q�5R2��͡�ɕ�����ɱ�����jRT��}��%�.c 371 
ets Jun  8 2016 00:22:57�
rst:0x10 (RTCWDT_RTC_RESET),boo:0x17 (SPI_FAST_FLASH_BOOT)
flas�������ɱ�����jRT��}�������ͺ�jR�$��
                                         	������Ғ�Ҫ�jRԤ$����x0 (RTCWDT_RTC_RESET),boot:0x17 (S�_FAST_FLASH_BOOT)
flash �ad err, 1000
ets_main.c 31 
ets Jun  8 2016 00:22:57

rs:0x10 (RTCWDT_RTC_RESET),boot:0x�B�A%}MQ}1M!}	==Q�5R2��͡�ɕ�����ɱ 000
ets_main.c 371 
ets Ju� 8 2016 00:22:57

rst:0x10 RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST�}1M!}	==Q�5R2��͡�ɕ�����ɱ�����j�
ts_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDTRTC_RESET),boot:0x17 (SPI3MQ}1M!}	==Q�5R2��͡�ɕ�����ɱ 000
ets_main.c 371 
ets Jun  8 �16 00:22:57

rst:0x10 (RTCDT_RTC_RESET),boot:0x17 (SPI_FASQ1M!}	==Q�5R2��͡�ɕ�����ɱ������
eets Jun  8 2016 00:�:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SP�IFAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
]Q}Jun RC_RESET),boot:0x17 (SPI_FQ}1M!}	==Q�5R2��͡�ɕ�����ɱ���0
ets_main.c 371 
]Q}IQ�IMQ����������B�A%}MQ}1M!}	=���Hȋ+k
                                                 IWVR��.	)&�H���������ͺ�jR�ets Jun  8 2016 00:��:57

rst:0x10 (RTCWDT_RTC�U5UE�b��������B�A%}MQ}1M!}	�OT)
flash read err, 1000
ets_mai�c 371 
}IM�b������ՁB"=]91=}jRd�$��==Q�UIQ���IQŽ�%��ʪT�%U��e%JJjRt��ѥ�����Ɂ�dwnload
un  8 2016 00:22:57

}IMQ����t0x5 (DOWNLOAD_BOOT(UART0/RT1/SDIO_FEI_REO_V2))
waiting forzݹ����5)�����������Ғ�Ҫ�jRԤst:0x10 (RTCWDT_RTC_RESET),boot:0x�5(DOWNLOAD_BOOT(UART0/UART1/SDIO_FE�R���e%JJjRt��ѥ�����Ɂ��ݹ����5)�����������:2:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x5 (DOWNLOAD_BOOT�(ART0/UART1/SDIO_FEI_REO_V2))
witing for download
}IMQ%������Ձ�"=]91=}�==Q�UIQ����r1/SDIO_FEI_REO_V2))
}IMQ��������ՁB������*��%�ꊅ�IQ���IQŽ�%=}%}I=}Yɥ�jR���ѥ����K���ݹ����5)�����������Ғ�Ҫ�
rst:0x10 (RTCWDT_RTC_RESET),bo�:0x5 (DOWNLOAD_BOOT(UART0/��UIQŽ�%=}%}I=}YɥJjRt��ѥ����r download

at the end, esp32 never more works without manual reset on ENABLE*[/u][/b]

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: ESP32 BUG with Battery backed & BOD + RTC ON

Postby ESP_Angus » Tue May 14, 2019 2:18 am

Hi urbanze,

The ESP32 is specified for voltage range 2.3V - 3.6V on most power pins (1.8V - 3.6V for VDD3P3_CPU pin only). See section "5.2 Recommended Operating Conditions" in the datasheet.

If you run the chip outside the specified voltage range, unspecified things may happen.

The ESP32 BOD is designed to reset the chip during temporary voltage drops, but it's not designed to keep the chip off while a low voltage is constantly supplied. Immediately after a full system reset the BOD reset is not enabled, so a chip with too low voltage applied can get stuck in the way you describe.

From the log, it looks like initially the flash chip in the module is browning out (so the ESP32 CPU is working but it's reading junk from the flash), but as things keep going the voltage keeps dropping and the CPU starts reading incorrect values from the strapping pins, and around the same time the serial output breaks (possibly just because whatever is reading serial no longer sees the low voltage "high" pulses as "high").

Suggest looking for a voltage regulator with a UVLO (undervoltage lockout) feature, that will cut off the regular output if it falls below a certain point. Or add a lithium battery protection circuit, most of these cut off the battery output if it falls below 3.0V.

(BTW, the reason the lithium protection circuits do this is because over-discharging a lithium ion battery can permanently damage it, causing it to lose capacity, or even fail or explode when recharging. If you're discharging a lithium battery below its minimum voltage regularly, you're encouraging much scarier problems than MCU brownouts.)

Who is online

Users browsing this forum: thefury and 88 guests