Skip to main content

Micropython for XIAO ESP32C6

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.

In this page, we will guide on how to use the the XIAO ESP32C6 capability using the simple and easy syntax from micropython.

Hardware Preparation

I am using Seeed Studio XIAO ESP32C6 board here.

Seeed Studio XIAO ESP32C6

Software Preparation

In this guide I will be using windows 10 alongside with Thonny IDE and esptool. In order to use esptool make sure to install Python 3 environment on your windows OS. Before getting started make sure to download the firmware and Install Thonny

Thonny IDEFirmware and Sample Code

👍 Greatly Thanks

The firmware designed for XIAO ESP32C6 board, using in this wiki is made by our friend: Zhishuo Song, whom we are really greatful for.

Getting Started

The firmware is designed only for XIAO ESP32C6 MicroPython programming. We will first flash the firmware and then use the example on it.

Step 1. Flashing the firmware

Locate the usb to serial port address by opening the device manager

pir

Extract the downloaded zip file and navigate to the folder.

pir

click On the path box then type "CMD" and press enter

pir

You will be directed to cmd terminal.

pir

Install esptool using pip command (make sure python 3 is already installed)

pip install esptool

pir

Put the board into Bootloader mode

Before flashing, you must put the XIAO ESP32C6 into bootloader (download) mode. To do this:

  1. Press and hold the BOOT button.
  2. While holding BOOT, press and release the RESET button.
  3. Release the BOOT button.

If the board is not in bootloader mode, flashing will fail with a "Write timeout" error and may brick the module.

Erase the flash memory on the XIAO ESP32C6 using this command

esptool --port COMXX --chip esp32c6 erase-flash

Now proceed to install the micropython firmware using this command

esptool --port COMXX --baud 460800 --before default-reset --after hard-reset --chip esp32c6 write-flash --flash-mode dio --flash-size detect --flash-freq 80m 0x0 ESP32C6_MicroPython.bin
tip

Change the COMXX with the port COM number on your PC. If flashing fails with a timeout error, try lowering the baud rate to 115200.

pir

Step 2. Upload the example code

Now we will upload the example code to XIAO ESP32C6 internal flash memory.

For this part I am using thonny IDE first I configure the port

pir

run blinker.py example program

pir

NTP get now time from wifi

step1: Open wifi_Ntp.py file on Thonny

pir

step2: change you wifi router ssid and password on line 8

pir

step3: run code

When running the program, you can see in the shell window that the XIAO is connected to the specified wifi and get the NTP network time.

pir

Troubleshooting

  • "Write timeout" or serial exception error: Make sure the board is in bootloader mode before flashing. Hold the BOOT button, press and release RESET, then release BOOT. You should also try lowering the baud rate (e.g., use --baud 115200 instead of 460800).
  • Command not found (esptool.py): Use esptool (without .py) when installed via pip install esptool. On some systems, you may need to use python -m esptool instead.
  • Bricked module: If the module appears bricked, try entering bootloader mode and erasing the flash with esptool --port COMXX --chip esp32c6 erase-flash, then re-flash the firmware.

✨ Contributor Project

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...