How to Install CircuitPython on M5Stack Cardputer
27 Feb 2025
0 Comments
Today we have good news. M5Stack Cardputer can now use CircuitPython. And we have a test for the M5Stack Cardputer. CircuitPython runs fine.
Let's find out how to install CircuitPython on M5Stack Cardputer and how to use Python programming.
Step-by-Step Installation Guide
Step 1: Download CircuitPython Firmware
Visit the Official CircuitPython Download Page:
This page lists firmware specifically built for the M5Stack Cardputer.
Select the Latest Stable Version:
As of February 25, 2025, the latest stable version is likely CircuitPython 9.2.4 (or a newer 9.x release if available).
Look for a file named something like adafruit-circuitpython-m5stack_cardputer-en_US-9.2.4.bin.
Direct download link (based on current stable version):
Save the File:
Download the .bin file to an easily accessible location on your computer (e.g., Desktop or Downloads folder).
Step 2: Enter Bootloader Mode on M5Stack Cardputer
Power Off the Device:
If the Cardputer is powered on, disconnect it from the USB cable or turn it off.
Connect to Computer:
Plug one end of the USB-C cable into your computer and leave the other end unconnected for now.
Enter Bootloader Mode:
Locate the BOOT button on the M5Stack Cardputer (typically on the side or bottom, depending on the layout; check the M5Stack Cardputer Docs if unsure).
Press and hold the BOOT button.
While holding the BOOT button, connect the USB-C cable to the Cardputer.
Continue holding the BOOT button for about 1-2 seconds after connecting, then release it.
The device should now be in bootloader mode.
Verify Bootloader Mode:
On your computer, a new USB drive should appear named RPI-RP2 (or similar, indicating the ESP32-S3 bootloader).
If no drive appears, repeat the process, ensuring you hold the BOOT button long enough during connection.
Step 3: Install the Firmware
Copy the .bin File:
Open the RPI-RP2 drive in your file explorer (e.g., File Explorer on Windows, Finder on macOS).
Drag and drop the downloaded .bin file (e.g., adafruit-circuitpython-m5stack_cardputer-en_US-9.2.4.bin) onto the RPI-RP2 drive.
Alternatively, copy and paste the file into the drive.
Wait for Installation:
The drive will automatically close, and the Cardputer will reboot once the firmware is copied (this takes a few seconds).
Do not disconnect the USB cable during this process.
Confirm Installation:
After rebooting, the USB drive should reappear, now named CIRCUITPY.
Open the CIRCUITPY drive to confirm it contains files like boot.py or a README.txt. This indicates CircuitPython is successfully installed.
Step 4: Test the Installation
Connect to a Serial Terminal (Optional but Recommended):
Use a tool like Mu Editor (easiest for beginners), PuTTY (Windows), or screen (macOS/Linux) to connect to the Cardputer’s serial port.
Find the COM port:
Windows: Check Device Manager for a new COM port (e.g., COM3).
macOS/Linux: Run ls /dev/tty* and look for /dev/ttyUSB0 or /dev/ttyACM0.
In Mu Editor:
Open Mu, select “Serial” mode, and connect to the detected port.
You should see a Python REPL prompt (>>>).
Run a Simple Test
Step 5: Prepare for Use
Check lib Folder:
Open CIRCUITPY and look for a lib folder. If it’s empty or doesn’t exist, create one manually (CIRCUITPY/lib/).
This is where you’ll later add external libraries (e.g., adafruit-circuitpython-requests.mpy).
Save Your Code:
Create a file named code.py in the CIRCUITPY root directory to run your program automatically on boot.
Troubleshooting
No RPI-RP2 Drive Appears:
Ensure the USB cable supports data (test with another if possible).
Double-check the BOOT button timing—hold it until after the USB is connected.
Try a different USB port on your computer.
Drive Appears but Doesn’t Accept .bin:
Verify the .bin file matches the M5Stack Cardputer (not another board).
Redownload the file to ensure it’s not corrupted.
No CIRCUITPY After Install:
Disconnect and reconnect the USB cable.
If still failing, repeat the process with a fresh .bin download.
Serial Connection Fails:
Ensure the correct COM port is selected.
Install USB drivers if needed (ESP32-S3 typically uses built-in drivers, but check M5Stack Docs for specifics).
Next Steps
Once CircuitPython is installed, you can add libraries to the lib folder and upload your code (e.g., the DeepSeek API script). If you need help with that part or encounter errors, let me know, and I’ll guide you further!
Leave a comment
All blog comments are checked prior to publishing