ESP32-S3 Getting Stuck in firmware download mode

Areeb Mufti
Posts: 1
Joined: Tue Jun 25, 2024 4:58 pm

ESP32-S3 Getting Stuck in firmware download mode

Postby Areeb Mufti » Tue Jun 25, 2024 5:13 pm

I have an ESP32-S3 running in deep sleep functionality. My deep sleep code has been shared below

Code: Select all

#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include "ulp_riscv.h"
#include "ulp_riscv_utils.h"
#include "ulp_riscv_gpio.h"
#include "ulp_riscv_adc_ulp_core.h"
#include "hal/adc_types.h"

#define ADC_CHANNEL     ADC_CHANNEL_1
#define ADC_UNIT        ADC_UNIT_1

#define ADC_TRESHOLD    9.0*1000        // mV
#define TAMPER_GPIO     GPIO_NUM_5

gpio_num_t tamper_gpio  = TAMPER_GPIO;
bool tamper_detected    = false;
int32_t adc_read        = 0;
int32_t bus_voltage     = 0;

int main (void)
{
    if(ulp_riscv_gpio_get_level(tamper_gpio) == 1)
        tamper_detected = true;
    
    adc_read = ulp_riscv_adc_read_channel(ADC_UNIT, ADC_CHANNEL);
    bus_voltage = adc_read * (1010 / 100);
    if (bus_voltage > ADC_TRESHOLD)
        ulp_riscv_wakeup_main_processor();
    return 0;
}
My main goal is to measure the main bus voltage through my PCB using ADC and wake up if the main voltage is above 9V. For deep sleep mode, the esp is powered by a coin cell
The device is working fine for the most part however, rarely the device does not wakeup from sleep but goes into the firmware download mode and becomes bricked until I reset the reset
From observing the logs on the serial UART, I have attached the screenshot of the error
Using DMM, I have verified that my Boot GPIO 0 is pulled high i.e. 3.3V
Attachments
Screenshot 2024-06-25 220955.png
Screenshot 2024-06-25 220955.png (6.2 KiB) Viewed 426 times

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

Re: ESP32-S3 Getting Stuck in firmware download mode

Postby ESP_Sprite » Thu Jun 27, 2024 8:42 am

That brown out is suspicious, I'd start looking for that first. If any, it may pull GPIO low (as the power rails go low), but if it doesn't last that long, you can't really see it using a DMM, you need a scope.

Who is online

Users browsing this forum: Google [Bot] and 102 guests