Is there a way to trigger download boot mode by software?

fanhuanji
Posts: 9
Joined: Tue Feb 13, 2018 6:55 am

Is there a way to trigger download boot mode by software?

Postby fanhuanji » Sat Apr 15, 2023 2:03 pm

The only way to switch to download mode I've found was to pull some pin physically during power up.
Is there a method to trigger download mode by app?

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

Re: Is there a way to trigger download boot mode by software?

Postby ESP_Sprite » Mon Apr 17, 2023 1:42 am

On which chip? The ESP32 doesn't have this, later chips (S2/S3, C series) sometimes do.

fanhuanji
Posts: 9
Joined: Tue Feb 13, 2018 6:55 am

Re: Is there a way to trigger download boot mode by software?

Postby fanhuanji » Fri Apr 21, 2023 2:40 pm

ESP_Sprite wrote:
Mon Apr 17, 2023 1:42 am
On which chip? The ESP32 doesn't have this, later chips (S2/S3, C series) sometimes do.
On ESP32 S3 and C3.
Thanks for reply. Could you give some example please?
Some code snippet will help a lot.

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

Re: Is there a way to trigger download boot mode by software?

Postby ESP_Sprite » Sat Apr 22, 2023 3:32 am

You can try:

Code: Select all

REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
esp_restart();
(Note you probably need to include some headers to make that work, I'll leave that to you.)

fanhuanji
Posts: 9
Joined: Tue Feb 13, 2018 6:55 am

Re: Is there a way to trigger download boot mode by software?

Postby fanhuanji » Sat Apr 22, 2023 8:18 am

ESP_Sprite wrote:
Sat Apr 22, 2023 3:32 am
You can try:

Code: Select all

REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
esp_restart();
(Note you probably need to include some headers to make that work, I'll leave that to you.)
:D Thanks. It works linke a charm.

Code: Select all

#include "esp_system.h"
#include "soc/rtc_cntl_reg.h"
/**
 * @brief Software triggering download mode for ESP32 S3
 * 
 */
void GoToDownloadMode(void)
{
    REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
    esp_restart();
}

**txf**
Posts: 12
Joined: Thu Apr 21, 2022 3:03 pm

Re: Is there a way to trigger download boot mode by software?

Postby **txf** » Wed Nov 13, 2024 10:25 am

I have to say that this solution may not work on the S3 (possibly only if you're using USB and TinyUSB in your application). I'm just leaving this here if more people find this thread in a search.

There is a panic in the bootloader. The problem is documented here:
https://github.com/espressif/arduino-esp32/issues/10204

Who is online

Users browsing this forum: MicroController, noweare and 174 guests