Now Supports Seeeduino Xiao M0



I recently acquired a Seeduino Xiao and it’s a great value Arduino dev board at only ¢6+ shipping. Not only is it cheap as chips but it’s also tiny and comes with a huge amount of GPIO pins (11 Analog/Digital pins, plus 3v power, 5v power and ground) and also has support for I2C, SPI and UART. The size combined with the low cost makes it great for hacking together a variety of little maker projects from wearables to small USB HID devices.

EmbedXcode+. 18 Mar 2020 release 11.7.2. Added debugging for Seeed Xiao board The Seeeduino Xiao M0 is a very compact board based on the popular Cortex-M0 SAMD21. The embedXcode+ edition leverages the exposed SWD pads for debugging with a Segger J-Link probe.

It now supports 16 ISR-based Timers, while consuming only 1 Hardware Timer. To be able to automatically detect and display BOARDNAME on Seeeduino SAMD (XIAO M0. Driver for Seeeduino Install the driver¶ Installing drivers for the Seeeduino with window7¶.Plug in your board and wait for Windows to begin its driver installation process. After a few moments, the process will fail. Open the Device Manager by right clicking “My computer” and selecting control panel. Look under Ports (COM & LPT). Seeed's Seeeduino XIAO is the smallest member of the Seeeduino family. Seeeduino XIAO still carries the powerful CPU, Arm® Cortex-M0+ (SAMD21G18), which is a low-power Arduino microcontroller. This little board has good performance in processing even while needing less power. Seeeduino XIAO still carries the powerful CPU-ARM® Cortex®-M0+ (SAMD21G18) which is a low-power Arduino microcontroller. On the other hand, this little board has good performance in processing but needs less power. As a matter of fact, it is designed in a tiny size and can be used for Arduino wearable devices and small projects.

I’ve done a bunch of projects using Arduino, but I find the IDE to be buggy and generally not fun to use. Lately, I’ve been preferring CircuitPython based boards like the CircuitPlayground, Feather and Itsy Bitsy boards from Adafruit and luckily, the Seeeduino Xiao is powered by the exact same SAMD21G18 chip that runs so many of the M0 boards from Adafruit which means that it’s also able to switch to use Circuit Python with just a few minutes of effort.

Sadly, there is no official documentation on the Seeeduino site on how to achieve this so I thought it would be valuable to write a little mini tutorial on how to install circuitPython on the Seeeduino Xiao

Installation Instructions:

  1. Download the CircuitPyython Bootloader. You can get this from the official CircuitPython website. Click the big button that says “Download UF2 now” and you will get a small file.
  2. Plug in your Seeeduino Xiao. You’ll need a male USB-C cable.
  3. Enable bootloader mode. This is a bit of a pain in the butt as it involves shorting a couple of tiny pads next to the USB-C port twice in quick succession, but gets easier once you’re used to it. Simply follow the guide on the Seeduino Wiki which includes a nice animated gif.
  4. An external drive should now appear on your machine called “Arduino”. Open it up and drag the CircuitPython UF2 file onto it. Once the transfer is complete, eject the drive and unplug the USB-C cable.
  5. Plug the USB-C cable back into your computer and you should have a very tiny external drive appear called CIRCUITPY

Next steps:

You’ll notice the CIRCUITPY drive is very small. This is by design, but you’ll have to be thoughtful in what code you include. That said, I did notice a weird hex file taking up quite a bit of space on my install. Once I deleted it there was a little more space for me to add more libraries.

If you want to do more advanced functionality, you’ll need to add CircuitPython library files. You can download the official libraries from the CircuitPython website. Copy the files you NEED onto the CIRCUITPY drive into the lib directory. Due to the size restrictions on this device, you won’t be able to use more than a couple before you run out of space.

There is some good news, there are a lot of essential libraries included by default and you won’t need to copy them manually (they just work). The included libraries are listed here.

Thats it - now you just need to create a little python file named main.py and drop it onto the CIRCUITPYdrive. If you’re new to CircuitPython here’s a little test script you can install that will flash the onboard orange LED:

I hope this guide has been useful!

edit

The Seeeduino XIAO is the smallest member of the Seeeduino family. It carries the powerful ATSAMD21G18A-MU which is a low-power microcontrollers. On the other hand, this little board has good performance in processing but needs less power. As a matter of fact, it is designed in a tiny size and can be used for wearable devices and small projects.

Seeeduino XIAO has 14 GPIO PINs, which can be used for 11 digital interfaces, 11 mock interfaces, 10 PWM interfaces (d1-d10), 1 DAC output pin D0, 1 SWD pad interface, 1 I2C interface, 1 SPI interface, 1 UART interface, Serial communication indicator (T/R), Blink light (L). The colors of LEDs(Power,L,RX,TX) are green, yellow, blue and blue. Moreover, Seeeduino XIAO has a Type-C interface which can supply power and download code. There are two reset button, you can short connect them to reset the board.

Documentations

There are two documentations on the usage of Seeeduino XIAO which focus on different areas, check the table below for reference:

Documentation by SeeedDocumentation by Nanase
Pinout DigramInterface
Seeeduino XIAO Getting StartedSeeeduino XIAO with MicroSD Card(SPI)
Seeeduino XIAO GPIO UsageSeeeduino XIAO with GPS(UART)
Seeeduino XIAO ResourcesSingle Cycle IOBUS

CircuitPython on Seeeduino XIAO

  • Get started with CircuitPython on Seeeduino XIAO.

Features

  • Powerful CPU: ARM® Cortex®-M0+ 32bit 48MHz microcontroller(SAMD21G18) with 256KB Flash,32KB SRAM.
  • Flexible compatibility: Compatible with Arduino IDE.
  • Easy project operation: Breadboard-friendly.
  • Small size: As small as a thumb(20x17.5mm) for wearable devices and small projects.
  • Multiple development interfaces: 11 digital/analog pins, 10 PWM Pins, 1 DAC output, 1 SWD Bonding pad interface, 1 I2C interface, 1 UART interface, 1 SPI interface.

Specification

ItemValue
CPUARM Cortex-M0+ CPU(SAMD21G18) running at up to 48MHz
Flash Memory256KB
SRAM32KB
Digital I/O Pins11
Analog I/O Pins11
I2C interface1
SPI interface1
UART interface1
Power supply and downloading interfaceType-C
Power3.3V/5V DC
Dimensions20×17.5×3.5mm

Hardware Overview

Note

For general I/O pins:Working voltage of MCU is 3.3V . Voltage input connected to general I/O pins may cause chip damage if it' higher than 3.3V .

For power supply pins:The built-in DC-DC converter circuit able to change 5V voltage into 3.3V allows to power the device with a 5V supply via VIN-PIN and 5V-PIN.

Please pay attention to use, do not lift the shield cover.

Enter Bootloader Mode

Sometimes the Seeeduino XIAO port may disappear when user programming process fails. we can solve this problem by the following operation:

  • Connect the Seeeduino XIAO to your computer.
  • Use tweezers or short lines to short the RST pins in the diagram twice.
  • The orange LED lights flicker on and light up.

At this point, the chip enters Bootloader mode and the burn port appears again. Because the samd21 chip has two partitions, one is the Bootloader and the other is the user program. The product will burn a bootloader code in the system memory when it leaves the factory. We can switch modes by performing the above steps.

Reset

If you want to reset the Seeeduino XIAO, perform the following steps:

  • Connect the Seeeduino XIAO to your computer.
  • Use tweezers or short lines to short the RST pins only once
  • The orange LED lights flicker on and light up.

Interrupt

All pins on Seeeduino XIAO support interrupts, but two pins cannot be used at the same time: 5 pin and 7 pin. For more detail about Interrupt please check here.

Pin Multuiplexing

We don't need to configure the pins ourselves, after using the pins, you can call a function directly.

Digital Input and Output

  • Use pin 6 as the digital pin:

AnalogRead

  • Use pin 6 as the analog pin:

Serial

  • Use pin 6 as the TX pin of UART(RX pin of UART is pin 7):

I2C

  • Use pin 5 as the SCL pin of IIC(SDA pin of IIC is pin 4):

SPI

Seeeduino xiao input
  • Use pin 8 as the SCK pin of SPI(MISO pin of SPI is pin 9,MOSI pin of SPI is pin 10):

Analog Input and Output

While it still has PWM-based 'analog outputs', the SAMD21 also features true analog output in the form of a digital-to-analog converter (DAC). This module can produce an analog voltage between 0 and 3.3V. It can be used to produce audio with more natural sound, or as a kind of 'digital potentiometer' to control analog devices.

The DAC is only available on the Arduino pin A0, and is controlled using analogWrite(A0, ). The DAC can be set up to 10-bit resolution (make sure to call analogWriteResolution(10) in your setup), which means values between 0 and 1023 will set the voltage to somewhere between 0 and 3.3V.

In addition to the DAC, the SAMD21's ADC channels also stand apart from the ATmega328: they're equipped with up to 12-bit resolution. That means the analog input values can range from 0-4095, representing a voltage between 0 and 3.3V. To use the ADC's in 12-bit mode, make sure you call analogReadResolution(12) in your setup.

Serial Plotting the DAC

Here's an example that demonstrates both the DAC and the ADC. To set the experiment up, connect A0 to A1 -- we'll drive A0 with an analog voltage, then read it with A1. It's the simplest circuit we've ever put in a tutorial:

Note

The Seeeduino XIAO using the Seeeduino XIAO expansion board

This sketch produces a sine wave output on A0, with values ranging from 0 to 3.3V. Then it uses A1 to read that output into its ADC, and convert it into a voltage between 0 and 3.3V.

You can, of course, open the serial monitor to view the voltage values stream by. But if the the sine wave is hard to visualize through text, check out Arduino's new Serial Plotter, by going to Tools > Serial Plotter.

Code

Getting Started

Hardware

Materials required

  • Seeeduino XIAO x1
  • Computer x1
  • USB typc cable x1

Tip

Some USB cables can only supply power and cannot transfer data. If you don't have a usb cable or don't know if your usb cable can transmit data, you can check seeed USB type C support USB 3.1 .

  • Step 1. Prepare a Seeeduino XIAO and a Type-C cable.

  • Step 2. Connect the Seeeduino XIAO to your computer.Then the yellow power LED should go on.

Software

Note

If this is your first time using Arduino, we highly recommend you to refer to Getting Started with Arduino

  • Step 1. You need to Install an Arduino Software.

Launch the Arduino application

Now Supports Seeeduino Xiao M0 Xiang

Double-click the Arduino application (arduino.exe) you have previously downloaded.

Note

If the Arduino Software loads in a different language, you can change it in the preferences dialog. See the Arduino Software (IDE) page for details.

  • Step 2. Open the Blink example

Now Supports Seeeduino Xiao M0 Meng

Open the LED blink example sketch: File > Examples >01.Basics > Blink.

  • Step 3. Add Seeeduino to your Arduino IDE

Seeeduino Xiao Projects

Click on File > Preference, and fill Additional Boards Manager URLs with the url below: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json

Click Tools-> Board-> Boards Manager..., print keyword 'Seeeduino XIAO' in the searching blank. Here comes the 'Seeed SAMD Boards'. Install it.

  • Step 4. Select your board and port

After installing the board, click Tools-> Board, find 'Seeeduino XIAO M0' and select it. Now you have already set up the board of Seeeduino XIAO for Arduino IDE.

Select the serial device of the Arduino board from the Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

  • Step 5.Upload the program

Now, simply click the 'Upload' button in the environment. Wait a few seconds and if the upload is successful, the message 'Done uploading.' will appear in the status bar.

A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does, congratulations! You've gotten Arduino up-and-running. If you have problems, please see the troubleshooting suggestions.

the max size of flash is 8KB the more information at the ATSAMD218A-MU datasheet in resourses

The sample application¶

  • How to unbrick a dead xiao using raspberry pi. Thanks John_Doe for sharing.

Resourses¶

  • [PDF]Seeeduino XIAO Schematic

  • [PDF]ATSAMD218A-MU datasheet

  • [ZIP]Seeeduino KiCAD Libraries

  • [LBR]Seeeduino Eagle Libraries

Tech Support¶

Please do not hesitate to submit the issue into our forum.