Difference between revisions of "Matrix - Compact Kit B/zh"
From FriendlyELEC WiKi
(→连接NanoPi M2 / NanoPi 2 Fire) |
|||
(38 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
==介绍== | ==介绍== | ||
[[File:Matrix-Compact_Kit_B.png|thumb|]] | [[File:Matrix-Compact_Kit_B.png|thumb|]] | ||
− | *Matrix - | + | *Matrix - Compact_Kit_B是为Nanopi 2 Fire的接口开发的一款紧凑、简洁的多功能开发者套件,该套件由一系列常用电气元件经过精心构建而成,色彩斑斓,资源丰富,包括了按键、LED、无源蜂鸣器、ADC、指南针、温度传感器、红外接收器、TFT等14种资源。该套件可以直接通过40pin排母和NanoPi2 Fire连接。除了丰富的板上资源以外,您还可以通过扩展的IO口外接模块,基于本产品开发出功能丰富的应用。 |
+ | |||
==资源== | ==资源== | ||
− | Matrix - Compact Kit B集成的元件如下<br> | + | Matrix - Compact Kit B集成的元件如下:<br> |
* 0.9 TFT LCD | * 0.9 TFT LCD | ||
Line 35: | Line 36: | ||
==特性== | ==特性== | ||
− | * | + | * PCB尺寸(mm):64X40 |
[[File:Matrix-Compact_Kit_B_PCB.png|frameless|400px|]] | [[File:Matrix-Compact_Kit_B_PCB.png|frameless|400px|]] | ||
− | |||
* '''40pin排母GPIO管脚定义''' | * '''40pin排母GPIO管脚定义''' | ||
::{| class="wikitable" | ::{| class="wikitable" | ||
Line 43: | Line 43: | ||
|Pin# || Name ||Pin# || Name | |Pin# || Name ||Pin# || Name | ||
|- | |- | ||
− | |1 || | + | |1 || SYS_3.3V ||2 || VDD_5V |
|- | |- | ||
|3 || I2C0_SDA ||4 || VDD_5V | |3 || I2C0_SDA ||4 || VDD_5V | ||
Line 49: | Line 49: | ||
|5 || I2C0_SCL ||6 || DGND | |5 || I2C0_SCL ||6 || DGND | ||
|- | |- | ||
− | |7 || | + | |7 || GPIOD8/PPM ||8 || UART3_TXD/GPIOD21 |
|- | |- | ||
− | |9 || DGND ||10 || UART3_RXD | + | |9 || DGND ||10 || UART3_RXD/GPIOD17 |
|- | |- | ||
− | |11 || GPIOB29 | + | |11 || UART4_TX/GPIOB29 ||12 || GPIOD1/PWM0 |
|- | |- | ||
|13 || GPIOB30 ||14 || DGND | |13 || GPIOB30 ||14 || DGND | ||
|- | |- | ||
− | |15 || GPIOB31 | + | |15 || GPIOB31 ||16 || GPIOC14/PWM2 |
|- | |- | ||
− | |17 || | + | |17 || SYS_3.3V ||18 || GPIOB27 |
|- | |- | ||
− | |19 || SPI0_MOSI ||20 || DGND | + | |19 || SPI0_MOSI/GPIOC31 ||20 || DGND |
|- | |- | ||
− | |21 || SPI0_MISO ||22 || | + | |21 || SPI0_MISO/GPIOD0 ||22 || UART4_RX/GPIOB28 |
|- | |- | ||
− | |23 || SPI0_CLK | + | |23 || SPI0_CLK/GPIOC29 ||24 || SPI0_CS/GPIOC30 |
|- | |- | ||
− | |25 || DGND ||26 || | + | |25 || DGND ||26 || GPIOB26 |
|- | |- | ||
|27 || I2C1_SDA ||28 || I2C1_SCL | |27 || I2C1_SDA ||28 || I2C1_SCL | ||
Line 73: | Line 73: | ||
|29 || GPIOC8 ||30 || DGND | |29 || GPIOC8 ||30 || DGND | ||
|- | |- | ||
− | |31 || | + | |31 || GPIOC7 ||32 || GPIOC28 |
|- | |- | ||
− | |33 || | + | |33 || GPIOC13/PWM1 ||34 || DGND |
|- | |- | ||
− | |35 || | + | |35 || SPI2_MISO/GPIOC11 ||36 || SPI2_CS/GPIOC10 |
|- | |- | ||
− | |37 || | + | |37 || AliveGPIO3 ||38 || SPI2_MOSI/GPIOC12 |
|- | |- | ||
− | |39 || DGND ||40 || | + | |39 || DGND ||40 || SPI2_CLK/GPIOC9 |
|} | |} | ||
− | |||
− | |||
* '''30pin排针管脚定义''' | * '''30pin排针管脚定义''' | ||
::{| class="wikitable" | ::{| class="wikitable" | ||
Line 98: | Line 96: | ||
|10 || GND ||11 || VDD_5V ||12 ||D1_Pi11 | |10 || GND ||11 || VDD_5V ||12 ||D1_Pi11 | ||
|- | |- | ||
− | |13 || GND ||14 || VDD_5V ||15 || | + | |13 || GND ||14 || VDD_5V ||15 ||D2_Pi33 |
|- | |- | ||
|16 || GND ||17 || VDD_5V ||18 ||D3_Pi16 | |16 || GND ||17 || VDD_5V ||18 ||D3_Pi16 | ||
Line 116: | Line 114: | ||
::{| class="wikitable" | ::{| class="wikitable" | ||
|- | |- | ||
− | |Pin# || Name | + | |模块 ||Pin# || Name ||Pin# || Name ||Pin# || Name |
|- | |- | ||
− | |1 || VDD_5V ||2 || | + | |18B20 ||1 || VDD_5V ||2 || DATA ||3 || GND |
|- | |- | ||
− | |1 || DATA ||2 || GND ||3 || VDD_5V | + | |红外接收管 ||1 || DATA ||2 || GND ||3 || VDD_5V |
|- | |- | ||
|} | |} | ||
− | == | + | ==硬件连接== |
− | + | ===连接NanoPi M1=== | |
− | + | 参考下图连接模块:<br> | |
− | + | [[File:Matrix-Compact_Kit_B_nanopi_m1.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi_m1]] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ===连接NanoPi M2 / NanoPi 2 Fire=== | |
− | < | + | NanoPi M2和NanoPi 2 Fire的40 Pin引脚定义是一模一样的,所以它们操作Matrix配件的步骤是一样的,这里仅以NanoPi M2为例。<br> |
− | + | 参考下图连接模块:<br> | |
− | < | + | [[File:Matrix-Compact_Kit_B_nanopi_m2.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi_m2]] |
+ | |||
+ | ===连接NanoPi M3=== | ||
+ | 参考下图连接模块:<br> | ||
+ | [[File:Matrix-Compact_Kit_B_nanopi_m3.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi_m3]] | ||
− | + | ==编译运行测试程序== | |
+ | 启动开发板并运行Debian系统,进入系统后克隆Matrix代码仓库: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
+ | $ apt-get update && apt-get install git | ||
$ git clone https://github.com/friendlyarm/matrix.git | $ git clone https://github.com/friendlyarm/matrix.git | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 克隆完成后会得到一个名为matrix的目录。 | |
− | + | 编译并安装Matrix: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ cd matrix | $ cd matrix | ||
− | $ | + | $ make && make install |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 运行测试程序: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | $ | + | $ matrix-compact_kit |
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 注意:此模块并不支持热插拔,启动系统前需要确保硬件连接正确。<br> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
运行效果如下:<br> | 运行效果如下:<br> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | LED blinking 1 | |
− | + | LED blinking 2 | |
+ | Button: 1 1 1 | ||
+ | The channel0 value is 2070 | ||
+ | The angle is 336.3 | ||
+ | Pwm start | ||
+ | Pwm stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | + | 运行Qt程序,测试TFT屏: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | cd matrix/demo/nanopi-status | |
− | + | ./build.sh | |
+ | ./run.sh /dev/fb-st7735s | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 程序会显示出系统的基本信息,效果如下:<br> | |
+ | [[File:st7735s-status.pnc|frameless|600px|st7735s-status]] | ||
− | + | ==代码说明== | |
− | + | 所有的开发板都共用一套Matrix代码,本模块的测试示例代码为matrix-compact_kit,内容如下: | |
− | + | <syntaxhighlight lang="c"> | |
− | == | + | int main(int argc, char ** argv) |
− | + | { | |
− | + | int board; | |
− | <syntaxhighlight lang=" | + | |
− | + | if ((board = boardInit()) < 0) { | |
+ | printf("Fail to init board\n"); | ||
+ | return -1; | ||
+ | } | ||
+ | testLED(board); | ||
+ | readButton(); | ||
+ | readADC(); | ||
+ | readCompass(); | ||
+ | testPWM(board); | ||
+ | // readTemp(); | ||
+ | // testIR(); | ||
+ | |||
+ | return 0; | ||
+ | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | API说明参考维基:[[Matrix API reference manual/zh|Matrix API reference manual]] <br> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
==相关资料== | ==相关资料== | ||
− | *[Schematic]() | + | *[Schematic]([http://wiki.friendlyarm.com/wiki/images/9/90/SCHEMATIC1_martix_compact_B.pdf Matrix - Compact Kit B-Schematic.pdf]) |
Latest revision as of 09:39, 15 July 2016
Contents
1 介绍
- Matrix - Compact_Kit_B是为Nanopi 2 Fire的接口开发的一款紧凑、简洁的多功能开发者套件,该套件由一系列常用电气元件经过精心构建而成,色彩斑斓,资源丰富,包括了按键、LED、无源蜂鸣器、ADC、指南针、温度传感器、红外接收器、TFT等14种资源。该套件可以直接通过40pin排母和NanoPi2 Fire连接。除了丰富的板上资源以外,您还可以通过扩展的IO口外接模块,基于本产品开发出功能丰富的应用。
2 资源
Matrix - Compact Kit B集成的元件如下:
- 0.9 TFT LCD
- 轻触开关3个
- 5mm LED4个
- 无源蜂鸣器
- ADC
- 滑动变阻器
- 40pin排母
- 4pin排针---I2C接口
- 4pin排针---UART接口
- 3pin双排针---3.3V和GND
- 18B20温度传感器
- 红外接收器
- 3pin排座10个---3个模拟IO,7个数字IO(其中两个可复用为PWM,四个复用为SPI 接口)
- 指南针
3 特性
- PCB尺寸(mm):64X40
- 40pin排母GPIO管脚定义
Pin# Name Pin# Name 1 SYS_3.3V 2 VDD_5V 3 I2C0_SDA 4 VDD_5V 5 I2C0_SCL 6 DGND 7 GPIOD8/PPM 8 UART3_TXD/GPIOD21 9 DGND 10 UART3_RXD/GPIOD17 11 UART4_TX/GPIOB29 12 GPIOD1/PWM0 13 GPIOB30 14 DGND 15 GPIOB31 16 GPIOC14/PWM2 17 SYS_3.3V 18 GPIOB27 19 SPI0_MOSI/GPIOC31 20 DGND 21 SPI0_MISO/GPIOD0 22 UART4_RX/GPIOB28 23 SPI0_CLK/GPIOC29 24 SPI0_CS/GPIOC30 25 DGND 26 GPIOB26 27 I2C1_SDA 28 I2C1_SCL 29 GPIOC8 30 DGND 31 GPIOC7 32 GPIOC28 33 GPIOC13/PWM1 34 DGND 35 SPI2_MISO/GPIOC11 36 SPI2_CS/GPIOC10 37 AliveGPIO3 38 SPI2_MOSI/GPIOC12 39 DGND 40 SPI2_CLK/GPIOC9
- 30pin排针管脚定义
Pin# Name Pin# Name Pin# Name 1 GND 2 VDD_5V 3 A1_PCF 4 GND 5 VDD_5V 6 A2_PCF 7 GND 8 VDD_5V 9 A3_PCF 10 GND 11 VDD_5V 12 D1_Pi11 13 GND 14 VDD_5V 15 D2_Pi33 16 GND 17 VDD_5V 18 D3_Pi16 19 GND 20 VDD_5V 21 D4_Pi19 22 GND 23 VDD_5V 24 D5_Pi21 25 GND 26 VDD_5V 27 D6_Pi23 28 GND 29 VDD_5V 30 D7_Pi24
- 18B20和红外接收管脚定义
模块 Pin# Name Pin# Name Pin# Name 18B20 1 VDD_5V 2 DATA 3 GND 红外接收管 1 DATA 2 GND 3 VDD_5V
4 硬件连接
4.1 连接NanoPi M1
4.2 连接NanoPi M2 / NanoPi 2 Fire
NanoPi M2和NanoPi 2 Fire的40 Pin引脚定义是一模一样的,所以它们操作Matrix配件的步骤是一样的,这里仅以NanoPi M2为例。
参考下图连接模块:
4.3 连接NanoPi M3
参考下图连接模块:
Matrix-Compact_Kit_B_nanopi_m3
5 编译运行测试程序
启动开发板并运行Debian系统,进入系统后克隆Matrix代码仓库:
$ apt-get update && apt-get install git $ git clone https://github.com/friendlyarm/matrix.git
克隆完成后会得到一个名为matrix的目录。
编译并安装Matrix:
$ cd matrix $ make && make install
运行测试程序:
$ matrix-compact_kit
注意:此模块并不支持热插拔,启动系统前需要确保硬件连接正确。
运行效果如下:
LED blinking 1 LED blinking 2 Button: 1 1 1 The channel0 value is 2070 The angle is 336.3 Pwm start Pwm stop
运行Qt程序,测试TFT屏:
cd matrix/demo/nanopi-status ./build.sh ./run.sh /dev/fb-st7735s
6 代码说明
所有的开发板都共用一套Matrix代码,本模块的测试示例代码为matrix-compact_kit,内容如下:
int main(int argc, char ** argv) { int board; if ((board = boardInit()) < 0) { printf("Fail to init board\n"); return -1; } testLED(board); readButton(); readADC(); readCompass(); testPWM(board); // readTemp(); // testIR(); return 0; }
API说明参考维基:Matrix API reference manual
7 相关资料
- [Schematic](Matrix - Compact Kit B-Schematic.pdf)