SAMD21 is a 32-bit core microcontroller with a higher likelihood of replacing the old-fashioned 8-bit Microcontroller (ATmega 328). If the operating speed of your current Microcontroller is just too low, then SAMD21 will solve your problems. In this article, you will learn more reasons why you should consider using SAMD21. In addition, you will learn how it compares with RP2040 and how to get started with SAMD21.
What is SAMD21?
Atmel’s SAMD21 is a rich set of peripheral functions, a high-performing and flexible Microcontroller based on ARM® Cortex®-M0+ microchip. Furthermore, the microcontroller series is ideal for metering, consumer, industrial applications, and home automation. Besides, its intuitive design and simple migration fit between SAM D devices with compatible code, identical peripheral registers modules, and a linear address map.
Its key features include;
- Event and DMA system
- 1.62V to 3.63V power supply
- 48MHz Operating Frequency
- 32KB of SRAM and 256KB embedded flash
- Embedded host and full-speed USB device
- Hardware touch support
- 10-bit DAC
- Six serial communication modules (SERCOM) are configurable as four in the SAM D 21E, SAM D21G, and SAM D21J.
- QFP and QFN package options (SAM D21E:32 pins, SAM D21G: 48 pins, and SAM D21J: 64 PINS
- Supports up to 120 touch channels
Unlike the older 8-bit/16 MHz Arduino microcontrollers, this is a powerful microcontroller, as evident in the features.
Why use the SAMD21?
Microelectronics Arduino DIY microcontrollers, boards, sensors, LEDs, and controllers
Configurable Serial Interfaces
SAMD21 features a set of six configurable serial interfaces for programming, making this Microcontroller so exceptional. Moreover, you can turn the serial interfaces into either SPI slave, SPI master, I2C, UART, or I2C master. As a result, providing you with much flexibility since you can integrate the ports and assign the task to each pin.
Integrated USB Controller
ATSMD21 comes with a host controller interface, which can emulate a joystick, mouse, keyboard, etc. Besides, you can use it as a host or USB device. In addition, it can structure itself as a USB communication device. Hence, enabling you to talk with it as a serial port multiplexer by connecting with a computer. Still, as a USB host, it can save data to a USB flash drive and connect a keyboard or mouse.
USB controller and slots
Real-Time Clock (RTC) Onboard
Do you need accurate time-keeping for your PID loop or digital clock? While the ATmega328 features RTC on board, it’s still needed for promptness. SAMD21 features RTC powered by an onboard crystal separately while clocking the processor at 48MHz.
Sensitive Voltage Measurements
Unlike ATmega328p, which features a 10-bit resolution, SAMD21 has 14 ADC channel input pins with a 12-bit resolution. Therefore, once powered at 3.3V, every bit between O and 4095 represents 0.806mV totaling more complex power capacities.
Large Memory and Fast Operating Speed
If the operation speed of your current Microcontroller is too low or if you are restricted by the Arduino UNO storage limits, then SAMD21 will solve your issues. Its 256KB of flash means you have abundant space. Besides, additional flash storage means more user-defined chunks of data storage. Also, 32KB SPRAM means no more dynamic memory stack overflows worries.
Connections of a circuit that manages LED strips in an interactive lighting prototype
SAMD21 MCU Pinout Configuration
SAMD21 Arduino Boards
The SAMD21 Arduino boards you can use are well-arranged based on their unique strength.
Standing on 23.5 x 17.5, seeeduino Xiao is as small as your thumb and the smallest compatible board in the Seeeduino family. In addition, it's perfect for small projects and wearable devices. Besides, its rich interfaced and embedded SAMD21 microchip makes it proficient for being a tiny Dev Board.
Powerful 32-bit extension, a simple microcontroller from Uno, Arduino zero features Atmel Embedded Debugger (EDBG) provides a full debug USB interface. Furthermore, you can use it to create projects such as robotics, home automation, wearables, smart IoT devices, etc. Powered by AtSAMD21 MCU, it makes it a great fit if you want to experiment with 32-bit microcontroller application development.
Arduino Nano is a small, complete, breadboard-friendly board based on the ATmega328P.
Cortex-M0+ is utterly configurable with Arduino Zero and is a new dynamic product board from Seeeduino. Besides, just like Seeeduino Lotus Cortex-MO+, it has a header pinout, including 6 analog I/O and 14 digital I/O (10 PWM output). In addition, it offers 3 onboard Grove connectors, which include 1 UART and a chainable I2C port.
Seeeduino Lotus Cortex-M0+
Seeeduino Lotus Cortex-M0+ lets you get started with no soldering or jumper wires requirements. Also, featuring 6 analog input/outputs and 14 digital input/output, it enables you to plug and play in a few seconds with different modules. Furthermore, its chip supports USB direct output; hence serial port multiplexer won't be a requirement for a USB chip such as CP2102N.
SAMD21 VS RP2040: The Differences
Installing the SAMD21 Core for MKR Boards
When starting with SAMD21, you need to install it so you can use your board with offline Arduino IDE. Therefore in this tutorial, we will install the SAMD21 following a few simple steps. Moreover, we will use the Arduino IDE.
Downloading and installation
For a start, we will need Arduino Software to program the board space. Hence, begin by;
- Downloading Arduino IDE
- Install it to your local machine
- Launch your Arduino IDE application
SAMD core Installation
Afterward, after downloading, installing, and launching Arduino IDE, we will need to install the SAMD21 core. Next, begin by opening the editor, where you will find an empty sketch.
Empty Sketch window for Arduino IDE
After opening the IDE sketch window, navigate the Tools > Board > Manager.
Highlighting board manager
After opening the board manager, a new window will open with various available cores. Next, go to the search field and type “SAMD.” Then install the Arduino SAMD Boards (32-bits ARM Cortex-M0+) core.
Once the installation process is complete, under the title, you will see the “INSTALLED” icon. Note that the process might take some time. Furthermore, depending on your operative system, the installation window might pop up on the screen. Hence, it would help if you accepted the installation window.
Afterward, go to Tools > Board > Arduino SAMD Boards. In the listing, you will see SAMD boards. Next, choose the MKR board in use. Finally, you will have installed Arduino SAMD Boards (32-bits ARM Cortex-M0+) core successfully.
Choosing the correct board and port
Note that it might appear different depending on your system type. For instance, it will look like this for MAC users;
And like this for WINDOWS users;
Testing your Board
To ensure your board is working, you need to check by uploading a simple blink to the board. Simply navigate through the File > Examples > 01.Basics > Blink.
Choosing the Blink Example
On the top left corner, click on the pointing arrow to upload the sketch. Don’t disconnect the board overviews until the process completes.
Similarly, at the bottom left corner, you will see a text showing “Done Uploading” after uploading successfully. Besides, you will notice an orange blink on your board blinking at a one-second interval. Meaning you have uploaded the program to your Arduino board successfully.
There is so much you can do with the SAMD21.
It can emulate a joystick, mouse, or keyboard, communicate like a serial port and even work as a mass storage device. Besides, it can save data to a USB flash drive as a USB host. In general, SAMD21 can be a rewarding component of your project.
If you have any questions, contact us for further clarification.