Beginner · Lesson 3 of 10

Toolchains and your first flash

Arduino, ESP-IDF and MicroPython side by side on the ESP32-C5-DevKitC-1: install, build, flash, and read the serial monitor, with tested hello and blink code for each.

BeginnerEspressifRaspberry Pi45 minUpdated 28 November 2026Tier 1: Builds in CI

You will learn

  • Install one toolchain and flash a program to the ESP32-C5-DevKitC-1
  • Choose the right USB port and serial monitor for each toolchain
  • Put the board into download mode by hand when automatic flashing fails
  • Compare ESP-IDF, Arduino and MicroPython on build time, control and ease

Before this: Choosing your first board

This lesson gets code onto the board. You will see the same small program, which prints a greeting and blinks the on-board LED, written three ways: with ESP-IDF (Espressif’s own C framework), with the Arduino core for ESP32, and with MicroPython. Pick one to start with. The other two are here so you can see what each one hides from you and what it costs. All three were built in our CI (continuous integration) on 28 November 2026. None has yet been run on our bench, so the badge on this page says tier 1, “Builds in CI”.

Know your board first

The ESP32-C5-DevKitC-1 (board revision v1.2 in Espressif’s user guide) carries an ESP32-C5-WROOM-1 module. The variant on sale, N8R8, has 8 MB of flash and 8 MB of PSRAM (pseudo-static RAM). Three parts of it matter for flashing.

  • Two USB-C ports. One goes straight to the ESP32-C5’s own USB peripheral, called USB Serial/JTAG in Espressif’s software. It can flash, debug over JTAG and carry a serial console. The other goes through a USB-to-UART bridge chip (a CP2102N on the v1.2 schematic) to the chip’s first serial port, UART0. Either port powers the board.
  • Boot and Reset buttons. Boot (SW1 on the schematic) shorts GPIO28 to ground. GPIO28 is a strapping pin: the chip samples it at reset, and a low level selects download mode instead of running the program in flash. Reset (SW2) pulls the chip’s enable line low.
  • The RGB LED. It is an addressable LED (a WS2812-type part) on GPIO27, not a plain LED. Writing a pin high does nothing useful. You send it a colour as a timed bit stream, which is why every example below uses an LED-strip driver.
DevKitC-1 v1.23V3RSTchip enableGPIO2strap MTMS, ADC1_CH1GPIO3strap MTDI, ADC1_CH2GPIO0XTAL_32K_PGPIO1ADC1_CH0GPIO6ADC1_CH5GPIO7strapGPIO8SDA in lesson 5GPIO9SCL in lesson 5GPIO10GPIO26strapGPIO25strap5VGNCGTXGPIO11, U0TXDRXGPIO12, U0RXDGPIO24GPIO23NC/15GPIO15 used by PSRAMGPIO27strap, RGB LEDGPIO4ADC1_CH3GPIO5ADC1_CH4NCGPIO28strap, Boot buttonGGPIO14USB_D+GPIO13USB_D-GNC
ESP32-C5-DevKitC-1 v1.2 header pins: J1 on the left, J3 on the right, pin 1 at the top. Strapping pins are marked. GPIO8 and GPIO9 are the I²C pins used in lesson 5. Redrawn by us from the ESP32-C5-DevKitC-1 User Guide (header tables for board v1.2, boards with PW number PW-2025-04-0446 and later).

The user guide lists GPIO2, GPIO3, GPIO7, GPIO25, GPIO26, GPIO27 and GPIO28 as strapping pins. Avoid wiring anything to them that holds them at a fixed level during reset, or the board may refuse to boot.

Three toolchains side by side

ESP-IDF Arduino (arduino-esp32) MicroPython
Version used here v6.1.1 (16 November 2026) 3.3.13 (17 November 2026) v1.29.0 (24 August 2026)
First version with the ESP32-C5 v5.5 preview; v5.5.2 for production silicon 3.3.0 (23 July 2025) v1.27.0 official builds (9 December 2025)
Install ESP-IDF Installation Manager (EIM) Arduino IDE plus a Boards Manager URL Flash a firmware image once, then copy .py files
Language C (C++ possible) C++ with the Arduino API Python 3 subset
Clean build in our CI, 28 November 2026 44.8 s (Docker, includes fetching led_strip) 25.6 s No build: the board interprets the source
Control over the chip Full: every driver, every config option Most of it, through Arduino and ESP-IDF calls What the port exposes

ESP-IDF is what Espressif builds everything else on. The Arduino core for ESP32 is itself built on ESP-IDF and adds the familiar setup() and loop(). MicroPython is an interpreter written in C on top of ESP-IDF (v5.5.2 for the v1.29.0 release), so you trade speed and some control for an interactive prompt.

ESP-IDF

Espressif recommends installing with the ESP-IDF Installation Manager (EIM), which has graphical and command-line versions for Windows, Linux and macOS. Then, in the project folder:

idf.py set-target esp32c5
idf.py build
idf.py -p PORT flash monitor

Replace PORT with your board’s port (for example /dev/ttyUSB0 on Linux, or a COM port on Windows). Leave -p PORT out and idf.py searches for a board. The project needs the espressif/led_strip component, which the build fetches from Espressif’s component registry. We pin it to version 3.1.1 in main/idf_component.yml.

// target: esp32c5 sdk: esp-idf tier: 1
// Hello and blink for the ESP32-C5-DevKitC-1: print chip details once,
// then blink the on-board addressable RGB LED (GPIO27) once a second.
#include <inttypes.h>
#include <stdio.h>

#include "esp_chip_info.h"
#include "esp_flash.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "led_strip.h"

#define RGB_LED_GPIO 27  // "Addressable RGB LED, driven by GPIO27" (board user guide)

static led_strip_handle_t make_led(void)
{
    led_strip_config_t strip = {
        .strip_gpio_num = RGB_LED_GPIO,
        .max_leds = 1,
        .led_model = LED_MODEL_WS2812,
        .color_component_format = LED_STRIP_COLOR_COMPONENT_FMT_GRB,
    };
    led_strip_rmt_config_t rmt = {
        .clk_src = RMT_CLK_SRC_DEFAULT,
        .resolution_hz = 10 * 1000 * 1000,  // 10 MHz: 0.1 us per RMT tick
    };
    led_strip_handle_t led = NULL;
    ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip, &rmt, &led));
    return led;
}

void app_main(void)
{
    esp_chip_info_t chip;
    esp_chip_info(&chip);
    uint32_t flash_bytes = 0;
    ESP_ERROR_CHECK(esp_flash_get_size(NULL, &flash_bytes));

    printf("Hello from %s\n", CONFIG_IDF_TARGET);
    printf("cores: %d, silicon revision v%d.%d, flash: %" PRIu32 " MB\n",
           chip.cores, chip.revision / 100, chip.revision % 100, flash_bytes / (1024 * 1024));

    led_strip_handle_t led = make_led();
    bool on = false;
    for (uint32_t n = 0;; n++) {
        on = !on;
        if (on) {
            ESP_ERROR_CHECK(led_strip_set_pixel(led, 0, 0, 16, 0));  // dim green
            ESP_ERROR_CHECK(led_strip_refresh(led));
        } else {
            ESP_ERROR_CHECK(led_strip_clear(led));
        }
        printf("blink %" PRIu32 " led=%s\n", n, on ? "on" : "off");
        vTaskDelay(pdMS_TO_TICKS(500));
    }
}

Arduino

In the Arduino IDE, add https://espressif.github.io/arduino-esp32/package_esp32_index.json under Preferences, Additional Boards Manager URLs. Open Boards Manager, search for “esp32” and install the Espressif package, version 3.3.0 or later for the ESP32-C5. Choose the board “ESP32C5 Dev Module”. From a terminal, the same board is the FQBN (fully qualified board name) esp32:esp32:esp32c5:

arduino-cli compile --fqbn esp32:esp32:esp32c5 first_flash
arduino-cli upload -p PORT --fqbn esp32:esp32:esp32c5 first_flash
// target: esp32c5 sdk: arduino-esp32 tier: 1
// Hello and blink for the ESP32-C5-DevKitC-1 with arduino-esp32 3.3.x.
// RGB_BUILTIN comes from the core's esp32c5 variant (the addressable LED on GPIO27).

void setup() {
  Serial.begin(115200);  // UART0, which the board's USB-to-UART port carries
  delay(200);
  Serial.printf("Hello from %s rev %d, %lu MHz, flash %lu MB\n",
                ESP.getChipModel(), ESP.getChipRevision(),
                (unsigned long)ESP.getCpuFreqMHz(),
                (unsigned long)(ESP.getFlashChipSize() / (1024 * 1024)));
}

void loop() {
  static bool on = false;
  static unsigned long n = 0;
  on = !on;
  if (on) {
    rgbLedWrite(RGB_BUILTIN, 0, 16, 0);  // dim green (red, green, blue)
  } else {
    rgbLedWrite(RGB_BUILTIN, 0, 0, 0);
  }
  Serial.printf("blink %lu led=%s\n", n++, on ? "on" : "off");
  delay(500);  // fine here; lesson 4 shows why it hurts in real programs
}

RGB_BUILTIN and rgbLedWrite() come from the core’s ESP32-C5 board definition, which maps them to GPIO27.

MicroPython

MicroPython publishes an official ESP32-C5 build, ESP32_GENERIC_C5, and v1.29.0 is the current release. Download the .bin file and flash it once with esptool, following the download page: erase the flash, then write the image at address 0x2000.

esptool.py erase_flash
esptool.py --baud 460800 write_flash 0x2000 ESP32_GENERIC_C5-<date>-v1.29.0.bin

From then on, you change the program without reflashing the firmware. Install mpremote with pip install --user mpremote, then either run the file from RAM with mpremote run main.py or copy it so it starts at every reset with mpremote fs cp main.py :main.py. Typing mpremote alone opens the interactive prompt.

# target: esp32c5 sdk: micropython-1.29.0 tier: 1
# Hello and blink for the ESP32-C5-DevKitC-1 with the official ESP32_GENERIC_C5 build.
# The on-board RGB LED is addressable (GPIO27), so it needs the neopixel module,
# which the esp32 port's manifest includes.
import sys
import time

import machine
import neopixel

LED_PIN = 27

print("Hello from", sys.platform, sys.implementation.name, sys.version)
print("CPU clock:", machine.freq() // 1_000_000, "MHz")

led = neopixel.NeoPixel(machine.Pin(LED_PIN), 1)
on = False
n = 0
while True:
    on = not on
    led[0] = (0, 16, 0) if on else (0, 0, 0)  # (red, green, blue)
    led.write()
    print("blink", n, "led=" + ("on" if on else "off"))
    n += 1
    time.sleep_ms(500)

On a Raspberry Pi Pico 2 W the MicroPython route is even shorter: hold the BOOTSEL button while plugging in the USB cable, and copy the RPI_PICO2_W .uf2 file to the drive that appears. Lesson 4 has a Pico 2 W example in C.

Which port shows your output

This is the most common first-day surprise on this board.

  • ESP-IDF v6.1.1 sends the console to UART0 by default, so you see it on the UART port. It also copies output to the USB Serial/JTAG port as a secondary console, but that copy is output only: you cannot type into it.
  • arduino-esp32 3.3.13 has “USB CDC On Boot” disabled by default for this board, so Serial is UART0 and you must open the UART port. Enable that option in the Tools menu if you want Serial on the other port.
  • MicroPython’s ESP32-C5 build enables the interactive prompt on UART0. If mpremote finds no board, try the other port.

Set the serial monitor to 115200 baud, the rate all three examples use. In idf.py monitor, Ctrl+] exits. Expect some start-up lines from the chip’s boot code, then your program’s greeting, then one “blink” line every 500 ms.

Check what you flashed

The first lines your program prints are worth keeping. The ESP-IDF example reports the number of cores, the flash size and the silicon revision. ESP-IDF stores the revision as one number, major version times 100 plus minor version, so the example prints it as v1.0 while the Arduino sketch, which prints the raw value from ESP.getChipRevision(), shows 100 for the same chip. The ESP32-C5 datasheet (v1.5) lists chip revisions v1.0 and v1.2 across the current variants, and Espressif’s support page ties ESP-IDF’s production support (from v5.5.2) to revision v1.0. Errata sheets and SDK release notes refer to these revisions, so write yours down now, together with the toolchain version you used. The flash size should read 8 MB on the N8R8 kit. A different number means the build or the board is not what you think it is.

When flashing fails

The flashing tools normally reset the chip into download mode for you. If they time out instead:

  1. Check the cable. Espressif’s user guide warns that some USB cables carry power only, and the board will light up without ever appearing as a port.
  2. Hold Boot, press and release Reset, then release Boot. The chip now waits in download mode because GPIO28 was low at reset. Flash again, then press Reset to run the new program.
  3. Unplug anything connected to the strapping pins listed above and try again.

For makers

Start with whichever language you already know. MicroPython gives the fastest feedback and is fine for most sensor projects. Move to Arduino or ESP-IDF when you need a library that only exists there, tighter timing, or lower power. Keep the hello-and-blink program around: when something strange happens later, flashing it tells you in a minute whether the board, the cable and the port still work.

For product teams

Pin every version: the ESP-IDF release or Docker image tag, managed components through dependencies.lock, the Arduino core and FQBN, the MicroPython release. Our example manifest records all of them. Build in CI from a clean container so a new laptop cannot change the binary. Decide early which UART or USB port carries logs in the field, and make sure production firmware does not leave a debug console open that should be closed.

Exercise

  1. Flash the example in your chosen toolchain and note how long the build and the flash take.
  2. Change the LED colour and the blink period, and flash again.
  3. Open the serial monitor on the other USB port and write down what you see there for each toolchain.
  4. Put the board into download mode by hand with the Boot and Reset buttons, flash from there, and confirm the new program runs after Reset.

Summary

  • The ESP32-C5-DevKitC-1 has two USB-C ports: the chip’s own USB Serial/JTAG and a USB-to-UART bridge to UART0. Know which one your toolchain prints to.
  • ESP-IDF v6.1.1, arduino-esp32 3.3.13 and MicroPython v1.29.0 all support the ESP32-C5, with first support in v5.5, 3.3.0 and v1.27.0 respectively.
  • The on-board RGB LED is addressable, on GPIO27, so blinking it needs a driver rather than a plain pin write.
  • Holding Boot (GPIO28 low) during Reset forces download mode when automatic flashing fails.

Further reading

  • Espressif Systems, ESP32-C5-DevKitC-1 User Guide, board v1.2: components, header tables and power options.
  • Espressif Systems, ESP32-C5 Series Datasheet, v1.5, chapter 3, “Boot Configurations”.
  • Espressif Systems, ESP-IDF Programming Guide v6.1.1 for ESP32-C5, “Get Started”.
  • MicroPython, mpremote reference, and the ESP32_GENERIC_C5 download page.