Skip to main content

 I urgently need individuals who are willing to cooperate on my website and projects.

Arduino ATSAMD21 for dummies

Published: 03 May 2016
Last updated: 21 December 2018

SAMD21 introduction

Since 2015, there is a new powerful microcontroller available which can be programmed by the Arduino platform: the SAMD21. It is a 48MHz 32-bit ARM Cortex M0+ low power processor. Since it is quite new, there is not so much information about it on the Internet. That is why I will share my experience with the SAMD21 and discuss some particularities. 

Arduino SAM-D21 with built in USBArduino SAM-D21 with built in USB

For sale: Mini Arduino compatible SAMD21 development board 15x15mm

The smallest Arduino compatible ATSAMD21 board: 15x15 mm, 34 I/O pinsThe smallest Arduino compatible ATSAMD21 board: 15x15 mm, 34 I/O pins

The SAM 15x15 is an Arduino development board of just 15 x 15mm, with the same powerful controller as the Arduino Zero: the SAMD21G18. Despite the small size, it has more I/O pins than the Arduino Zero: 34 instead of 20. See the article and how to buy here.

Why do I use the SAMD21G?

I have developed a sophisticated e-bike computer, called the E-bike cable killer; it requires a small but powerful Arduino microcontroller. The widely used ATmega328, used at the Arduino Uno, doesn't have enough connections and is too slow; the main advantage is that its dual inline package fits into a normal IC socket. 
E-bike computer with SAM-D21E-bike computer with SAM-D21
Before 2015, the only faster Arduino alternative was the Arduino Due, but the processor has 144 pins and that is too much of a good thing. The Arduino Zero, which was released in 2015, contains the SAMD21G; this is a fast processor with a TQFP48 package.

Arduino Zero with SAMD21GArduino Zero with SAMD21G

Arduino Due with 144 pins SAM3X8E Arduino Due with 144 pins SAM3X8E
Complete microcontroller development system with the Arduino SAMD21G

As you can see, we hardly need extra components to build a complete microcontroller development system with the Arduino SAMD21G:

Arduino ATSAMD21G minimal configurationArduino ATSAMD21G minimal configuration

Complete microcontroller development system with the Arduino SAMD21GComplete microcontroller development system with the Arduino SAMD21G

Eagle library

Download the SAMD21G Eagle library HERE for the Eagle schematic symbol of the image above.

SAMD21G peripheral functions

There are 34 free pins available *. The most important pin peripheral functions are indicated with letters in the schematic symbol: 

D = general purpose I/O, digitalWrite(), digitalRead()
A = ADC analog input, analogRead()
P = PWM output, analogWrite()

Pins may have many other peripheral functions, but in order not to lose overview, these are not indicated with a letter in the schematic symbol:

External Interrupt
Comparator Output
Serial Communication
External Voltage Reference
Inter-IC Sound Controller
Peripheral Touch Controller 

*If the USB is not used, the 2 USB pins are also available, which increases the number of free pins to 36.

SAMD21G with a preprogrammed bootloader for sale

Note that we need a SAMD21G with a preprogrammed bootloader. You can buy the SAMD21G with bootloader HERE.

SAMD21 partnumber

The ATSAMD21G18A-AUT is the 48 pin version with 256k byte flash memory:

SAMD21 partnumberSAMD21 partnumber

SAMD21 configuration

These are the main characteristics of the J, G and E types:

SAMD21 configurationSAMD21 configuration

Built in Serial interface

The ATmega328 always needs an additional controller for programming. The SAMD21 instead, has a built-in serial interface which can directly be connected to an USB cable. This simplicity saves costs and board space. All we need is the SAMD21 with pre-programmed bootloader, a crystal and some capacitors: Note that the Arduino Zero board contains a lot of components; however these are in principle not all necessary.

How to use all SAMD21G pins

In order to make all SAMD21G pins available, we have to install the SAM 15x15 package.

How to solder the SAMD21

With some exercise, this TQFP48 chip it can be soldered by yourself; see here how to do it. You will, however, find out that the soldering is not so easy like in the examples. Maybe they have taken 10 videos and shown the best:

Other articles from SAMD21