SparkFun is proud to welcome the SAMD51 Thing Plus to our microcontroller lineup! With a 32-bit ARM Cortex-M4F MCU, it is one of our most powerful microcontroller boards yet.
The ATSAMD51J20 microcontroller boasts a maximum CPU speed of 120MHz, 1MB of flash memory, 256KB of SRAM, up to 6 SERCOM interfaces, amongst other features (see datasheet). The SAMD51 Thing Plus provides a USB interface for programming and power, a Qwiic connector, 600mA 3.3V regulator, and LiPo charger all in a feather pin layout. For a full list of details, check out the Hardware Overview section below. In addition, this board comes flashed with the same convenient, UF2 bootloader as the RedBoard Turbo.
This tutorial aims to familiarize you with the new SAMD51 Thing Plus and help you get started using it. If you are new to the world of Arduino or microcontrollers, please check out our RedBoard Qwiic and RedBoard Qwiic Hookup Guide.
To get started, all you need is a few things:
That is ALL... pretty simple right? Now you won't be able to do much since there are no additional sensors to interact with the physical world. However, you can at least blink an LED and do some math calculations.
Jumper Modification Headers & Accessories ARM Programmers
If you would like to modify the 3.3V/5V I/O jumper or A4/A5 Qwiic connector jumpers, you will need soldering equipment and/or a knife.
If you would like to follow along with the examples below to interact with the physical world, you will also need the following items:
If you would like to add headers to your board, check out some of the following items:
Below is a sample selection of our other headers and soldering tools in our catalog. For a full selection of our available Headers or Soldering Tools, click on the associated link.
If you would like to debug or flash your ARM processor on your own, here are some of our ARM Programmers:
Before continuing on with this tutorial, you may want to familiarize yourself with some of these topics if they’re unfamiliar to you:
One of the new, advanced features of the board is that it takes advantage of the Qwiic connect system. We recommend familiarizing yourself with the Logic Levels and I2C tutorials (above) before using it, as all Qwiic sensors utilize an I2C communication protocol. Click on the banner above to learn more about Qwiic products.
The SAMD51 Thing Plus is now easier than ever to program, thanks the UF2 bootloader. With the UF2 bootloader, the SAMD51 Thing Plus shows up on your computer as a USB storage device without having to install drivers for Windows 10, Mac, and Linux!
From the Arduino IDE, you'll still need to select the correct port on your machine, but you can just as easily use another programming language such as CircuitPython or MakeCode, which will be available in the near future.
If you are using a Windows 7 OS, you will need to install the SAMD drivers using the SAMD Windows 7 Installer. Head over to the GitHub repo to install the executable.
Scroll down the page to the assets in the Latest release and click on the '.exe to download. The version number may be different depending on the release. The image below shows sparkfun_drivers_1.0.5.3.exe .
After downloading, click on the executable and follow the prompts to install. The steps to install are the same even though the following images show drivers for v1.0.5.1.
You will receive a warning from Windows. Click yes to continue.
Another window will pop up. Read through the license and click "I Agree".
When ready, hit the Install button.
Another window will pop up. Click on "Install this driver software anyway" to continue.
Your Windows 7 will begin installing the driver. This should take a few seconds. When the drivers have installed, hit the "Close" button to exit out of the installer.
UF2 stands for USB Flashing Format, which was developed by Microsoft for PXT (now known as MakeCode) for flashing microcontrollers over the Mass Storage Class (MSC), just like a removable flash drive. The file format is unique, so unfortunately, you cannot simply drag and drop a compiled binary or hex file onto the SAMD51 Thing Plus. Instead, the format of the file has extra information to tell the processor where the data goes, in addition to the data itself.
For Arduino users, the UF2 bootloader is BOSSA compatible, which the Arduino IDE expects on ATSAMD boards. For more information about UF2, you can read more from the MakeCode blog, as well as the UF2 file format specifiation.
The bootloader is what allows us to load code over a simple USB interface. To upload code, you will need to manually enter bootloader mode by rapidly double-tapping the reset button (after hitting the reset button once, you have about half a second to hit it again). The board will remain in bootloader mode until power cycles (happens automatically after uploading code) or the reset button is hit again (once).
On the SAMD51 Thing Plus, the there are a clues to if it is in bootloader mode:
To verify that your driver is working, you should see the difference in the following pictures after plugging in your SparkFun SAMD51 Thing Plus. Alternatively, once you have the Arduino IDE installed, you should also see a change in the number of available Serial/COM Ports (you may need to restart the Arduino IDE for the board to populate).
Check that the board shows up in your device manager. You can click the Start or ⊞ (Windows) button and type "device" to quickly search for the application. (*On Windows 10, the quick search function is picky on the spelling of the application you are searching for. For example, you may get results using "devi" and none for "device".)
Open the Terminal and run the following command ls /dev/cu.*
in the Terminal and check for the following changes (your board may show up under a different device name). To open the Terminal, open your Applications folder, Utilities folder, then double-click on Terminal. Otherwise, press ⌘ (Command) + space bar (Space Bar) to launch Spotlight and type "Terminal," then double-click the search result.
ls /dev/cu.*
Run the following command ls /dev/ttyACM*
in the CLI/Terminal and check for the following changes (your board may show up under a different device name).
ls /dev/ttyACM*
You can download the Arduino IDE from their website. They have installation instructions, but we will also go over the installation process as well. Make sure you download the version that matches your operating system.
The installation procedure is fairly straightforward, but it does vary by OS. Here are some tips to help you along. We've also written a separate Installing Arduino tutorial in case you get stuck.
sudo apt-get update && sudo apt-get install arduino arduino-core
With Arduino downloaded and installed, the next step is to plug the board in and test it out! Pretty soon you'll be blinking LEDs, reading buttons, and doing some physical computing!
While the SAMD MCU alone is a powerful tool, what truly makes it special is its growing support in the Arduino IDE. With just a couple clicks, copies, and pastes, you can add support for our SAMD core to your Arduino IDE. This page will list every step required for adding the SAMD51 Thing Plus board definition into your Arduino IDE.
Lets begin by making SparkFun's cores available to the Arduino IDE. This doesn't install the core/board definitions, but it does make them available for ease of use for future installations. Open the Arduino preferences (File > Preferences). Then find the Additional Board Manager URLs text box, and copy the below link in:
https://raw.githubusercontent.com/sparkfun/Arduino_Boards/main/IDE_Board_Manager/package_sparkfun_index.json
For additional details, check out this guide on how cores work in the Arduino IDE.
To get a SAMD board working in the Arduino IDE, you'll need to install a variety of tools, including the low-level ARM Cortex libraries full of generic code, the arm-gcc to compile your code, and the Bossa flash utility to upload over the bootloader. These tools come packaged along with Arduino's SAMD board definitions for the Arduino Zero.
To install the Arduino SAMD board definitions, navigate to your board manager (Tools > Board > Boards Manager...), then find an entry for Arduino SAMD Boards (32-bits ARM Cortex-M0+). It may help to enter SAMD into the search bar. Select the Arduino SAMD core and install the latest version (recently updated to v1.6.21).
Downloading and installing the tools may take a couple minutes -- arm-gcc in particular will take the longest, it's about 250MB unpacked. Once installed, the INSTALLED text should appear next to the SAMD boards list entry.
Now that your ARM tools are installed, one last bit of setup is required to add support for the SparkFun SAMD boards. You should be able to find an entry for SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.19) at the end of the SAMD search results. If you don't see it, close the board manager and open it again. Select the add-on package and install the latest version (*recently updated to v1.6.1, but any version after should still work). Again, the INSTALLED text should appear next to the SparkFun SAMD boards list entry.
Once the board definition for the SAMD51 Thing Plus is installed, you should see a new entry in your Tools > Board list under SparkFun SAMD51 Thing Plus.
The bootloader is what allows us to load code over a simple USB interface. To upload code, you will need to manually enter bootloader mode by rapidly double-tapping the reset button. The board will remain in bootloader mode until power cycles, which happens automatically after uploading code.
On the SAMD51 Thing Plus, the there are a clues to if it is in bootloader mode:
Finally, select your board's port. Navigate back up to the Tool > Port menu. The port menu may magically know which of your ports (if you have more than one) is the SAMD51 Thing Plus board. On a Windows machine, the serial port should come in the form of "COM#". On a Mac or Linux machine, the port will look like "/dev/cu.usbmodem####".
Once you find it, select it! That is all you need to get started in the Arduino IDE. In the next section we will go over the hardware and capabilities of the board. However, if you are eager to upload your first Arduino sketch (and review the hardware information later), you can jump over to the Hardware Assembly and Examples sections.
Below is a graphical datasheet for the SAMD51 Thing Plus, which highlights the important features and pin functionality of the SparkFun SAMD51 Thing Plus:
Power/Reset Status LEDs Microcontroller Programming Pin Functions Qwiic Connection Dimensions
The SparkFun SAMD51 Thing Plus can be powered via the USB and/or Li-Po battery JST connections. If you choose to power it via USB, the other end of the USB cable can be connected to either a computer or a 5V (regulated) USB wall charger. Otherwise, should you choose to use a Li-Po battery (single-cell only), there is a built in charge circuit to recharge your battery from the USB connection.
Annotated image of SAMD51 Thing Plus with power and reset features highlighted. Click to enlarge.
A USB micro-B cable is usually the easiest way to power the board, especially when you're programming it because the USB interface is required for uploading code too. Power for the Li-Po battery charging circuit is provided by the USB.
An example of how to pull USB cable straight out from a Qwiic RedBoard.
There is a 2-Pin JST PH connector available for single cell Li-Po batteries. Check out this tutorial for more information on power connectors.
It is fine to connect both a Li-Po battery and a USB connector at the same time. The SparkFun SAMD51 Thing Plus has power-control circuitry to automatically select the best power source. In addition, the charge controller will charge the Li-Po battery from the USB power.
The MCP73831 is a single-cell charge controller. Power for the charge controller comes directly from the USB or VUSB pin. The input voltage range for the MCP73831 is 3.75-6V and it has set charge current of 550mA.
Just above the battery JST connector on your circuit board, there’s a tiny LED next to the word VBATT. This yellow LED should light up whenever your battery is charging.
The APA2112 is a robust 3.3V regulator, capable of sourcing up to 600mA from an external voltage of 3.5V to 6V. The external voltage for the APA2112 is provided through the USB and battery connections (also tied to the VUSB and VBATT pins, respectively). The APA2112 regulates 3.3V power to the SAMD51 IC and the Qwiic system. If supplied with less than 3.5V, the power may be unstable; and using more than 6V, the voltage regulator may overheat and damage itself and/or the board.
Just like the original Nintendo, the board has a reset button. Pushing it will temporarily connect the reset pin to ground and restart any code that is loaded. This can be very useful if your code doesn't repeat, but you want to test it multiple times. Unlike the original Nintendo however, blowing on the Arduino doesn't usually fix any problems.
The reset button is used to manually enter and exit bootloader mode. Simply, double-tap the reset button to launch the board into the bootloader (used to program the SAMD51 Thing Plus). The board will remain in bootloader mode until power cycles (happens automatically after uploading code) or the reset button is hit again (once).
Use the indicators below to verify that the board is in bootloader mode:
Don't for get to make sure you have the proper serial port selected in the Arduino IDE. The SAMD51 Thing Plus changes to its secondary serial port in bootloader mode.
There are breakout pins available for all your input/output voltages and reset.
There are 2 status LEDs on the SparkFun SAMD51 Thing Plus, a charge indicator and a test/status LED.
This LED indicates that the Li-Po Battery is getting charged. A good secondary test for this status indicator is to use a multimeter to test the VBATT and VUSB pins against the GND pin.
The last indicator is the Pin 13 LED. This is typically only used as a test LED to make sure that a board is working or for basic debugging. However, for the SparkFun SAMD51 Thing Plus, this LED also indicates if the board is in bootloader mode.
Pin 13 is difficult to use as a digital input because of the voltage drop from status LED and resistor soldered in series to it. If the pin is enabled as an input with the internal 20k pullup resistor, it will always read a LOW state; an expected 5V (HIGH) signal will instead read around 1.7V (LOW).
If you must use pin 13 as a digital input, it is recommended that you set the pinMode() as an INPUT and use an external pulldown resistor.
pinMode(13, INPUT);
The microcontroller (ATSAMD51J20 IC) is the work horse of the SparkFun SAMD51 Thing Plus. The ATSAMD51 is an 32-bit ARM microcontroller manufactured by Atmel, now Microchip. Once an Arduino sketch is uploaded to the board, the program is stored in the memory of the ATSAMD51. The microcontroller will then run/execute the program while the SparkFun SAMD51 Thing Plus is powered.
An external 32.768kHz crystal is used as the clock for the ATSAMD51. However, the MCU itself has a maximum CPU speed of 120MHz.
The ATSAMD51 has Flash memory, SRAM (Static Random Access Memory), and backup RAM (Random Access Memory). In addition, there is also 4Mb of external Flash memory.
The Flash memory is non-volatile; the data is still stored even when the board is no longer powered. The SRAM, on the other hand, is volatile and the data is only available while the board is powered. There is a small bit of SRAM that can retain memory when the SAMD51 is in Standby or Hibernation modes, but that isn't enabled in Arduino yet.
The bootloader is a unique piece of firmware at the end of the address space of the flash memory. Without a bootloader, you would need to external programmer and program the microcontroller through the SPI interface (normally, the ISP/ICSP headers).
For Arduino users, the UF2 bootloader is BOSSA compatible, which the Arduino IDE expects on ATSAMD boards. Additionally, the UF2 bootloader allows the SAMD51 Thing plus to show up on your computer as a USB storage device.
For more details on the ATSAMD51, memory, and the bootloader check out these tutorials:As mentioned previously, you will need to manually enter bootloader mode (by double-tapping the reset button) to program the SAMD51 Thing Plus. Once the Arduino IDE is finished programming the board, it should automatically exit the bootloader by resetting the board.
Use the indicators below to verify that the board is in bootloader mode:
Don't for get to make sure you have the proper serial port selected in the Arduino IDE. The SAMD51 Thing Plus changes to its secondary serial port in bootloader mode.
There are two ways to program the SparkFun SAMD51 Thing Plus. The most common way for users is through the USB connection. The other slightly less common method is through the ISP headers or pins.
The USB micro-B connector is the most convenient way to power and program the board. To program the board through the USB connection, you will need a USB micro-B cable and there must be a bootloader flashed to the microcontroller (don't worry... we have already "factory installed" one). For the SparkFun SparkFun SAMD51 Thing Plus, this is a UF2 bootloader similar to the [RedBoard Turbo](https://www.sparkfun.com/products/14812). Most users will program the SAMD51 Thing Plus through a USB connection with the Arduino IDE.
Troubleshooting Tip: Users should take care NOT to pry or leverage on the connector when inserting/removing the USB cable. Doing so, WILL damage the board and cause the pads and/or traces to tear off as well. The cable should be removed by pulling straight outwards from the board.
An example of how to pull USB cable straight out from a Qwiic RedBoard.
The bootloader is what allows us to load code over a simple USB interface. When using the Arduino IDE, the board needs to be manually launched into the bootloader prior to any attempts to upload a sketch. To manually enter bootloader mode, rapidly double-tapping the reset button (after hitting the reset button once, you have about half a second to hit it again). The board will remain in bootloader mode until power cycles (happens automatically after uploading code) or the reset button is hit again (once).
Use the indicators below to verify that the board is in bootloader mode:
Don't forget to make sure you have the proper serial port selected in the Arduino IDE. The SAMD51 Thing Plus changes to its secondary serial port in bootloader mode.
The least common way for most users to program the microcontroller on their board, is to use the Serial Peripheral Interface (SPI) pins for in-system programming (ISP). A more experienced user, with a firm grasp on digital electronics and the microcontroller (datasheet), will probably use a software package like Atmel studio, which is easier to debug code through the available software debug pins.
The most common reasons for programming with this method are:
The power pins aren't really I/O (Input/Output) pins for the microcontroller; however, they are pertinent to the board. For more details on these pins, see the Power/Reset tab.
The pins mostly operate as voltage supply pins. These pins are traditionally used as power sources for other pieces of hardware (like LEDs, potentiometers, and other circuits).
All of the I/O pins on this board are digital inputs or outputs for the microcontroller (ATSAMD51J20). Most pins are configurable for other capabilities.
There are 21 I/O pins on this board, which can be operate as either digital inputs or outputs for the microcontroller (ATSAMD51). This includes the pins labeled as Analog, which may be configured and used in the same manner as the digital pins. Digital pins are what you connect to buttons, LEDs, sensors, etc. to interface the Arduino with other pieces of hardware.
Using the Serial Peripheral Interface, configures the SCK and MOSI pins to be directly managed by the SPI hardware. Therefore, while in use, pins 11 and 13 can't be used (i.e. the LED on pin 13 can no longer be used as a debug/status indicator.)
Executing "SPI.end();" allows those pins 11 and 13 to be used as general I/O again.
The Qwiic system is intended a quick, hassle-free cabling/connector system for I2C devices. The Qwiic connector is tied to the I2C pins.
The most convenient feature of the board is the Qwiic connector that allows the SparkFun SAMD51 Thing Plus to seamlessly interface with SparkFun's Qwiic Ecosystem.
The Qwiic system is intended a quick, hassle-free cabling/connector system for I2C devices. Qwiic is actually a play on words between "quick" and I2C or "iic".
Cables plug easily between boards making quick work of setting up a new prototype. We currently offer three different lengths of Qwiic cables as well as a breadboard friendly cable to connect any Qwiic enabled board to anything else. Initially you may need to solder headers onto the shield to connect your platform to the Qwiic system but once that’s done it’s plug and go!
Qwiic cables connected to Spectral Sensor Breakout
How many times have you swapped the SDA and SCL wires on your breadboard hoping the sensor will start working? The Qwiic connector is polarized so you know you’ll have it wired correctly, every time, from the start.
The PCB connector is part number SM04B-SRSS (Datasheet) or equivalent. The mating connector used on cables is part number SHR04V-S-B or equivalent. This is a common and low cost connector.
1mm pitch, 4-pin JST connector
It’s time to leverage the power of the I2C bus! Most Qwiic boards will have two or more connectors on them allowing multiple devices to be connected.
These jumpers can be cut to disconnect the 2.2kΩ pull-up resistors from the I2C bus. You only need to cut this trace if you have a bunch of devices with pull-up resistors because the pull up becommes too strong.
You will need a knife to modify the jumpers. To modify the jumper, located on the back of the board next to the Qwiic connector, you need to cut the trace between the two pads. Once you have cut the trace, the pull-up resistors will be disconnected. To repair the connection, you just need to solder a jumper between the pads of both jumpers. Be sure to test the jumper with a multimeter to make sure you have a good soldered connection.
If you need more power for your Qwiic devices, you can attach a separate power supply. However, it is recommended that you cut the 3.3V line of the Qwiic cable to the SparkFun SAMD51 Thing Plus. Leave the GND line alone, as that ground loops your system, providing a consistent reference voltage for your I2C signals.
Cutting the 3.3V line of the Qwiic cable to the Qwiic connector (on a Qwiic RedBoard).
By cutting the 3.3V line, this allows you to power all your devices without straining the 3.3V regulator on the board. Since, all voltage regulators are slightly different and don't maintain a perfect 3.3 voltage, the 3.3V AP2112 regulator would be constantly battling the voltage regulator of your separate power supply to regulate its version of 3.3V. For more details on voltage regulators, check out this According to Pete blog post.
The dimensions for the board are approximately 0.9" x 2.3". The breakout pins use a standard 0.1" spacing and the layout is compatible with Feather styled shields. There is a 2-Pin JST PH connector for the option to add Li-Po batteries. The Qwiic connector uses a 4-pin JST SH type connector. There are also 4 mounting points on the board.
Screen shot of SAMD51 Thing Plus board layout in Eagle. (Click image to enlarge.)
For the more details on the board sizing and component placement please refer to the Eagle files provided.
Eagle is a free for educators, makers, and hobbyists (i.e. basically, anything not for commercial purposes). All measurements are accurate, excluding any manufacturing tolerances. (Unfortunately, we do not have this information available; you may need to just measure the board you purchase.)
The SAMD51 Thing Plus has 3 primary connectors a micro-B USB connection, a Qwiic connector, and a battery JST connector.
There are a few ways to use this board. However, most users will be interfacing with the SAMD51 Thing Plus, primarily through the micro-B USB connector to power and program the board. This connection is also used to charge the Li-Po battery, when in use. Need another micro-B USB cable for your drawer?
With the Qwiic connector system, assembling your hardware is simple. All you need to do is connect your Qwiic device to the SAMD51 Thing Plus with a Qwiic cable.
There is a 2-Pin JST PH connector available for single cell Li-Po batteries. The SAMD51 Thing Plus also has a built-in charge controller for charging your single cell Li-Po battery from the USB connection.
All the pins for the SparkFun SAMD51 Thing Plus are broken out to 0.1"-spaced pins on the outer edges of the board. When selecting headers, be sure you are aware of the functionality you need. If you have never soldered before or need a quick refresher, check out our How to Solder: Through-Hole Soldering guide.
The Feather Stackable Header Kit is a great option as it allows users to stack shields (w/ Feather footprint) or it can be placed on the a breadboard; while, the pins are still accessible from the female/male headers.
In this section, we will run a few simple sketches to verify and demonstrate the board's functionality.
Now it's finally time to upload code to your SAMD51 Thing Plus in the Arduino software. Once you open up the application, you'll be presented with a window that looks a little something like this:
Before we can send the code over to the SAMD51 Thing Plus, there are a couple of adjustments we need to make.
If you haven't already selected the proper board from the Arduino IDE setup section earlier, we will go over it again. This step is required to tell the Arduino IDE which of the available Arduino boards, we are using. Go up to the Tools menu, hover over Board, and be sure to select the SparkFun SAMD51 Thing Plus from the drop-down list.
The bootloader is what allows us to load code over a simple USB interface. To upload code, you will need to manually enter bootloader mode by rapidly double-tapping the reset button. The board will remain in bootloader mode until power cycles, which happens automatically after uploading code.
On the SAMD51 Thing Plus, the there are a clues to if it is in bootloader mode:
Next up we need to tell the Arduino IDE which of our computer's serial ports the SAMD51 Thing Plus is connected to. Navigate back up to the Tools > Port menu. The port menu may magically know which of your ports (if you have more than one) is the SAMD51 Thing Plus board. On a Windows machine, the serial port should come in the form of COM#
. On a Mac or Linux machine, the port will look like /dev/cu.usbmodem####
.
Once you find it, select it! If you've got more than one port, and you're not sure which of the serial ports is your SAMD51 Thing Plus, unplug it for a moment and check the menu to see which one disappears.
If you want to adjust the blink speed, try messing with the "1000" value in the delay(1000);
lines. You're well on your way to becoming an Arduino programmer!
If you got an avrdude: stk500_getsync(): not in sync: resp=0x00
error in your console window.
Below, we have also included some troubleshooting tips for issues that you may come across with the new SAMD51 Thing Plus.
If neither of the troubleshooting guides above were able to help, here are some additional tips:
One global issue to be aware of is that each SAMD51 Board appears to your computer as two USB devices, and your computer will assign two different port numbers to your SAMD51 Board - one for the bootloader, the other for the sketch.
Every board that we manufacture gets tested. If you didn't buy the board from us or one of our authorized distributors, it could be a knock-off. That being said, let's try a basic test to see if just the board is working. Disconnect everything that you have attached to the board; we just want to test the board.
If you don't see your board as an available COM port on the Arduino IDE:
There are two types of issues that you will usually see in the console of the Arduino IDE, compile errors or upload errors. The easiest way to see where to start is by clicking the Verify button (check mark); the Arduino IDE will try to compile your code. A failure here is a compile error.
It takes a some experience, but if you enable the verbose output from the Arduino IDE preferences, it may give you more clues to where the issue is.
Now that you've successfully got started with your SAMD51 Thing Plus, it's time to incorporate it into your own project! For more information, check out the resources below:
Need some inspiration for your next project? Check out some of these related tutorials:
Looking for project ideas? Check out some of these Qwiic products and tutorials:
Or check out this blog post for ideas:
learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado