ESP32启动引导加载程序

标签 esp32 arduino-esp32

我有一个 ESP32 板,其 GPIO0 通过开关接地。这个想法是,如果我按下按钮并发出 ESP.restart() 板将进入 flash 模式。 相反,ESP.restart() 只是重新启动应用程序,忽略 GPIO0 状态。

是否可以强制整个启动过程,也许可以直接 JMP 到硬件重置向量?

最佳答案

根据Ivan Grokhotkov

On ESP32 there are 3 reset reasons which cause strapping GPIOs to be sampled: power-on, RTC WDT reset, brownout reset.

所以就代码而言,请参见下文。如果引脚被束缚,它将永远不会脱离引导加载程序,引导加载程序将等待串行同步。

#include "soc/rtc_wdt.h"
void hardReset() {  
  rtc_wdt_protect_off();      //Disable RTC WDT write protection
  //Set stage 0 to trigger a system reset after 1000ms
  rtc_wdt_set_length_of_reset_signal(RTC_WDT_SYS_RESET_SIG, RTC_WDT_LENGTH_3_2us);
  rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM);
  rtc_wdt_set_time(RTC_WDT_STAGE0, 10000);
  rtc_wdt_enable();           //Start the RTC WDT timer
  rtc_wdt_protect_on();       //Enable RTC WDT write protection
}

关于ESP32启动引导加载程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67183130/

相关文章:

android - "flutter (os error: no address associated with hostname, errno = 7)"仅适用于安卓

c++ - 将示例代码重构到类中不会引发重载函数的实例

java - 如何使 java 应用程序与 ESP32 板通信?

c - 将 ESP8266 SDK 移植到 ESP32

arduino - BLE Arduino ESP32 - 我应该使用哪个库?

post - 如何将多部分/表单数据(文件和文本)从 ESP32 发布到服务器?

azure - 使用 MQTT 通过 Websockets(端口 443)而不是端口 8883 将 ESP32 连接到 Azure Iot Hub

c++ - 在 Arduino ide 中读取多个文本文件

c - If 语句在 ESP32 上未按预期工作

c++ - 如何定义一个lambda函数来捕获类的 'this'指针?