Seeeduino XIAO
Seeeduino XIAO是Seeeduino家族中的最小成员。它使用了功能强大却低功耗的微控制器——ATSAMD21G18A-MU。这意味该小板在处理方面具有良好的性能,但需要的功率更少。由于它的设计尺寸很小,它可以被灵活运用于多种场景,特别是可穿戴设备和小型项目。
Seeeduino XIAO具有14个通用输入输出接口(GPIO),可用作11个数字接口,11个模拟接口,10个PWM接口(d1-d10),1个DAC输出引脚D0、1个SWD焊盘接口,1个I2C接口,1个SPI接口,1个UART 接口,串行通信指示灯(T/R),闪烁指示灯(L)。LED的颜色为绿色、黄色、蓝色和蓝色分别对应电源、L、RX和TX。此外,Seeeduino XIAO具有Type-C接口,用于提供电源和数据传输。板上有两个重置按钮,您可以短接它们来重置板子。
产品特性¶
- 强大的CPU: ARM® Cortex®-M0+ 32bit 48MHz微控制器(SAMD21G18),256KB Flash,32KB SRAM.
- 灵活的兼容性:与Arduino IDE兼容。
- 易于项目操作:可与面包板兼容。
- 体积小:适用于可穿戴设备和小型项目,小至拇指大小(20x17.5mm)。
- 多种开发接口:11个数字/模拟引脚,10个PWM引脚,1个DAC输出,1个SWD焊盘接口,1个I2C接口,1个UART接口,1个SPI接口。
规格参数¶
项目 | 数值 |
---|---|
CPU | ARM Cortex-M0+ CPU(SAMD21G18),运行频率高达48MHz |
Flash存储 | 256KB |
SRAM | 32KB |
数字I/O引脚 | 11 |
模拟I/O引脚 | 11 |
I2C接口 | 1 |
SPI接口 | 1 |
UART接口 | 1 |
电源和数据传输接口 | Type-C |
电压 | 3.3V/5V 直流 |
尺寸 | 20×17.5×3.5mm |
硬件概述¶
Note
对于通用输入输出引脚:
微控制器的工作电压为3.3V。如果连接到通用输入输出引脚的电压输入高于3.3V,则可能会损坏芯片。
1 |
|
内置的DC-DC转换电路能够将5V电压转换为3.3V,从而可以通过VIN引脚和5V引脚用5V电源为设备供电。
1 |
|
重置¶
有时,在用户编程过程失败时,Seeeduino XIAO端口可能会消失。 我们可以通过以下操作解决此问题:
- 将Seeeduino XIAO连接到你的电脑。
- 使用镊子或短线将图中的RST引脚短路两次。
- 等至橙色LED灯闪烁并点亮。
此时,芯片进入Bootloader模式,烧录端口再次出现。由于samd21芯片具有两个分区,一个分区是Bootloader,另一个分区是用户程序。 产品出厂时将在系统内存中烧录引导程序代码。因此,我们可以通过快速重置来切换模式。
中断¶
Seeeduino XIAO上的所有引脚都支持中断,但是不能同时使用两个引脚:5引脚和7引脚。有关中断的更多详细信息,请查看此处.
引脚多路复用¶
我们不需要自己手动配置引脚,使用引脚后,您可以直接调用函数。
- 将引脚6用作数字引脚:
const int buttonPin = 6; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
- 将引脚6用作模拟引脚:
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
// stop the program for <sensorValue> milliseconds:
delay(sensorValue);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for <sensorValue> milliseconds:
delay(sensorValue);
}
- 将引脚6用作UART的TX引脚(UART的RX引脚为7引脚):
void setup() {
Serial1.begin(115200);
while (!Serial);
}
void loop() {
Serial1.println("Hello,World");
delay(1000);
}
- 将引脚5用作I2C的SCL引脚(I2C的SDA引脚为4引脚):
// Wire Master Writer
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this
// Created 29 March 2006
// This example code is in the public domain.
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}
byte x = 0;
void loop()
{
Wire.beginTransmission(4); // transmit to device #4
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
x++;
delay(500);
}
- 将引脚8用作SPI的SCK引脚(SPI的MISO引脚为9引脚,SPI的MOSI引脚为10引脚):
#include <SPI.h>
const int SS = 7;
void setup (void) {
digitalWrite(SS, HIGH); // disable Slave Select
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);//divide the clock by 8
}
void loop (void) {
char c;
digitalWrite(SS, LOW); // enable Slave Select
// send test string
for (const char * p = "Hello, world!\r" ; c = *p; p++) {
SPI.transfer (c);
}
digitalWrite(SS, HIGH); // disable Slave Select
delay(2000);
}
入门指南¶
硬件¶
所需部件
- Seeeduino XIAO x1
- 电脑 x1
- USB Type-C数据线 x1
Tip
某些USB电缆只能供电,不能传输数据。如果您没有USB电缆或不知道您的USB电缆是否可以传输数据,你可以购买seeed USB type C support USB 3.1 .
-
第一步:准备Seeeduino XIAO和Type-C数据线。
-
第二步:将Seeeduino XIAO连接到您的计算机。此时,黄色电源LED指示灯应点亮。
软件¶
Note
如果这是您第一次使用Arduino,我们强烈建议您参考Arduino入门教程
- 第一步:安装Arduino IDE
启动Arduino IDE
双击您下载好的Arduino应用程序(arduino.exe)。
Note
如果您的Arduino软件为其他语言,您可以在"Peference"中进行更改。请访问Arduino软件(IDE) for details.
- 第二步:打开Blink示例
打开LED闪烁示例项目: File(文件) > Examples(示例) >01.Basics > Blink
- 第二步: 将Seeeduino添加到您的Arduino IDE
点击 File(文件) > Preference(偏好) ,并将以下网址复制到“Additional Boards Manager URLs”中: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
点击 Tools(工具) > Board(开发板)> Boards Manager... ,在搜索栏中搜索关键字 " Seeeduino XIAO "后会出现"Seeed SAMD Boards"。点击并安装它。
- 第四步:选择您的板和端口
添加了Seeeduino XIAO后,打开目录菜单 Tools(工具) > Board(开发板) , 查找并选择 " Seeeduino XIAO M0 " 。现在,您已经在Arduino IDE中完成了对Seeeduino XIAO设置。
从 Tools(工具) | Serial Port(端口) 中选择Seeeduino XIAO的串口号。 这应该COM3或数字更大的串口(COM1 和 COM2 通常为硬件串行端口保留)。如果您不知道是哪个,您可以断开Seeeduino XIAO并重新打开菜单; 消失的条目应该是Seeeduino XIAO。重新连接电路板并选择该串行端口。
- 第五步:上传程序
现在,只需单击工具栏中的“上传(Upload)”按钮。 等待几秒钟,如果上传成功,则状态栏中将显示“完成上传”的信息。
上传完成几秒钟后,您应该可以看到板上的引脚13(L)LED开始闪烁(橙色)。如果您能看到正确的闪烁,那么恭喜,您已经启动并运行了Arduino。 如果遇到问题,请参阅故障排除建议。
示例应用¶
资源¶
- [PDF] ATSAMD218A-MU数据手册
技术支持¶
如果您有任何技术问题,请提交到我们的论坛。