Flashing MicroPython Firmware on the ESP32-C5_MINI using esptool

This post walks you through the step-by-step process of flashing MicroPython firmware onto the ESP32-C5_MINI.


1. Download the MicroPython Firmware

First, grab the correct binary for your chip:

  1. Visit the official MicroPython Download Page.

  2. Search or scroll down to the ESP32 section and locate the ESP32-C5 targets.

  3. Select ESP32-C5 by Espressif and download your preferred .bin file version.

2. Flash the Firmware (The 0x2000 Offset)

To flash the firmware, connect your board to your computer and run the following esptool command.

⚠️ Crucial Note: Unlike older ESP32 chips (like the S3) which often start flashing at 0x0, the ESP32-C5 requires you to write the flash starting exactly at address 0x2000.

Run this command in your terminal (replace PORTNAME and the .bin filename with your actual values):

esptool --port PORTNAME --baud 460800 write_flash 0x2000 ESP32_BOARD_NAME-DATE-VERSION.bin

Why use 0x2000?

If you are wondering why we use 0x2000, it comes down to the hardware architecture. According to Espressif's official ESP-IDF Application Startup Flow Documentation:

"The first stage (ROM) bootloader loads the second stage bootloader image to RAM (IRAM & DRAM) from flash offset 0x2000."

The initial 8 KB block of flash memory before 0x2000 is deliberately reserved by the hardware for security features like the Key Manager (used with flash encryption).

3. Verify the Installation

Once the flashing process completes successfully, launch Thonny IDE (or your favorite Python IDE). Select the appropriate COM port, choose MicroPython as your interpreter, and you should immediately see the REPL prompt (>>>).

You are now ready to run Python code directly on your ESP32-C5!

mpy_C5mini_info.py
import os, sys
import machine
from time import sleep
import micropython

led = machine.Pin(23, machine.Pin.OUT)
led.value(0)  # Turn the LED On

print("=========================================================")
print(sys.implementation[0], os.uname()[3],
      "\nrun on", os.uname()[4])
print("=========================================================")
freq_mhz = machine.freq() / 1_000_000
print("CPU Frequency: {:.2f} MHz".format(freq_mhz))
print("Memory info:")
micropython.mem_info()

while True:
    led.value(1)  # Turn the LED Off
    sleep(1)      # Wait for 1 second
    led.value(0)  # Turn the LED On
    sleep(1)      # Wait for 1 second
    


Comments

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

Drive ST7796 SPI TFT with XPT2046 Touch on ESP32-C3-DevKitM-1 (arduino-esp32), using TFT_eSPI.