ESP32 Provisioning

OpenNMC uses the onboard ESP32 for WiFi and Bluetooth.

The first-boot flow provisions the ESP32 if the module is not already fused and flashed.

Provisioning

  • the board can detect whether the ESP32 has already been provisioned
  • if it has not, first boot runs /usr/sbin/esp-hosted-factory-flash.sh
  • the same script can be run manually with --force for re-provisioning
  • the image ships esp-hosted, esp-hosted-firmware, esptool, espefuse, and espflash
  • the provisioning code binds and unbinds the MMC host and WiFi power-sequence driver, then flashes from /var/firmware/espressif/esp32-sdio

Provisioning Steps

The current factory-flash flow is:

  1. unbind the MMC host and WiFi power sequence
  2. force the ESP32 into ROM bootloader mode with ESP_nBOOT, ESP_D0, and ESP_nRST
  3. burn the flash voltage efuse to 3.3V
  4. flash:
  5. bootloader.bin
  6. partition-table.bin
  7. ota_data_initial.bin
  8. network_adapter.bin
  9. remove the boot straps and reset the ESP32 back into normal mode
  10. rebind the power-sequence and MMC drivers

The runtime check skips flashing when esp32_sdio is already loaded and wlan0 exists. The firmware bundle is stored on the target at /var/firmware/espressif/esp32-sdio.

Maintenance Mode

If manual re-flashing is needed later, run the same factory-flash script with --force.