SAMD51 Thing Plus Hookup Guide
Hardware Overview
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
Power/Reset
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.
USB
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.
JST for Li-Po Battery
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.
Dual Power
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.
MCP73831 Charge Controller
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.
Charge Indicator LED
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.
AP2112 Voltage Regulator
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.
- According to Pete - Voltage Regulators
- Enginursday: Linear Regulator Thermal Tests
- Power and Thermal Dissipation
- Enginursday: Voltage Regulator Temperature Mobile App
Reset Button
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.
Launch Bootloader Mode
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:
- The D13 LED indicator will be a solid blue (may appear to be slowly fading or blinking).
- Board will show up under a different COM port.
- The board will appear as a USB mass storage device under the name 51THINGBOOT.
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.
The Power Pins
There are breakout pins available for all your input/output voltages and reset.
- VUSB- The input voltage to the Arduino board when it's using an external power source. You can provide an external supply voltage through this pin or access the external supply voltage from the power jack through this pin. If only powered through a USB connection, voltage will be around 5V. The input voltage range for this pin is 3.5-6V.
- EN- Tied to Enable pin of the AP2112 voltage regulator.
- VBATT- Provides a connection to the positive terminal of Li-Po battery connector.
- 3V3- The 3.3 volt supply generated by the on-board regulator. Maximum current draw is 600 mA.
- GND- Ground pins.
- RESET- This pin is tied to the Reset pin of the microcontroller and Reset Button. If this pin is toggled low or shorted to the GND pin, it will trigger a reset of the microcontroller.
Status Indicator LEDs
There are 2 status LEDs on the SparkFun SAMD51 Thing Plus, a charge indicator and a test/status LED.
Charge (Yellow)
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.
Pin 13 (Blue)
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.
- New boards will come programmed with a test sketch that the Pin 13 LED.
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);
Microcontroller
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.
Clock
An external 32.768kHz crystal is used as the clock for the ATSAMD51. However, the MCU itself has a maximum CPU speed of 120MHz.
Memory
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.
- 1MB Flash Memory - where the Arduino sketch/program is stored (including the UF2 bootloader).
- 256KB SRAM - where the sketch/program creates and manipulates variables when it runs.
- 4Mb (External) Flash Memory - accessed through SPI.
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.
UF2 Bootloader
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:- Microsoft's GitHub Repository for the (SAMDx1) UF2 Bootloader
- Arduino Memory Tutorial
- Arduino Bootloader Page
- Arduino as ISP and Arduino Bootloaders
- StackExchange Forum Post on Bootloaders
Bootloader Mode to Program
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:
- The D13 LED indicator will be a solid blue (may appear to be slowly fading or blinking).
- Board will show up under a different COM port.
- The board will appear as a USB mass storage device under the name 51THINGBOOT.
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.
Programming
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.
USB Connection
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.
Bootloader Mode to Program
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:
- The D13 LED indicator will be a solid blue (may appear to be slowly fading or blinking).
- Board will show up under a different COM port.
- The board will appear as a USB mass storage device under the name 51THINGBOOT.
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.
Using SPI pins for ISP or ICSP Programming
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:
- ISP is faster and more reliable- We use this method in our QC process for most boards.
- There is no bootloader on the microcontroller or your board wasn't flashed properly:
- This is probably the only way to program the microcontroller without a bootloader.
- You want to use your own, custom bootloader.
- Configure fuse bits for various settings.
- Program without bootloader, when you need just a little bit more space for your program to load.
Pin Functions
All of the SparkFun SAMD51 Thing Plus's pins are broken out to 0.1" spaced through holed on the outer edges of the board.Power Pins
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).
- 3.3V- A regulated 3.3V voltage source.
- VUSB- The (normally 5V) voltage from the USB connection.
- VBAT- The voltage from the Li-Po battery connection. Usually, used for checking remaining charge on battery.
- GND- The common ground or the 0V reference for the voltage supplies.
- EN- Tied to Enable pin of the AP2112 voltage regulator.
- RESET- The RESET pin can be shorted to the GND pin to reset the microcontroller, similar to using the reset button.
Microcontroller I/O Pins
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.
Digital I/O
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.
Input
By default, all digital I/O pins are configured as inputs. It is best practice to define the pinMode() in the setup of each sketch (programs written in the Arduino IDE) for the pins used. When configured properly, an input pin will be looking for a HIGH or LOW state. Input pins are High Impedance and takes very little current to move the input pin from one state to another.- If an input pin is read and that is floating (with nothing connected to it), you will see random data/states. In practice, it may be useful to tie an input pin to a known state with a pullup resistor (to VCC), a pulldown resistor (to GND), or configure the pin as a pull-up/down input.
- 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.
Output
When configured as an output the pin will be at a HIGH or LOW voltage. Output pins are Low Impedance: This means that they can provide a substantial amount of current to other circuits.The maximum current an I/O pin can source (provide positive current) or sink (provide negative current) is .5 - 8 mA (milliamps). For more details, you can refer to the ATSAMD51 datasheet. Attempting to run high current devices may damage the pin or entire ATSAMD51 chip.
Additional Functions
There are several pins that have special functionality in addition to general digital I/O. These pins and their additional functions are listed in the tabs below. For more technical specifications on the I/O pins, you can refer to the ATSAMD51 datasheet or the below table, which outlines which SERCOM ports each pin has been conected to (shown in green) along with the available SERCOM Ports. For more information on SERCOM and how it can help you with your hardware peripherals, check out our guide here.Analog Input Pins
There are 6 labeled analog inputs. These pins tie to a 12-bit (12-bit = 4096 different values) analog to digital converter (ADC), which can be used to read in an analog voltage between 0 and 2.82V or VCC (depending on the configuration). These are useful if you need to read the output of a potentiometer or other analog sensors.SAMD51 Thing Plus analog input pins. Click to enlarge.
For more details on the analog inputs, check out these tutorials:
Pulse Width Modulation (PWM) Output Pins
Digital pins can be configured as 24-bit PWM capable outputs, which you can use to dim LEDs or run servo motors.Novice users often mistake PWM pins as an analog output. Although, it can somewhat mimic that functionality, it is not a true analog output.
Serial Communication Pins
Digital pins 0 (RX) and 1 (TX) are also dedicated serial communication pins. These pins are used to receive (RX) and transmit (TX) TTL serial data. Other digital pins can be use to emulate serial communication with SoftwareSerial().SAMD51 Thing Plus dedicated serial communication pins. Click to enlarge.
For more details on serial communication, check out these tutorials:
SPI Communication Pins
Digital pins 23 (MOSI), 22 (MISO), and 24 (SCK) support Serial Peripheral Interface (SPI) communication. (The slave select (SS) pin is user defined.)SAMD51 Thing Plus SPI pins. Click to enlarge.
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.
I2C Communication Pins
Analog pins 20 (SDA) and 21 (SCL) support I2C (TWI) communication.SAMD51 Thing Plus I2C pins. Click to enlarge.
Qwiic System
The Qwiic system is intended a quick, hassle-free cabling/connector system for I2C devices. The Qwiic connector is tied to the I2C pins.
Be sure to double check that you are not trying to use an I2C device while you are trying use pins 20 and 21, you will run into issues. You can only do one or the other.
Interrupt Pins
Interrupts allow you to interrupt the code running in your main loop and execute another set of instructions (also known as interrupt handler or interrupt service routine) before returning back to the main loop. For more details on the interrupts, check out these tutorials:Qwiic Connector
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.
What is Qwiic?
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".
Keep your soldering iron at bay.
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
Minimize your mistakes.
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
Expand with ease.
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.
Pull-Up Jumpers
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.
How to Modify the Pull-Up Jumper
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.
Adding External Power
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.
Dimensions
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.)