SAMD21 M0-Mini & CircuitPython
24 Feb, 2021
SAMD21 M0-Mini is a cheap clone of Arduino M0-mini sold under various names and sellers. RobotDyn offers the same board with and without CircuitPython support. Accidentally I ordered units without one and the following is how to get UF2 bootloader and CircuitPython working on these devices. If you want to skip the following, make sure you order a board with CircuitPython. It will cost you a few more bucks, RobotDyn offers both.
Get the latest Arduino IDE. It should have the correct USB drivers included. Make sure you have samd21 as additional boards installed. The IDE should do it automatically or prompt you.
Download the latest .ino file to update the bootloader. At the of writing it's
.inofile and select the correct port. Board: Arduino SAMD (32 bit ARM), programmer: Atmel-SAM-ICE. Compile and upload. An USB disk named
Download the latest correct version of CircuitPython. At the time of writing
adafruit-circuitpython-sparkfun_samd21_mini-en_US-6.1.0.uf2. Copy the uf2 file to the root of the
ZEROBOOTdisk. An USB disk named
CIRCUITPYshould mount after a few seconds.
As a default, CircuitPython looks for
code.pyat the root of the USB and executes the code within the file automatically when the board starts up or resets.
code.py and test if the board's integrated LED starts blinking fast:
import board import digitalio import time led = digitalio.DigitalInOut(board.D13) led.direction = digitalio.Direction.OUTPUT while True: led.value = True time.sleep(1) led.value = False time.sleep(0.2) led.value = True time.sleep(0.2) led.value = False time.sleep(0.2)
You can always unmount CIRCUITPY and go back to bootloader by double tapping the only button of the board.
More useful information about the board by Bryan Lavery.