Adafruit SAMD21 Installation Manual

Installing CircuitPython on SAMD21 Boards
Created by Shawn Hymel
Last updated on 2021-03-05 05:59:27 PM EST
2 3 5
5 5 7 7
9
9
9 10 13
14 14
14 16
19 21 22
22 22 23 23 23
Guide Contents Overview Installing the Arduino Board Definition
Install Arduino Add Board Manager URL Install Board Definition Board Definition Packages
Installing the UF2 Bootloader
Windows 7 Drivers Download the UF2 Arduino Installer Upload UF2 with Arduino Learning More About UF2
Installing CircuitPython Caveats for CircuitPython on Non-Express Boards
Download the Latest Version of CircuitPython Start the UF2 Bootloader
Test It! Learning CircuitPython Advanced: Creating Your Own Port
1. Create a UF2 Port
2. Create a CircuitPython Port
3. Test Your Board
4. Create Pull Requests
5. Update Mu (Optional)
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 2 of 25
Overview
CircuitPython is a programming language based on Python, and it is designed to work with low-cost
microcontroller boards to make learning and tinkering easier. The Microchip ATSAMD21 is an inexpensive
chip with the power to run CircuitPython.
Some SAMD21-based boards, like the Circuit Playground Express (https://adafru.it/wpF), METRO M0
Express (https://adafru.it/xoa), and Feather M0 Express (https://adafru.it/wfb), are designed to work with
CircuitPython out of the box. Others, like the Arduino MKRZero, require a little more work.
This guide will show you how to install CircuitPython on a variety of SAMD21-based boards!
The easiest method for installing CircuitPython is through the UF2 bootloader. UF2 is a slick piece of code
that runs on your microcontroller, and it allows the board to appear as a drive on your computer. From
there, you can simply drag-and-drop the CircuitPython installer! We will need to take the following steps to
install CircuitPython on a SAMD21 board:
Install Arduino and the appropriate board definition
Download the UF2 bootloader Arduino code for your board
Upload the UF2 bootloader code to your board from Arduino
Download the CircuitPython installer for your board
Copy the CircuitPython installer to your board
Test it!
Note that you only need to perform these steps once. Once you have installed CircuitPython on your
board, you write CircuitPython code for it over and over again!
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 3 of 25
Not every SAMD21 board is covered in this guide. We try to cover the most popular ones, and
CircuitPython is being updated all the time to support new boards, so keep checking back!
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 4 of 25
Installing the Arduino Board Definition
There are a couple of ways to install UF2 onto your board. The easiest method is to download the pre-
generated Arduino code and upload it to your board from the Arduino Integrated Development
Environment (IDE).
The Arduino installation method only works if your board comes pre-loaded with the Arduino
bootloader. If you can upload Arduino programs to your board, then you're in luck! Continue with the
rest of the guide.
If you cannot upload Arduino code to your board (for example, you designed your own board with a
factory-fresh SAMD21 chip), then you will need to install the UF2
.bin
file. This will require an Atmel ICE or
other JTAG programmer.
Install Arduino
If you have not already done so, head to arduino.cc (https://adafru.it/lDg), download, and install the latest
Arduino IDE. Note that this guide was written and tested with Arduino version 1.8.7. If you run into issues
uploading code, you might want to try this specific version.
This guide (https://adafru.it/D3z) will show you how to install the Arduino software, if you need some
assistance.
Add Board Manager URL
Some SAMD21 boards will require additional definition files to be installed. If your board is not found in the
Board Manager
, you will need to tell Arduino where to find more definition files from the Internet.
Open Arduino, and click File > Preferences. To the right of the Additional Boards Manager URLs, click on
the Additional URLs window button .
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 5 of 25
Take a look at the
Board Definition Packages
table at the end of this page, and locate your board. If you
see a
Package URL
listed, copy it into a new line in this window. If you do not see a
Package URL
listed
next to your board, you can skip this step.
You are welcome to have multiple board manager URLs listed here. Just note that each one needs to be
on a separate line.
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 6 of 25
Click OK to close the
Additional Boards Manager URLs
window, and click OK once more to close the
Preferences
window.
Install Board Definition
A board definition tells the Arduino IDE how to upload code to your particular board, which pins to use,
etc. Arduino comes with a number of board definitions installed by default, including the Arduino Uno,
Arduino Mega, and Arduino Nano. However, many SAMD21 boards are not supported by default in
Arduino, which means we need to add them.
Click Tools > Board > Boards Manager... This will bring up the
Boards Manager
window.
From the
Board Definition Packages
table below, find your board, and copy the
Package Name
. Search
for this name, and click on the Install button that appears when you hover your mouse over the package's
box.
Once the installation process has completed, click Close to exit the
Board Manager
.
Board Definition Packages
Adafruit Feather M0 Basic Proto (https://adafru.it/s1d)
Package URL:
https://adafruit.github.io/arduino-board-
index/package_adafruit_index.json
Package Name:
Adafruit SAMD Boards
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 7 of 25
Arduino MKRZero (https://adafru.it/DiY)
Package Name:
Arduino SAMD Boards
SparkFun SAMD21 Dev Breakout (https://adafru.it/DJd)
Package URL:
Click for address (https://adafru.it/D3A)
Package Name:
SparkFun SAMD Boards
SparkFun SAMD21 Mini Breakout (https://adafru.it/DiZ)
Package URL:
Click for address (https://adafru.it/D3A)
Package Name:
SparkFun SAMD Boards
© Adafruit Industries https://learn.adafruit.com/installing-circuitpython-on-samd21-boards Page 8 of 25
Loading...
+ 17 hidden pages