Search code examples
esp32bootloaderesp-idf

esp32c6 entering first stage bootloader programmatically


The process outlined here to put an esp32c3 into bootloader mode doesn't work on the esp32c6.

When I tried the esp32c3 method above (with an esp32c6) it failed to compile and returned the error rtc_cntl_reg.h: no such file or directory.

This is due to the lack of the RTC_CNTL registers on the ESP32-C6, including the lack of the required RTC_CNTL_OPTION1_REG with RTC_CNTL_FORCE_DOWNLOAD_BOOT

I would like to put esp32c6 into first stage bootloader through software or to be more precise from application that is running on device.


Solution

  • I have figured out how to do it and it appears to be somewhat undocumented in the ESP32-C6 Technical Reference Manual so I'm posting it here for reference.

    It can be done like so, include:

    #include "esp_system.h"
    #include "soc/lp_aon_reg.h"
    

    and add below lines:

    REG_WRITE(LP_AON_SYS_CFG_REG, LP_AON_FORCE_DOWNLOAD_BOOT);
    esp_restart();
    

    It will boot directly to the ROM update mode.