Using the ESP32-C6 with CircuitPython – flashing the bin file

Posted by

I will show you how to get using the ESP32-C6 with CircuitPython, flashing the bin file to make it work. The board we will use as the subject is the SeeedStudio’s Xiao ESP32-C6. Which I am using to develop my dev board, as seen here.

To begin with, I figured that the Xiao ESP32-C6 won’t show as a storage device when put in BOOT mode. So none of that “drag a bin file into the device” will work. I then asked how to make it show as such device in forums like the Reddit, Arduino Stack exchange and SeeedStudio, to no avail.

ESP32-c6 dev board
My ESP32-C6 dev board

Web-based bin flashers did no work either, I tried the Adafruit one (here) and the Franzininho one (here). Both would not be able to connect to the Xiao ESP32-C6.

Googling for the problem I found this Github which mentioned the software “ESP32C6 Flash download tool V3.9.6”, which I then found and downloaded from here. That was my answer. The software asks for some configurations which are:

  • First the bin file, which I did not find the exact one for the Xiao ESP32-C6. Then I found and downloaded the “ESP32-C6-DevKitC-1-N8” from here. Full disclaimer: it flashed and blink a LED but I have not tested it fully, may be well incompatible.
  • “@” which may be the starting memory address for flashing, I put 0x00.
  • SPI Speed, I did not touch it, 40MHz
  • SPI Mode, I did not touch it, DIO
  • Leave “DoNotChgBin” marked
  • COM port: mine was COM16 at the time
Flash download tool software
Flash download tool software

Then all you have to do is click “Start” and wait for the process to end.

CircuitPython

After the flashing period I reset the board and went straight to Thonny IDE, which I had used here before. In “Tools > Options” part “interpreter” I configured “MicroPython (ESP32)” and “USB serial device (COM16)” and there you go, worked. In the bottom of the Thonny IDE I saw:

Thonny IDE console

Since I flashed the DevKitM-1 firmware it thinks it is such device, while in reality it is a Xiao ESP32-C6. This brings concerns of wether everything on the board will work or not, but that is a question for the future me. I then used the sketch below to read the chip temperature and blink an LED.

# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
"""CircuitPython CPU temperature example in Celsius"""
import time
import microcontroller
import board
import digitalio

led = digitalio.DigitalInOut(board.IO18)
led.direction = digitalio.Direction.OUTPUT

while True:
    print(microcontroller.cpu.temperature)
    print("On!")
    led.value = True
    time.sleep(0.5)
  
    print("Off!")
    led.value = False
    time.sleep(0.5)

The sketch result brought two concerns:

  • In CircuitPython apparently the pin names is the chip pin name (IO18) instead of the Xiao name (D10).
  • The CPU temperature was showing 12/13ºC, while the room temperature was 20/21ºC.

Final words

Being finally able to use CircuitPython on the Xiao ESP32-C6 is an amazing achievement, specially when there is no real support on the internet. And also of course the C6 is a new part which is not really covered by every tool and service out there.

The peripherals of ESP32-C6 in CircuitPython are still untested by me, all I managed to do was to blink an LED on pin 18. I hope to work on it in the future and bring you more updates.

3 responses

  1. Kevin Avatar
    Kevin
    1. fritzenlab Avatar

Leave a Reply

Your email address will not be published. Required fields are marked *