http://wiki.andahammer.com/api.php?action=feedcontributions&user=Adminhammer&feedformat=atomARMWorks - User contributions [en]2024-03-28T17:34:44ZUser contributionsMediaWiki 1.27.1http://wiki.andahammer.com/index.php?title=Mini210S&diff=1191Mini210S2016-05-04T22:13:34Z<p>Adminhammer: /* Linux */</p>
<hr />
<div>==Overview==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==On Board I/O==<br />
Show all connectors and signals.<br />
<br />
==Debian on SD==<br />
<br />
==Linux==<br />
Preparing an SD card to install Linux to Flash using Windows.<br />
<br />
You will need these files from the DVD or download them here: Mini210S Linux.<br />
Superboot.bin <br />
<br />
Install the SD-Flasher tool from the DVD or get it here. SD_Flasher Download.<br />
<br />
<br />
Format the SD in your computer. Use FAT32 formatting.<br />
Run-as-administrator the SD-Flasher tool and select Mini210S form the drop down menu.<br />
<br />
==Real-Time==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Mini210S&diff=1190Mini210S2016-05-04T21:58:24Z<p>Adminhammer: /* Real-Time */</p>
<hr />
<div>==Overview==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==On Board I/O==<br />
Show all connectors and signals.<br />
<br />
==Debian on SD==<br />
<br />
==Linux==<br />
<br />
==Real-Time==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Mini210S&diff=1189Mini210S2016-05-04T21:58:02Z<p>Adminhammer: /* Linux */</p>
<hr />
<div>==Overview==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==On Board I/O==<br />
Show all connectors and signals.<br />
<br />
==Debian on SD==<br />
<br />
==Linux==<br />
<br />
==快速入门==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Mini210S&diff=1188Mini210S2016-05-04T21:57:39Z<p>Adminhammer: /* Debian on SD */</p>
<hr />
<div>==Overview==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==On Board I/O==<br />
Show all connectors and signals.<br />
<br />
==Debian on SD==<br />
<br />
==机械尺寸==<br />
==快速入门==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Mini210S&diff=1187Mini210S2016-05-04T21:57:10Z<p>Adminhammer: /* On Board I/O */</p>
<hr />
<div>==Overview==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==On Board I/O==<br />
Show all connectors and signals.<br />
<br />
==接口布局==<br />
==机械尺寸==<br />
==快速入门==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Mini210S&diff=1186Mini210S2016-05-04T21:55:52Z<p>Adminhammer: /* Overview */</p>
<hr />
<div>==Overview==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==资源特性==<br />
<br />
==接口布局==<br />
==机械尺寸==<br />
==快速入门==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Mini210S&diff=1185Mini210S2016-05-04T21:55:03Z<p>Adminhammer: /* Overview */</p>
<hr />
<div>==介绍==<br />
Mini210S Single Board Computer,ARM Cortex-A CPU Samsung S5PV210 at 1GHz. Mini210S RAM: 512M DDR2, Flash: 1GB SLC NAND PowerVR SGX540 Mini210S,TFT LCD,Android 4.x, Linux/Debian/Ubuntu, WindowsCE 6.0, uCosII,IoT,smart home,HMI,industrial control,<br />
<br />
==资源特性==<br />
<br />
==接口布局==<br />
==机械尺寸==<br />
==快速入门==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=MediaWiki:Sidebar&diff=1167MediaWiki:Sidebar2016-05-02T20:01:57Z<p>Adminhammer: </p>
<hr />
<div>* Navigation<br />
** Main Page#GettingStarted|Getting Started<br />
** Main Page#Learning|Learning<br />
* Products<br />
** Main Page#CPUBoards|CPU Boards<br />
** Main Page#CarrierBoards|Carrier Boards<br />
** Main Page#NanoPCSeries|NanoPC Series<br />
** Main Page#MiniBoards|Mini Boards<br />
** Main Page#Matrix|Matrix<br />
** Main Page#LCDModules|LCD Modules<br />
** Main Page#3DModels|3D Models<br />
** Main Page#Accessories|Accessories<br />
* FAQ<br />
** Linux FAQ|Linux<br />
** Ubuntu FAQ|Ubuntu<br />
** Android FAQ|Android<br />
** WindowsCE FAQ| WindowsCE<br />
** Qt FAQ|Qt<br />
** Non-OS FAQ|Non-OS<br />
* Support<br />
** Links<br />
** http://www.andahammer.com<br />
** https://github.com/armworks Github<br />
* SEARCH<br />
* TOOLBOX<br />
* LANGUAGES</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=MediaWiki:Sidebar&diff=1166MediaWiki:Sidebar2016-05-02T19:59:48Z<p>Adminhammer: </p>
<hr />
<div>* Navigation<br />
** Main Page#GettingStarted|Getting Started<br />
** Main Page#Learning|Learning<br />
* Products<br />
** Main Page#CPUBoards|CPU Boards<br />
** Main Page#CarrierBoards|Carrier Boards<br />
** Main Page#NanoPCSeries|NanoPC Series<br />
** Main Page#MiniBoards|Mini Boards<br />
** Main Page#Matrix|Matrix<br />
** Main Page#LCDModules|LCD Modules<br />
** Main Page#3DModels|3D Models<br />
** Main Page#Accessories|Accessories<br />
* FAQ<br />
** Linux FAQ|Linux<br />
** Ubuntu FAQ|Ubuntu<br />
** Android FAQ|Android<br />
** WindowsCE FAQ| WindowsCE<br />
** Qt FAQ|Qt<br />
** Non-OS FAQ|Non-OS<br />
* Support<br />
** http://www.andahammer.com<br />
** https://github.com/armworks Github<br />
* SEARCH<br />
* TOOLBOX<br />
* LANGUAGES</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Get_Started_with_Matrix_Starter_Kit&diff=1165Get Started with Matrix Starter Kit2016-05-02T02:57:41Z<p>Adminhammer: /* Introduction to Matrix Starter Kit */</p>
<hr />
<div>[[Get Started with Matrix Stater Kit]]<br />
<br />
==Introduction to Matrix==<br />
[[File:Matrix Starter Kit.png|thumb|Matrix Starter Kit]]<br />
* The matrix starter kit is an open source hardware kit developed by FriendlyARM for makers, both hobbyists and professionals. Open source code samples are included for each module in this kit. The matrix starter kit works with most FriendlyARM boards such as the NanoPi family, the NanoPC family, and any boards with some GPIO. Matrix modules work with the Raspberry Pi and Arduino boards and clonish boards like Redboard and Metro. Check the complete Wiki for the kit.<br />
* Each module in this tutorial is simple and implements just one or two functions. With your creativity different modules can be organized to work in the ways you need.<br />
<br />
==Introduction to Matrix Starter Kit==<br />
[[File:Matrix Starter Kit01.png|framless|600px|Matrix Starter Kit01]]<br />
* Matrix starter kit contains these modules: LED, Push Button, Temperature and Humidity Sensor, Temperature Sensor, Ultrasonic Ranger, IIC LCD1602+PCF8574, Joystick, Sound Sensor, Buzzer, 3-Axis Digital Compass, 3-Axis Digital Accelerometer, Analog to Digital Converter, Relay.<br />
[[File:Matrix Starter Kit02.png|thumb|Matrix Starter Kit02]]<br />
* FriendlyARM sample code includes an alarm system, temperature & humidity alarm system, LED remote control system, distance measuring system with ultrasonic ranger, smart vehicle, and LCD clock.<br />
<br />
<br><br />
* Home site: [http://www.andahammer.com]<br><br />
* Wiki: [http://wiki.andahammer.com/Main_Page#Matrix]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Get_Started_with_Matrix_Starter_Kit&diff=1164Get Started with Matrix Starter Kit2016-05-02T02:55:17Z<p>Adminhammer: /* Introduction to Matrix */</p>
<hr />
<div>[[Get Started with Matrix Stater Kit]]<br />
<br />
==Introduction to Matrix==<br />
[[File:Matrix Starter Kit.png|thumb|Matrix Starter Kit]]<br />
* The matrix starter kit is an open source hardware kit developed by FriendlyARM for makers, both hobbyists and professionals. Open source code samples are included for each module in this kit. The matrix starter kit works with most FriendlyARM boards such as the NanoPi family, the NanoPC family, and any boards with some GPIO. Matrix modules work with the Raspberry Pi and Arduino boards and clonish boards like Redboard and Metro. Check the complete Wiki for the kit.<br />
* Each module in this tutorial is simple and implements just one or two functions. With your creativity different modules can be organized to work in the ways you need.<br />
<br />
==Introduction to Matrix Starter Kit==<br />
[[File:Matrix Starter Kit01.png|framless|600px|Matrix Starter Kit01]]<br />
* Matrix starter kit contains these modules: LED, Push Button, Temperature and Humidity Sensor, Temperature Sensor, Ultrasonic Ranger, IIC LCD1602+PCF8574, Joystick, Sound Sensor, Buzzer, 3-Axis Digital Compass, 3-Axis Digital Accelerometer, Analog to Digital Converter, Relay and etc.<br />
[[File:Matrix Starter Kit02.png|thumb|Matrix Starter Kit02]]<br />
* FriendlyARM has created some popular examples that use the kit with FriendlyARM's boards. Including an alarm system, temperature & humidity alarm system, LED remote control system, distance measuring system with ultrasonic ranger, smart vehicle, and LCD clock.<br />
<br />
<br><br />
* Home site: [http://www.andahammer.com]<br><br />
* Wiki: [http://wiki.andahammer.com/Main_Page#Matrix]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Tiny4412&diff=1163Tiny44122016-05-02T02:48:00Z<p>Adminhammer: Tiny4412 is no longer produced or supported.</p>
<hr />
<div>Out of Production: The Tiny4412 uses the Samsung Exynos4412 Quad Core processor which was unexpectedly declared End of Life by Samsung. The Tiny4412 and NanoPC-1 were not produced in large quantities and are no longer manufactured or supported.</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=NanoPi_40_pin_headers&diff=1162NanoPi 40 pin headers2016-04-15T19:16:22Z<p>Adminhammer: Created page with "* '''40 pins GPIO comparison table''' ::{| class="wikitable" |- |style="background: SteelBlue; color: white" | '''Pin#''' |style="background: PaleTurquoise; color: black" | '..."</p>
<hr />
<div>* '''40 pins GPIO comparison table'''<br />
::{| class="wikitable"<br />
|- <br />
|style="background: SteelBlue; color: white" | '''Pin#'''<br />
|style="background: PaleTurquoise; color: black" | '''NanoPi 2''' <br />
|style="background: Aquamarine; color: black" | '''NanoPi 2 Fire'''<br />'''NanoPi M2''' <br />
|style="background: SteelBlue; color: white" | '''Pin#''' <br />
|style="background: PaleTurquoise; color: black" | '''NanoPi 2''' <br />
|style="background: Aquamarine; color: black" | '''NanoPi 2 Fire'''<br />'''NanoPi M2''' <br />
|-<br />
|style="background: SteelBlue; color: white" |'''1 ''' || SYS_3.3V || SYS_3.3V ||style="background: SteelBlue; color: white" |'''2''' || VDD_5V || VDD_5V<br />
|-<br />
|style="background: SteelBlue; color: white" |'''3 ''' || I2C0_SDA || I2C0_SDA ||style="background: SteelBlue; color: white" |'''4''' || VDD_5V || VDD_5V<br />
|- <br />
|style="background: SteelBlue; color: white" |'''5''' || I2C0_SCL || I2C0_SCL ||style="background: SteelBlue; color: white" |'''6''' || DGND || DGND<br />
|-<br />
|style="background: SteelBlue; color: white" |'''7''' || style="color: Red" | UART4_RX/GPIOB28 || style="color: Red" | GPIOD8/PPM ||style="background: SteelBlue; color: white" |'''8''' || UART3_TXD/GPIOD21 || UART3_TXD/GPIOD21<br />
|-<br />
|style="background: SteelBlue; color: white" |'''9''' || DGND || DGND ||style="background: SteelBlue; color: white" |'''10''' || UART3_RXD/GPIOD17 || UART3_RXD/GPIOD17 <br />
|-<br />
|style="background: SteelBlue; color: white" |'''11''' || UART4_TX/GPIOB29 || UART4_TX/GPIOB29 ||style="background: SteelBlue; color: white" |'''12''' || style="color: Red" | GPIOB26 || style="color: Red" | GPIOD1/PWM0<br />
|-<br />
|style="background: SteelBlue; color: white" |'''13 ''' || GPIOB30 || GPIOB30 ||style="background: SteelBlue; color: white" |'''14''' || DGND || DGND<br />
|-<br />
|style="background: SteelBlue; color: white" |'''15''' || GPIOB31 || GPIOB31 ||style="background: SteelBlue; color: white" |'''16''' || GPIOC14/PWM2 || GPIOC14/PWM2<br />
|-<br />
|style="background: SteelBlue; color: white" |'''17''' || SYS_3.3V || SYS_3.3V ||style="background: SteelBlue; color: white" |'''18''' || GPIOB27 || GPIOB27<br />
|-<br />
|style="background: SteelBlue; color: white" |'''19''' || SPI0_MOSI/GPIOC31 || SPI0_MOSI/GPIOC31 ||style="background: SteelBlue; color: white" |'''20''' || DGND || DGND<br />
|-<br />
|style="background: SteelBlue; color: white" |'''21''' || SPI0_MISO/GPIOD0 || SPI0_MISO/GPIOD0 ||style="background: SteelBlue; color: white" |'''22''' || style="color: Red" | PWM0/GPIOD1 || style="color: Red" | UART4_RX/GPIOB28<br />
|-<br />
|style="background: SteelBlue; color: white" |'''23''' || SPI0_CLK/GPIOC29 || SPI0_CLK/GPIOC29 ||style="background: SteelBlue; color: white" |'''24''' || SPI0_CS/GPIOC30 || SPI0_CS/GPIOC30<br />
|-<br />
|style="background: SteelBlue; color: white" |'''25''' || DGND || DGND ||style="background: SteelBlue; color: white" |'''26''' || style="color: Red" | PWM1/GPIOC13 || style="color: Red" | GPIOB26<br />
|-<br />
|style="background: SteelBlue; color: white" |'''27''' || I2C1_SDA || I2C1_SDA ||style="background: SteelBlue; color: white" |'''28''' || I2C1_SCL || I2C1_SCL<br />
|-<br />
|style="background: SteelBlue; color: white" |'''29''' || GPIOC8 || GPIOC8 ||style="background: SteelBlue; color: white" |'''30''' || DGND || DGND<br />
|-<br />
|style="background: SteelBlue; color: white" |'''31''' || style="color: Red" | SPI2_CLK/GPIOC9 || style="color: Red" | GPIOC7 ||style="background: SteelBlue; color: white" |'''32''' || GPIOC28 || GPIOC28<br />
|-<br />
|style="background: SteelBlue; color: white" |'''33''' || style="color: Red" | SPI2_CS/GPIOC10 || style="color: Red" | GPIOC13/PWM1 ||style="background: SteelBlue; color: white" |'''34''' || DGND || DGND<br />
|-<br />
|style="background: SteelBlue; color: white" |'''35''' || style="color: Red" | SPI2_MOSI/GPIOC12 || style="color: Red" | SPI2_MISO/GPIOC11 ||style="background: SteelBlue; color: white" |'''36''' || style="color: Red" | GPIOC7 || style="color: Red" | SPI2_CS/GPIOC10<br />
|-<br />
|style="background: SteelBlue; color: white" |'''37''' || style="color: Red" | SPI2_MISO/GPIOC11 || style="color: Red" | AliveGPIO3 ||style="background: SteelBlue; color: white" |'''38''' || style="color: Red" | ALIVEGPIO2 || style="color: Red" | SPI2_MOSI/GPIOC12<br />
|-<br />
|style="background: SteelBlue; color: white" |'''39''' || DGND || DGND ||style="background: SteelBlue; color: white" |'''40''' || style="color: Red" | ALIVEGPIO3 || style="color: Red" | SPI2_CLK/GPIOC9<br />
|}<br />
<br />
[[Products Specifications]]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=NanoPi_Comparison&diff=1161NanoPi Comparison2016-04-15T19:14:20Z<p>Adminhammer: Created page with "=== Products Specifications === {| class="wikitable sortable" ! Name ! Image ! Year ! CPU ! GPU ! RAM ! Storage ! USB ! Video out ! Video in ! Audio in ! Audio out ! Network..."</p>
<hr />
<div>=== Products Specifications ===<br />
{| class="wikitable sortable"<br />
! Name<br />
! Image<br />
! Year<br />
! CPU<br />
! GPU<br />
! RAM<br />
! Storage<br />
! USB<br />
! Video out<br />
! Video in<br />
! Audio in<br />
! Audio out<br />
! Network<br />
! Peripherals<br />
! Power source<br />
! PCB size<br />
! OS/Solfware<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPC-T1 NanoPC-T1](EOL)<br />
| [[File:NanoPC-T1.png|300px]]<br />
| 2014<br />
| Samsung Exynos4412, quad core Cortex-A9, 1.5GHz<br />
| Mali-400 MP<br />
| 1GB DDR3<br />
| SD x1;<br />
eMMC 8GB<br />
| USB 2.0 Host type A x2;<br />
USB 2.0 Device MicroUSB x1<br />
| RGB Parallel I/F (24-bit), 40 pins 0.5 mm pitch SMT FPC seat;<br />
HDMI 1.4a<br />
| MIPI-CSI, 15 pins 1.0mm spacing FPC seat<br />
| On board Mic<br />
| 3.5 mm jack; HDMI<br />
| 10/100Mbps Ethernet<br />
| 2.54mm spacing 30pin, It includes UART, SPI, I2C, IO etc;<br />
RTC battery;<br />
EEPROM with MAC address;<br />
IR receiver<br />
| 5V/2A, via DC jack<br />
| 100x60mm<br />
| Android, ubuntu<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPi NanoPi](EOL)<br />
| [[File:NanoPi-01B.jpg|300px]]<br />
| 2015<br />
| Samsung S3C2451, 400Mhz, ARM926EJ<br />
| 2D graphics accelerator<br />
| 64MB DDR2<br />
| MicroSD x1<br />
| USB 1.1 Host type A x1;<br />
USB 2.0 Device MicroUSB x1<br />
| RGB Parallel I/F (24-bit), 40 pins 0.5 mm pitch SMT FPC seat<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit, 24 pins 0.5mm spacing FPC seat<br />
|<br />
|<br />
| Wi-Fi b/g/n and Bluetooth 4.0 dual mode, Using AP6210<br />
| 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, IO etc;<br />
2.54mm spacing 12pin. It includes I2S, I2C, UART etc<br />
| 5V/1A, via MicroUSB Or 2.54mm spacing headrs<br />
| 75x30mm<br />
| u-boot, Linux-4.1, Debian8 jessie, Rabbit linux<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPi_2 NanoPi 2]<br />
| [[File:NanoPi 2-01B.jpg|300px]]<br />
| 2015<br />
| S5P4418, quad core Cortex-A9, 1.4GHz<br />
| Mali-400 MP<br />
| 1GB DDR3<br />
| MicroSD x2<br />
| USB 2.0 Host type A x1, USB 2.0 Device MicroUSB x1<br />
| RGB Parallel I/F (24-bit), 40 pins 0.5 mm pitch SMT FPC seat;<br />
HDMI 1.4a<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit, 24 pins 0.5mm spacing FPC seat<br />
|<br />
| HDMI<br />
| Wi-Fi b/g/n and Bluetooth 4.0 dual mode, Using AP6212<br />
| 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, PWM, IO etc;<br />
RTC battery header<br />
| 5V/2A, via MicroUSB Or 2.54mm spacing headrs<br />
| 75x40mm<br />
| Android, Debian, ubuntu-mate, ubuntu-core, Kali, Deepin<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPi_2_Fire NanoPi 2 Fire]<br />
| [[File:NanoPi 2 Fire-01B.jpg|300px]]<br />
| 2016<br />
| S5P4418, quad core Cortex-A9, 1.4GHz<br />
| Mali-400 MP<br />
| 1GB DDR3<br />
| MicroSD x1<br />
| USB 2.0 Host type A x1;<br />
USB 2.0 Device MicroUSB x1<br />
| RGB Parallel I/F (24-bit), 40 pins 0.5 mm pitch SMT FPC seat;<br />
HDMI 1.4a<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit, 24 pins 0.5mm spacing FPC seat<br />
|<br />
| HDMI<br />
| 10/100/1000Mbps Ethernet<br />
| 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, PWM, IO etc;<br />
RTC battery header<br />
| 5V/2A, via MicroUSB Or 2.54mm spacing headrs<br />
| 75x40mm<br />
| Android, Debian, ubuntu-mate, ubuntu-core, Kali, Deepin<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPi_M2 NanoPi M2]<br />
| [[File:NanoPi M2-01B.jpg|300px]]<br />
| 2016<br />
| S5P4418, quad core Cortex-A9, 1.4GHz<br />
| Mali-400 MP<br />
| 1GB DDR3<br />
| MicroSD x1<br />
| USB 2.0 Host type A x2 and x2 via 2.54mm header;<br />
USB 2.0 Device MicroUSB x1<br />
| RGB Parallel I/F (24-bit), 40 pins 0.5 mm pitch SMT FPC seat;<br />
HDMI 1.4a<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit, 24 pins 0.5mm spacing FPC seat<br />
| On board Mic<br />
| 3.5 mm jack; HDMI<br />
| 10/100/1000Mbps Ethernet<br />
| 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, PWM, IO etc;<br />
RTC battery header<br />
| 5V/2A, via MicroUSB Or 2.54mm spacing headrs<br />
| 64x56mm<br />
| Android, Debian, ubuntu-mate, ubuntu-core, Kali, Deepin<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPC-T2 NanoPC-T2]<br />
| [[File:NanoPC-T2-01B.jpg|300px]]<br />
| 2016<br />
| S5P4418, quad core Cortex-A9, 1.4GHz<br />
| Mali-400 MP<br />
| 1GB DDR3<br />
| SD x1;<br />
eMMC 8GB<br />
| USB 2.0 Host type A x2 and x2 via 2.54mm header;<br />
USB 2.0 Device MicroUSB x1<br />
| RGB Parallel I/F (24-bit), 40 pins 0.5 mm pitch SMT FPC seat;<br />
LVDS, 2x10 pins 2.0mm header;<br />
MIPI-DSI, 30 pins 0.5mm spacing FPC seat;<br />
HDMI 1.4a<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit, 24 pins 0.5mm spacing FPC seat;<br />
MIPI-CSI, 30 pins 0.5mm spacing FPC seat<br />
| On board Mic<br />
| 3.5 mm jack; HDMI<br />
| 10/100/1000Mbps Ethernet;<br />
Wi-Fi b/g/n and Bluetooth 4.0 dual mode, Using AP6212<br />
| 2.54mm spacing 30pin, It includes UART, SPI, I2C, PWM, IO etc;<br />
RTC battery seat;<br />
EEPROM with MAC address<br />
| 5V/2A, via DC jack<br />
| 100x60mm<br />
| Android, Debian, ubuntu-mate, ubuntu-core, Kali, Deepin<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/Smart4418 Smart4418]<br />
|[[File:Smart4418-view.png|300px]]<br />
| 2016<br />
| S5P4418, quad core Cortex-A9, 1.4GHz<br />
| Mali-400 MP<br />
| 1GB DDR3<br />
| eMMC 8GB; up to 2x SDIO/MMC I/F<br />
| USB 2.0 Host x1; USB 2.0 OTG x1<br />
| RGB Parallel I/F (24-bit); LVDS; HDMI 1.4a<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit; MIPI-CSI<br />
| Mic in<br />
| Headphone audio out; HDMI<br />
| 10/100/1000Mbps Ethernet<br />
| 2x 2.0mm spacing 70pin header an 1x 2.0mm spacing 34pin header, includes UART, SPI, I2C, PWM, ADC, IO etc;<br />
EEPROM with MAC address<br />
| 5V/1.2A<br />
| 74x55mm<br />
| Android, Debian, ubuntu-mate, ubuntu-core, Kali, Deepin<br />
|-<br />
! [http://wiki.friendlyarm.com/wiki/index.php/NanoPi_M1 NanoPi M1]<br />
|[[File:NanoPi M1-1.jpg|300px]]<br />
| 2016<br />
| Allwinner H3, Quad-core Cortex-A7@1.2GHz<br />
| Mali-400 MP2<br />
| 512MB DDR3<br />
| MicroSD x1<br />
| USB 2.0 Host type A x3 ;<br />
USB 2.0 OTG MicroUSB x1<br />
| HDMI 1.4; CVBS<br />
| DVP Camera interface, ITU-R BT 601/656 8-bit<br />
| Mic in<br />
| HDMI; 3.5mm Jack AV-OUT<br />
| 10/100Mbps Ethernet<br />
| 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, PWM, IO etc; Onboard IR receiver<br />
| 5V/1A<br />
| 64x50mm<br />
| Debian, ubuntu-mate<br />
|}<br />
[http://wiki.friendlyarm.com/wiki/index.php/40_pins_GPIO_comparison_table NanoPi Serial 40Pin GPIO Comparison Table]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Main_Page&diff=1160Main Page2016-04-15T19:12:47Z<p>Adminhammer: </p>
<hr />
<div><br />
<div id="GettingStarted"></div><br />
=Getting Started=<br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Get Started with Matrix Starter Kit]]<br />
*[[NanoPi Comparison]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPi 40 pin headers]]<br />
*[[How To D]]<br />
|}<br />
<br />
<br />
<div id="Learning"></div><br />
<br />
=Learning=<br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[How to build the Compiling Environment]]<br />
*[[Learning...]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Learning...]]<br />
*[[Learning...]]<br />
|}<br />
<br />
<br />
<div id="Products"></div><br />
<br />
=Products=<br />
===CPU Boards===<br />
<div id="CPUBoards"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Tiny4412]] <br />
*[[Super4412]]<br />
*[[Super4418]]<br />
*[[Smart4418]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Smart210]]<br />
*[[Tiny210]]<br />
*[[Tiny3358]]<br />
*[[Tiny6410]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Micro2440]]<br />
*[[Micro2451]]<br />
*[[Tiny2451]]<br />
*[[Tiny2416]]<br />
<br />
|}<br />
<br />
===Carrier Boards===<br />
<div id="CarrierBoards"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Micro2440/2451 SDK]]<br />
*[[Smart210/4418 SDK]]<br />
*[[Smart210/4418 ADK]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Tiny2416/2451/6410/210 ADK]]<br />
*[[Tiny2416/2451/6410/210 SDK]]<br />
*[[Tiny3358 ITX SDK]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Tiny4412 ADK]] <br />
*[[Tiny4412 SDK]]<br />
<br />
<br />
|}<br />
<br />
===NanoPC Series===<br />
<div id="NanoPCSeries"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[DragonPi-C2]]<br />
*[[NanoPC-M1]]<br />
*[[NanoPC-T1]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPC-T1S]]<br />
*[[NanoPC-T1S Plus]]<br />
*[[NanoPC-T2]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPi]] <br />
*[[NanoPi 2]] <br />
*[[NanoPi 2 Fire]]<br />
<br />
|}<br />
<br />
===Mini Boards===<br />
<div id="MiniBoards"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Mini210S]]<br />
*[[Mini2440]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Mini2451]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Mini6410]] <br />
<br />
|}<br />
<br />
<div id="Matrix"></div><br />
{{Matrix}}<br />
<br />
===Matrix Kit===<br />
<div id="Matrix Kit"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
<!-- comments<br />
*[[Matrix - 0.96inch 128x64 OLED]]<br />
--><br />
*[[Matrix Starter Kit with NanoPi]]<br />
*[[Matrix Starter Kit with RasberryPi]]<br />
*[[Matrix Starter Kit with Arduino]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
|}<br />
<br />
===LCDModules===<br />
<div id="LCDModules"></div><br />
<br />
===3D Models===<br />
<div id="3DModules"></div><br />
<br />
===Accessories===<br />
<div id="Accessories"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPC-T1 Case]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
|}</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Get_Started_with_Matrix_Starter_Kit&diff=1159Get Started with Matrix Starter Kit2016-04-15T18:59:27Z<p>Adminhammer: </p>
<hr />
<div>[[Get Started with Matrix Stater Kit]]<br />
<br />
==Introduction to Matrix==<br />
[[File:Matrix Starter Kit.png|thumb|Matrix Starter Kit]]<br />
* The matrix starter kit is an open source hardware kit developed by FriendlyARM for makers, hobbyists and geeks. We have rich open source code samples for each module in this kit. The matrix starter kit can work with multiple FriendlyARM boards such as the 4412, the NanoPC etc. It can also work with the Raspberry Pi and the Arduino boards. We have a complete wiki for the kit and provide detailed code samples and tutorials. You can create varitions innovations with these modules.<br />
* You can do IOT applications, mobile intelligent applications, control amd human interface experiments. Each module in this tutorial is simple and implements just one or two functions. But with great creativity different modules can be organized to work in numerous ways and generate new results.<br />
<br />
==Introduction to Matrix Starter Kit==<br />
[[File:Matrix Starter Kit01.png|framless|600px|Matrix Starter Kit01]]<br />
* Matrix starter kit contains these modules: LED, Push Button, Temperature and Humidity Sensor, Temperature Sensor, Ultrasonic Ranger, IIC LCD1602+PCF8574, Joystick, Sound Sensor, Buzzer, 3-Axis Digital Compass, 3-Axis Digital Accelerometer, Analog to Digital Converter, Relay and etc.<br />
[[File:Matrix Starter Kit02.png|thumb|Matrix Starter Kit02]]<br />
* FriendlyARM has created some popular examples that use the kit with FriendlyARM's boards. Including an alarm system, temperature & humidity alarm system, LED remote control system, distance measuring system with ultrasonic ranger, smart vehicle, and LCD clock.<br />
<br />
<br><br />
* Home site: [http://www.andahammer.com]<br><br />
* Wiki: [http://wiki.andahammer.com/Main_Page#Matrix]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Main_Page&diff=1158Main Page2016-02-10T05:04:40Z<p>Adminhammer: /* LCDModules */ Spelling error</p>
<hr />
<div><br />
<div id="GettingStarted"></div><br />
=Getting Started=<br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Get Started with Matrix Starter Kit]]<br />
*[[How To B]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[How To C]]<br />
*[[How To D]]<br />
|}<br />
<br />
<br />
<div id="Learning"></div><br />
<br />
=Learning=<br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[How to build the Compiling Environment]]<br />
*[[Learning...]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Learning...]]<br />
*[[Learning...]]<br />
|}<br />
<br />
<br />
<div id="Products"></div><br />
<br />
=Products=<br />
===CPU Boards===<br />
<div id="CPUBoards"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Tiny4412]] <br />
*[[Super4412]]<br />
*[[Super4418]]<br />
*[[Smart4418]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Smart210]]<br />
*[[Tiny210]]<br />
*[[Tiny3358]]<br />
*[[Tiny6410]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Micro2440]]<br />
*[[Micro2451]]<br />
*[[Tiny2451]]<br />
*[[Tiny2416]]<br />
<br />
|}<br />
<br />
===Carrier Boards===<br />
<div id="CarrierBoards"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Micro2440/2451 SDK]]<br />
*[[Smart210/4418 SDK]]<br />
*[[Smart210/4418 ADK]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Tiny2416/2451/6410/210 ADK]]<br />
*[[Tiny2416/2451/6410/210 SDK]]<br />
*[[Tiny3358 ITX SDK]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Tiny4412 ADK]] <br />
*[[Tiny4412 SDK]]<br />
<br />
<br />
|}<br />
<br />
===NanoPC Series===<br />
<div id="NanoPCSeries"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[DragonPi-C2]]<br />
*[[NanoPC-M1]]<br />
*[[NanoPC-T1]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPC-T1S]]<br />
*[[NanoPC-T1S Plus]]<br />
*[[NanoPC-T2]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPi]] <br />
*[[NanoPi 2]] <br />
*[[NanoPi 2 Fire]]<br />
<br />
|}<br />
<br />
===Mini Boards===<br />
<div id="MiniBoards"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[Mini210S]]<br />
*[[Mini2440]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Mini2451]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[Mini6410]] <br />
<br />
|}<br />
<br />
<div id="Matrix"></div><br />
{{Matrix}}<br />
<br />
===Matrix Kit===<br />
<div id="Matrix Kit"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
<!-- comments<br />
*[[Matrix - 0.96inch 128x64 OLED]]<br />
--><br />
*[[Matrix Starter Kit with NanoPi]]<br />
*[[Matrix Starter Kit with RasberryPi]]<br />
*[[Matrix Starter Kit with Arduino]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
|}<br />
<br />
===LCDModules===<br />
<div id="LCDModules"></div><br />
<br />
===3D Models===<br />
<div id="3DModules"></div><br />
<br />
===Accessories===<br />
<div id="Accessories"></div><br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[NanoPC-T1 Case]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
<br />
|width="32%" valign="top" align="left"|<br />
<br />
|}</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_YS6000_(SD_WiFi_%26_Bluetooth)&diff=1157Matrix - YS6000 (SD WiFi & Bluetooth)2016-02-10T05:02:59Z<p>Adminhammer: </p>
<hr />
<div>[http://www.friendlyarm.com/index.php?route=product/product&product_id=69 YS6000]<br />
<br />
==Introduction==<br />
[[File:YS6000.png|thumb|YS6000]]<br />
The YS6000 SD WiFi & Bluetooth board uses the AP6210 module. It integrates SDIO WiFi and low power UARTBluetooth 4.0, and has on board porcelain antenna. It can be connected to theTiny4412 SDK-1312B carrier board via a 30 Pin 2.0 mm spacing double pin header.It works with Android 5.0 and Ubuntu. <br />
==Features==<br />
*802.11b/g/n Single-band radio<br />
*Frequency Range: 2.4 Ghz – 2.497 Ghz<br />
*Number of channels: 2.4GHz: Ch1-Ch14<br />
*Bluetooth V4.0 + EDR with intergrated Class 1.5 PA Concurrent Bluetooth and WLAN operation<br />
*WLAN host interface options: SDIO v2.0 – up to 50Mhz clock rate<br />
*BT host digital interface: UART(up to 4 Mbps)<br />
*IEEE Co-existence technologies are integrated die solution<br />
*Operating temperature: -30 to 85 degree<br />
<br />
==Dimesions==<br />
[[File:YS6000-1504-Dimesions.jpg |frameless|500px|]]<br />
<br />
==Resources==<br />
* [Schematic]( [http://wiki.friendlyarm.com/wiki/images/f/f3/WiFi%2BBT-YS6000-1504-Schematic.pdf YS6000-1504-Schematic.pdf])</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Ultrasonic_Ranger&diff=1156Matrix - Ultrasonic Ranger2016-02-10T05:02:27Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:UltrasonicRanger01.png|thumb|Ultrasonic Ranger01]]<br />
* The Matrix-Ultrasonic_Ranger is used to measure the distance.<br />
* The module's sensor emits a sound wave, which bounces off a reflective surface and returns to the sensor. Then, using the amount of time it takes for the wave to return to the sensor, the distance to the object can be computed.<br />
<br />
==Features==<br />
* 5V Power<br />
* Range: 5 cm - 300 cm,Accuracy: 1 cm<br />
* One wire gpio <br />
* PCB Dimension (mm): 20 x 40<br />
[[File:ultpcb.png|frameless|400px|超声波PCB]]<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
* The sensor emits a 40kHz, 6 mm sound wave, which bounces off a reflective surface and returns to the sensor. The receiver converts ultrasound waves to electrical signals in mV.<br />
* The master sends a signal to the module starting to emit a sound wave. After the module receives the returned signal it will will generate a high level indicating the elapsed time and the distance will be calculated by distance = (elapsed time * speed of sound)/2.<br />
[[File:Ultrasonic Ranger.png|thumb|matrix Ultrasonic Ranger]]<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki: [[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch. <br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Ultrasonic_Ranger to the NanoPi <br><br />
[[File:ur&NanoPi.png|frameless|400px|NanoPi+ur]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Sound_Sensor || NanoPi<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Ultrasonic_Ranger" module is "matrix-ultrasonic_ranger".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-ultrasonic_ranger<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int distance = -1;<br />
<br />
int pin = GPIO_PIN1;<br />
<br />
if (Hcsr04Init(pin) == -1) {<br />
printf("Fail to init hcsr04\n");<br />
}<br />
if (Hcsr04Read(&distance) != -1) {<br />
printf("Get distance: %3d cm\n", distance);<br />
} else {<br />
printf("Faid to get distance\n");<br />
}<br />
Hcsr04DeInit();<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Ultrasonic_Ranger to the Tiny4412 <br><br />
[[File:ur&tiny4412.png|frameless|400px|tiny4412+ur]]<br />
<br><br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix- Ultrasonic Ranger || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore. <br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Ultrasonic_Ranger" module is "matrix-ultrasonic_ranger".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-ultrasonic_ranger<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int distance = -1;<br />
<br />
int pin = GPIO_PIN1;<br />
<br />
if (Hcsr04Init(pin) == -1) {<br />
printf("Fail to init hcsr04\n");<br />
}<br />
if (Hcsr04Read(&distance) != -1) {<br />
printf("Get distance: %3d cm\n", distance);<br />
} else {<br />
printf("Faid to get distance\n");<br />
}<br />
Hcsr04DeInit();<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
<br />
<br />
<!--<br />
<br />
==介绍==<br />
[[File:UltrasonicRanger.png|thumb|Ultrasonic Ranger]]<br />
TODO<br />
<br />
==特性==<br />
* 特性1<br />
* 特性2<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::GND: Ground<br />
::VCC: 5V<br />
::ECHO: GPIO PIN1<br />
::TRIG: GPIO PIN2<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <unistd.h><br />
#include "libfahw.h"<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int distance = -1;<br />
<br />
int echoPin = TINY4412_GPIO_PIN1;<br />
int triggerPin = TINY4412_GPIO_PIN2;<br />
<br />
if (Hcsr04Init(echoPin, triggerPin) == -1) {<br />
printf("Fail to init hcsr04\n");<br />
}<br />
<br />
if (Hcsr04Read(&distance)==0 && distance != -1) {<br />
printf("Get distance: %3d cm\n", distance);<br />
} else {<br />
printf("Faid to get distance\n");<br />
}<br />
Hcsr04DeInit();<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-ultrasonic_ranger<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Thermistor&diff=1155Matrix - Thermistor2016-02-10T05:01:38Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Thermistor.png|thumb|Thermistor]]<br />
*The Matrix-Thermistor module is a thermistor module. It has a 3 pin 2.54mm spacing pin header of which V is supply voltage, G is ground and S is output analog signal. Users can convert output analog signals to digital signals via ADC conversion.<br />
*To increase measured values' accuracy please make the sensor in close contact with a measured object.<br />
<br />
==Features==<br />
* GPIO, 3.3/5V<br />
* Small<br />
* 2.54mm spacing pin header<br />
* PCB Dimension(mm): 8 x 24<br />
[[File:Thermistor01.png | frameless|400px|Thermistor01.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || Analog GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
* The module mainly contains a thermistor. A thermistor is a type of resistor whose resistance is dependent on temperature.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub: https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi;<br />
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2;<br />
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;<br />
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi;<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br><br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Thermistor to the NanoPi 2:<br><br />
[[File:Matrix-Thermistor.jpg|frameless|600px|Matrix-Thermistor]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Analog_to_Digital_Converter || NanoPi 2 <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Thermistor || <br />
|-<br />
|GND || NanoPi 2 Pin9<br />
|-<br />
|5V || NanoPi 2 Pin2<br />
|-<br />
|S || Matrix-Analog_to_Digital_Converter A0<br />
|}<br />
This module's output signals are analog signals. You can use our Matrix-Analog_to_Digital_Converter to convert them to digital signals.<br><br />
Please connect the Matrix-Analog_to_Digital_Converter to the NanoPi 2 and then connect Pin S of the Matrix-Thermistor's pin header to Matrix-Analog_to_Digital_Converter's A0.<br><br />
For more details about the Matrix-Analog_to_Digital_Converter module please refer to wiki:[[Matrix_-_Analog_to_Digital_Converter]].<br><br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. Its test program is "matrix-adc".<br><br />
The modules are under the "modules" directory. Its driver's source code is in https://github.com/friendlyarm/linux-3.4.y.git.<br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the driver, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod pcf8591.ko<br />
</syntaxhighlight><br />
<br />
Please run the following command to test the Matrix-Thermistor module.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-adc<br />
</syntaxhighlight><br />
Here is what you should expect:<br><br />
[[File:matrix-adc_result.png|frameless||matrix-adc_result]] <br><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int i = 0;<br />
int value = 0;<br />
int channel = 0;<br />
<br />
if (argc == 2) {<br />
channel = atoi(argv[1]);<br />
}<br />
<br />
for (i=0; i<ADC_READ_TIMES; i++) {<br />
if (pcf8591Read(channel, &value) != -1) {<br />
printf("channel%d value=%d\n", channel, value);<br />
} else {<br />
printf("Fail to get channel%d value\n", channel); <br />
}<br />
usleep(10000);<br />
}<br />
return 0;<br />
}<br />
</syntaxhighlight></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Temperature_Sensor&diff=1154Matrix - Temperature Sensor2016-02-10T05:00:42Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:TemperatureSensor01.png|thumb|Temperature Sensor]]<br />
* The matrix-temperature_sensor module is used to measure temperature.<br />
* We utilitze the DS18B20 chip with the To-92 package in this module. Its unique 1-wire interface requires only 1 port pin for reading/writing. Power for reading, writing, and performing temperature conversions can be derived from the data line itself with no need for an external power source. The DS18B20 can be powered from its data line. Each DS18B20 is assigned a unique ID. <br />
* Its temperature range is -55 degree Celsius to +125 degree Celsius. The thermometer resolution is programmable from 9 to 12 bits. When the measured temperature is between -10 degree Celsius to +85 degree Celsius the accuracy can be at 0.5 degree. Among all three DS18B20 pins V is power, G is ground and S is data.<br />
<br />
==Features==<br />
* -55 degree Celsius to +125 degree Celsius<br />
* One wire interface for communication<br />
* Tiny, easy to be deployed in various situations<br />
* 2.54mm spacing pin<br />
* PCB dimension(mm): 8 X 24<br />
[[File:temppcb.png|frameless|400px|温度传感器PCB]]<br />
<br />
<br />
*Pin Description: <br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|- <br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
The core functionality of the DS18B20 is its direct-to-digital temperature sensor. The resolution of the DS18B20 is configurable (9, 10, 11, or 12 bits), with 12-bit readings the factory default state. This<br />
equates to a temperature resolution of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C. Following the issuance of the Convert T [44h] command, a temperature conversion is performed and the thermal data is stored in the scratchpad memory in a 16-bit, sign-extended two’s complement format. The temperature information can be retrieved over the 1-Wire interface by issuing a Read Scratchpad [BEh] command once the conversion has been performed. The data is transferred over the 1-Wire bus, LSB first. The MSB of the temperature register contains the “sign” (S) bit, denoting whether the temperature is positive or negative.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki: [[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Temperature_Sensor module to the NanoPi <br><br />
[[File:matrix-temperature_sensor_nanopi.jpg|frameless|600px|matrix-temperature_sensor_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Temperature Sensor || NanoPi<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Temperature_Sensor" module is "matrix-temperature_sensor".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-temperature_sensor<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD = -1;<br />
int pin = GPIO_PIN1;<br />
char *temperature = (char *) malloc(32);<br />
memset(temperature, 0, 32);<br />
<br />
if (argc == 2) {<br />
parseCmd(argc, argv, &pin);<br />
} else {<br />
printf("Using default pin GPIO_PIN1\n");<br />
}<br />
<br />
if ((devFD = ds18b20Init(pin)) == -1) {<br />
printf("Fail to init ds18b20\n");<br />
return -1;<br />
}<br />
if (ds18b20Read(temperature) > 0) {<br />
printf("Temperature = %s\n", temperature);<br />
} else {<br />
printf("Fail to get temperature\n"); <br />
}<br />
free(temperature);<br />
ds18b20DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Temperature_Sensor to the Tiny4412 <br><br />
[[File:matrix-temperature_sensor_tiny4412.jpg|frameless|600px|matrix-temperature_sensor_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Temperature Sensor || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Temperature_Sensor" module is "matrix-temperature_sensor".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-temperature_sensor<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD = -1;<br />
int pin = GPIO_PIN1;<br />
char *temperature = (char *) malloc(32);<br />
memset(temperature, 0, 32);<br />
<br />
if (argc == 2) {<br />
parseCmd(argc, argv, &pin);<br />
} else {<br />
printf("Using default pin GPIO_PIN1\n");<br />
}<br />
<br />
if ((devFD = ds18b20Init(pin)) == -1) {<br />
printf("Fail to init ds18b20\n");<br />
return -1;<br />
}<br />
if (ds18b20Read(temperature) > 0) {<br />
printf("Temperature = %s\n", temperature);<br />
} else {<br />
printf("Fail to get temperature\n"); <br />
}<br />
free(temperature);<br />
ds18b20DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf DS18B20.pdf]<br />
<br />
<br />
<br />
<!--<br />
==Introduction==<br />
[[File:TemperatureSensor01.png|thumb|Temperature Sensor]]<br />
We utilitze the DS18B20 in this module. The DS18B20 can be powered from its data line. Each DS18B20 is assigned a unique ID. Its temperature range is -55 degree Celsius to +125 degree Celsius. The thermometer resolution is programmable from 9 to 12 bits. When the measured temperature is between -10 degree Celsius to +85 degree Celsius the accuracy can be at 0.5 degree. It uses the unique 1-wire interface which requires only one port pin for communication. Among all three DS18B20 pins V is power, G is ground and S is data.<br />
<br />
==Features==<br />
* -55 degree Celsius to +125 degree Celsius<br />
* One wire interface for communication<br />
* Tiny, easy to be used in various situations<br />
* 2.54mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::GND: Ground<br />
::VCC: 5V<br />
::S: GPIO_PIN1<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <string.h><br />
#include <stdlib.h><br />
#include "libfahw.h"<br />
<br />
void parseCmd(int argc, char **argv, int *pin)<br />
{<br />
int num = atoi(argv[1]);<br />
switch(num) {<br />
case 1:<br />
*pin = TINY4412_GPIO_PIN1;<br />
break;<br />
case 2:<br />
*pin = TINY4412_GPIO_PIN2;<br />
break;<br />
case 3:<br />
*pin = TINY4412_GPIO_PIN3;<br />
break;<br />
case 4:<br />
*pin = TINY4412_GPIO_PIN4;<br />
break;<br />
case 5:<br />
*pin = TINY4412_GPIO_PIN5;<br />
break;<br />
case 6:<br />
*pin = TINY4412_GPIO_PIN6;<br />
break;<br />
case 7:<br />
*pin = TINY4412_GPIO_PIN7;<br />
break;<br />
case 8:<br />
*pin = TINY4412_GPIO_PIN8;<br />
break;<br />
case 9:<br />
*pin = TINY4412_GPIO_PIN9;<br />
break;<br />
case 10:<br />
*pin = TINY4412_GPIO_PIN10;<br />
break;<br />
default:<br />
printf("Unsupported pin TINY4412_GPIO_PIN%d\n", num);<br />
num = 1;<br />
*pin = TINY4412_GPIO_PIN1;<br />
break;<br />
}<br />
printf("Using pin TINY4412_GPIO_PIN%d\n", num);<br />
}<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int devFD = -1;<br />
int pin = TINY4412_GPIO_PIN1;<br />
char *temperature = (char *) malloc(32);<br />
memset(temperature, 0, 32);<br />
<br />
if (argc == 2) {<br />
parseCmd(argc, argv, &pin);<br />
} else {<br />
printf("Using default pin TINY4412_GPIO_PIN1\n");<br />
}<br />
<br />
if ((devFD = ds18b20Init(pin)) == -1) {<br />
printf("Fail to init ds18b20\n");<br />
return -1;<br />
}<br />
if (ds18b20Read(temperature) > 0) {<br />
printf("Temperature = %s\n", temperature);<br />
} else {<br />
printf("Fail to get temperature\n");<br />
}<br />
free(temperature);<br />
ds18b20DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-temperature_sensor<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Temperature_and_Humidity_Sensor&diff=1153Matrix - Temperature and Humidity Sensor2016-02-10T05:00:07Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:TemperatureAndHumiditySensor01.png|thumb|Temperature and Humidity Sensor]]<br />
* The Matrix-Temperature_and_Humidity_Sensor module is used to detect temperature and humidity.<br />
* It utilizes the DHT11 temperature and humidity sensor. Its humidity range is 20% - 80% and the accuracy is 5%. Its temperature range is 0℃ - 50℃ and the accuracy is ±2℃.<br />
<br />
==Features==<br />
* Humidity range: 20 - 80%RH, Temperature range 0 ~ 50℃<br />
* Accuracy of humidity: +-5%RH, accuracy of temperature: +-2℃<br />
* One wire communication<br />
* 2.54 mm spacing pin<br />
* PCB dimension (mm): 16 x 32<br />
[[File:dht11pcb.png|frameless|400px|温湿度传感器PCB]]<br />
<br />
Pin Description: <br><br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
The DHT11 module uses a simplified single-bus serial communication. DATA controls communication and synchronization between the microprocessor and DHT11. A data transfer takes 4ms. The data format contains an integer part and a decimal part. The basic operation is as follows:<br />
* a transmission of 40 data, the high first-out<br />
* data format: 8bit humidity integer data + 8bit the Humidity decimal data <br> <br />
* 8bit temperature integer data + 8bit fractional temperature data <br> <br />
* 8 bit parity bit <br><br />
* If a transmission is successful the “8bit humidity integer data + 8bit humidity decimal data +8 bit temperature integer data + 8bit temperature fractional data” 8bit checksum is equal to the results of the last eight. <br><br />
* After the user host (MCU) sends a signal DHT11 is converted from low-power mode to high-speed mode, until the host begins to signal the end. Then DHT11 sends a response signal to send 40bit data, and trigger a letter collection. If DHT11 doesn't receive a signal from the host it will not begin a letter collection. After the letter collection is done DHT11 will turn to low power mode.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Temperature_and_Humidity_Sensor to the NanoPi <br><br />
[[File:matrix-temperature_and_humidity_sensor_nanopi.jpg|frameless|600px|matrix-temperature_and_humidity_sensor_nanopi]]<br />
<br><br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Temperature_and_Humidity_Sensor || NanoPi<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Temperature_and_Humidity_Sensor" module is "matrix-temp_humidity".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/usr/bin/* nanopi_rootfs/usr/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-temp_humidity<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int ret = -1;<br />
int dhtTemp = 0;<br />
int dhtHdty = 0;<br />
int devFD = -1;<br />
int pin = GPIO_PIN1;<br />
<br />
if (argc == 2) {<br />
parseCmd(argc, argv, &pin);<br />
} else {<br />
printf("Using default pin GPIO_PIN1\n");<br />
}<br />
if ((devFD = dht11Init(pin)) == -1) {<br />
printf("Fail to init dht11\n");<br />
return -1;<br />
}<br />
<br />
if ((ret = dht11Read(DHT_HUMIDITY, &dhtHdty)) != -1) {<br />
printf("Get humidity : %d\n", dhtHdty);<br />
} else {<br />
printf("Faided to get humidity\n");<br />
}<br />
<br />
if ((ret = dht11Read(DHT_TEMP, &dhtTemp)) != -1) {<br />
printf("Get temperature : %d\n", dhtTemp);<br />
} else {<br />
printf("Faided to get temperature\n");<br />
}<br />
<br />
dht11DeInit(devFD);<br />
return ret;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Temperature_and_Humidity_Sensor to the Tiny4412 <br><br />
[[File:matrix-temperature_and_humidity_sensor_tiny4412.jpg|frameless|600px|matrix-temperature_and_humidity_sensor_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Temperature_and_Humidity_Sensor || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Temperature_and_Humidity_Sensor" module is "matrix-temp_humidity".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/usr/bin/* tiny4412_rootfs/usr/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-temp_humidity<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int ret = -1;<br />
int dhtTemp = 0;<br />
int dhtHdty = 0;<br />
int devFD = -1;<br />
int pin = GPIO_PIN1;<br />
<br />
if (argc == 2) {<br />
parseCmd(argc, argv, &pin);<br />
} else {<br />
printf("Using default pin GPIO_PIN1\n");<br />
}<br />
if ((devFD = dht11Init(pin)) == -1) {<br />
printf("Fail to init dht11\n");<br />
return -1;<br />
}<br />
<br />
if ((ret = dht11Read(DHT_HUMIDITY, &dhtHdty)) != -1) {<br />
printf("Get humidity : %d\n", dhtHdty);<br />
} else {<br />
printf("Faided to get humidity\n");<br />
}<br />
<br />
if ((ret = dht11Read(DHT_TEMP, &dhtTemp)) != -1) {<br />
printf("Get temperature : %d\n", dhtTemp);<br />
} else {<br />
printf("Faided to get temperature\n");<br />
}<br />
<br />
dht11DeInit(devFD);<br />
return ret;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://akizukidenshi.com/download/ds/aosong/DHT11.pdf DHT11.pdf]<br />
<br />
<br />
<!--<br />
==Introduction==<br />
[[File:TemperatureAndHumiditySensor01.png|thumb|Temperature and Humidity Sensor]]<br />
This module utilizes the DHT11 temperature and humidity sensor. The DHT11 sensor's relative humidity range is 20%-80% ±5% and its temperature range is 0℃-50℃ ±2℃. DHT11 uses a single bus communication which needs only one data line. Its DATA line is used for communication and synchronization between the microprocessor and DHT11. Its data format consists of the 8bit humidity integer data and 8bit the Humidity decimal data, and 8 bit temperature integer data and 8bit fractional temperature data and 8 bit parity bit. Its application of a dedicated digital modules collection technology and the temperature and humidity sensing technology, to ensure that the product has high reliability, excellent long-term stability, low cost and long distance (up to 20 meters) signal transmission. We simplified the DHT11's 4-pin to 3-pin.<br />
<br />
==Features==<br />
* Humidity range: 20-80%RH, temperature range: 0~50℃<br />
* Humidity accuracy:±5%RH, temperature accuracy: ±2℃<br />
* Single bus (I/O) communication<br />
* 2.54 mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::GND: Ground<br />
::VCC: 5V<br />
::S: GPIO PIN1, this pin has to be connected to an interrupt pin.<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include "libfahw.h"<br />
<br />
void parseCmd(int argc, char **argv, int *pin)<br />
{<br />
int num = atoi(argv[1]);<br />
switch(num) {<br />
case 1:<br />
*pin = TINY4412_GPIO_PIN1;<br />
break;<br />
case 2:<br />
*pin = TINY4412_GPIO_PIN2;<br />
break;<br />
case 3:<br />
*pin = TINY4412_GPIO_PIN3;<br />
break;<br />
case 4:<br />
*pin = TINY4412_GPIO_PIN4;<br />
break;<br />
case 9:<br />
*pin = TINY4412_GPIO_PIN9;<br />
break;<br />
case 10:<br />
*pin = TINY4412_GPIO_PIN10;<br />
break;<br />
default:<br />
printf("Unsupported pin TINY4412_GPIO_PIN%d\n", num);<br />
num = 1;<br />
*pin = TINY4412_GPIO_PIN1;<br />
}<br />
printf("Using pin TINY4412_GPIO_PIN%d\n", num);<br />
}<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int ret = -1;<br />
int dhtTemp = 0;<br />
int dhtHdty = 0;<br />
int devFD = -1;<br />
int pin = TINY4412_GPIO_PIN1;<br />
<br />
if (argc == 2) {<br />
parseCmd(argc, argv, &pin);<br />
} else {<br />
printf("Using default pin TINY4412_GPIO_PIN1\n");<br />
}<br />
if ((devFD = dht11Init(pin)) == -1) {<br />
printf("Fail to init dht11\n");<br />
return -1;<br />
}<br />
<br />
if ((ret = dht11Read(DHT_HUMIDITY, &dhtHdty)) != -1) {<br />
printf("Get humidity : %d\n", dhtHdty);<br />
} else {<br />
printf("Faided to get humidity\n");<br />
}<br />
<br />
if ((ret = dht11Read(DHT_TEMP, &dhtTemp)) != -1) {<br />
printf("Get temperature : %d\n", dhtTemp);<br />
} else {<br />
printf("Faided to get temperature\n");<br />
}<br />
<br />
dht11DeInit(devFD);<br />
return ret;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-temperature_and_humidity_sensor<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Sound_Sensor&diff=1152Matrix - Sound Sensor2016-02-10T04:59:38Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:SoundSensor01.png|thumb|Sound Sensor]]<br />
* The Matrix-Sound_Sensor module is used to detect sound.<br />
* The module has a variable resistor which can be used to control the threshold value of a sound level. Only when a sound level's value is greater than this threshold the module can detect it. Turning clockwise increases this threshold value. Turning anticlockwise decreases this value.<br />
* By default this module's output level is high. When it detects sound signals its output level will turn low. When sound signals are not detected its output will turn high again without time delay.<br />
<br />
==Features==<br />
* Variable threshold value<br />
* 2.54mm spacing pin interface<br />
* PCB dimension (mm): 16 x 24<br />
[[File:micpcb.png|frameless|400px|声音传感器PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
* The module contains an electret condenser microphone. Sound waves impinging on the diaphragm cause the capacitance between it and the back plate to change synchronously, this in turn induces an AC voltage on the back plate.<br />
* This sound sensor functions like a microphone which receives sound waves and convert them to images which show the sound waves' vibration. When it receives a sound wave it will output 1 but cannot measure its strength. <br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki :[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Sound_Sensor to the NanoPi <br><br />
[[File:matrix-sound_sensor_nanopi.jpg|frameless|600px|matrix-sound_sensor_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Sound_Sensor || NanoPi<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Sound_Sensor" module is "matrix-sound_sensor".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-sound_sensor<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
static struct sensor sound[] = {<br />
{<br />
GPIO_PIN1,<br />
IRQ_TYPE_EDGE_BOTH,<br />
}<br />
};<br />
<br />
int main(void)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(sound)];<br />
int devFD = -1;<br />
if ((devFD =sensorInit(sound, ARRAY_SIZE(sound))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
<br />
if (( retSize = sensorRead(devFD, value, ARRAY_SIZE(sound)) ) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for(i=0; i<retSize; i++)<br />
{<br />
printf("sound[%d]:%d\n", i, value[i]);<br />
}<br />
printf("\n");<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Sound_Sensor to the Tiny4412 <br><br />
[[File:matrix-sound_sensor_tiny4412.jpg|frameless|600px|matrix-sound_sensor_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Sound_Sensor || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore. <br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Sound_Sensor" module is "matrix-sound_sensor".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-sound_sensor<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
static struct sensor sound[] = {<br />
{<br />
GPIO_PIN1,<br />
IRQ_TYPE_EDGE_BOTH,<br />
}<br />
};<br />
<br />
int main(void)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(sound)];<br />
int devFD = -1;<br />
if ((devFD =sensorInit(sound, ARRAY_SIZE(sound))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
<br />
if (( retSize = sensorRead(devFD, value, ARRAY_SIZE(sound)) ) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for(i=0; i<retSize; i++)<br />
{<br />
printf("sound[%d]:%d\n", i, value[i]);<br />
}<br />
printf("\n");<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
<br />
<br />
<br />
<!--<br />
<br />
==Introduction==<br />
[[File:SoundSensor01.png|thumb|Sound Sensor]]<br />
By default this module's output level is high. When it detects sound signals its output level will turn low. When sound signals are not detected its output will turn high again without time delay. There is a variable resistor which you can use to control the threshold value of a sound volume. Only when a sound volume's value is greater than this threshold value the module can detect it. Turning clockwise increases this threshold value. Turning anticlockwise decreases this value.<br />
<br />
==Features==<br />
* Variable threshold value<br />
* 2.54mm spacing pin interface<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::G: Ground<br />
::V: 5V<br />
::S: GPIO PIN1<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include "libfahw.h"<br />
<br />
static struct sensor sound[] = {<br />
{<br />
TINY4412_GPIO_PIN1,<br />
IRQ_TYPE_EDGE_BOTH,<br />
}<br />
};<br />
<br />
int main(void)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(sound)];<br />
int devFD = -1;<br />
if ((devFD =sensorInit(sound, ARRAY_SIZE(sound))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
<br />
if (( retSize = sensorRead(devFD, value, ARRAY_SIZE(sound)) ) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for(i=0; i<retSize; i++)<br />
{<br />
printf("sound[%d]:%d\n", i, value[i]);<br />
}<br />
printf("\n");<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-sound_sensor<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_RTC&diff=1151Matrix - RTC2016-02-10T04:59:11Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Matrix-RTC.png|thumb|]]<br />
*<br />
<br />
==Features==<br />
*<br />
[[File:Matrix-RTC_PCB.png|frameless|400px|]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|SDA || I2C SDA<br />
|-<br />
|SCL || I2C SCL<br />
|- <br />
|5V || Supply Voltage 5V<br />
|-<br />
|GND || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* the tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* the raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-RTC to the NanoPi <br><br />
[[File:Matrix-RTC_nanopi.jpg|frameless|600px|Matrix-RTC_nanopi]]<br />
<br />
连接说明:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-RTC_nanopi || NanoPi<br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-RTC" module is "matrix-rtc". <br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal to load the driver<br />
<syntaxhighlight lang="bash"><br />
$ modprobe rtc-ds1307<br />
</syntaxhighlight><br />
<br />
Run the test program <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-rtc<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
static const char default_rtc[] = "/dev/rtc0";<br />
static const char default_date_time[] = "2015 9 15 1 1 1";<br />
int main(int argc, char **argv)<br />
{<br />
int fd, retval;<br />
struct rtc_time rtc_tm;<br />
const char *rtc = default_rtc;<br />
const char *date_time = default_date_time;<br />
<br />
switch (argc) {<br />
case 3:<br />
rtc = argv[1];<br />
date_time = argv[2];<br />
break;<br />
case 1:<br />
break;<br />
default:<br />
fprintf(stderr, "usage: rtctest [rtcdev] [year mon day hour min sec]\n");<br />
return 1;<br />
}<br />
<br />
fd = open(rtc, O_RDONLY);<br />
<br />
if (fd == -1) {<br />
perror(rtc);<br />
exit(errno);<br />
}<br />
fprintf(stderr, "RTC Driver Test Example.\n");<br />
<br />
sscanf(date_time, "%d %d %d %d %d %d",<br />
&rtc_tm.tm_year,<br />
&rtc_tm.tm_mon,<br />
&rtc_tm.tm_mday,<br />
&rtc_tm.tm_hour,<br />
&rtc_tm.tm_min,<br />
&rtc_tm.tm_sec); <br />
rtc_tm.tm_year -= 1900;<br />
rtc_tm.tm_mon -= 1;<br />
retval = ioctl(fd, RTC_SET_TIME, &rtc_tm);<br />
if (retval == -1) {<br />
perror("RTC_SET_TIME ioctl");<br />
exit(errno);<br />
}<br />
<br />
fprintf(stderr, "Set RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",<br />
rtc_tm.tm_mon + 1, rtc_tm.tm_mday, rtc_tm.tm_year + 1900,<br />
rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);<br />
<br />
/* Read the RTC time/date */<br />
retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);<br />
if (retval == -1) {<br />
perror("RTC_RD_TIME ioctl");<br />
exit(errno);<br />
}<br />
<br />
fprintf(stderr, "Read RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",<br />
rtc_tm.tm_mon + 1, rtc_tm.tm_mday, rtc_tm.tm_year + 1900,<br />
rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);<br />
<br />
fprintf(stderr, "Test complete\n");<br />
close(fd);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-RTC to the Tiny4412 <br><br />
[[File:Matrix-RTC_tiny4412.jpg|frameless|600px|Matrix-RTC_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-RTC || Tiny4412<br />
|-<br />
|SDA || CON18 SDA<br />
|-<br />
|SCL || CON18 SCL<br />
|- <br />
|5V || CON18 5V<br />
|-<br />
|GND || CON18 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-RTC" module is "matrix-rtc".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal to load the driver.<br />
<syntaxhighlight lang="bash"><br />
$ modprobe bmp085-i2c<br />
</syntaxhighlight><br />
<br />
Run the test program <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-rtc<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
static const char default_rtc[] = "/dev/rtc0";<br />
static const char default_date_time[] = "2015 9 15 1 1 1";<br />
int main(int argc, char **argv)<br />
{<br />
int fd, retval;<br />
struct rtc_time rtc_tm;<br />
const char *rtc = default_rtc;<br />
const char *date_time = default_date_time;<br />
<br />
switch (argc) {<br />
case 3:<br />
rtc = argv[1];<br />
date_time = argv[2];<br />
break;<br />
case 1:<br />
break;<br />
default:<br />
fprintf(stderr, "usage: rtctest [rtcdev] [year mon day hour min sec]\n");<br />
return 1;<br />
}<br />
<br />
fd = open(rtc, O_RDONLY);<br />
<br />
if (fd == -1) {<br />
perror(rtc);<br />
exit(errno);<br />
}<br />
fprintf(stderr, "RTC Driver Test Example.\n");<br />
<br />
sscanf(date_time, "%d %d %d %d %d %d",<br />
&rtc_tm.tm_year,<br />
&rtc_tm.tm_mon,<br />
&rtc_tm.tm_mday,<br />
&rtc_tm.tm_hour,<br />
&rtc_tm.tm_min,<br />
&rtc_tm.tm_sec); <br />
rtc_tm.tm_year -= 1900;<br />
rtc_tm.tm_mon -= 1;<br />
retval = ioctl(fd, RTC_SET_TIME, &rtc_tm);<br />
if (retval == -1) {<br />
perror("RTC_SET_TIME ioctl");<br />
exit(errno);<br />
}<br />
<br />
fprintf(stderr, "Set RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",<br />
rtc_tm.tm_mon + 1, rtc_tm.tm_mday, rtc_tm.tm_year + 1900,<br />
rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);<br />
<br />
/* Read the RTC time/date */<br />
retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);<br />
if (retval == -1) {<br />
perror("RTC_RD_TIME ioctl");<br />
exit(errno);<br />
}<br />
<br />
fprintf(stderr, "Read RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",<br />
rtc_tm.tm_mon + 1, rtc_tm.tm_mday, rtc_tm.tm_year + 1900,<br />
rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);<br />
<br />
fprintf(stderr, "Test complete\n");<br />
close(fd);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://datasheets.maximintegrated.com/en/ds/DS1307.pdf DS1307.pdf]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Relay&diff=1150Matrix - Relay2016-02-10T04:56:58Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:relay01.png|thumb|Relay]]<br />
* The Matrix-Relay module is a SPDT relay which is an electrically operated switch. Relays are used where it is necessary to control a circuit by a low-power signal. In a electric system it is used to protect electrical circuits from overload or faults.<br />
<br />
==Features==<br />
* 1 Form C<br />
* 5V supply voltage, GPIO signal: 3.3/5V<br />
* Current on-contact up to 10A<br />
* LED indicator<br />
* 2.54 mm spacing pin<br />
* PCB dimension (mm): 24 x 48<br />
[[File:relaypcb.png|frameless|400px|继电器PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
This is an SPDT relay. Its supply voltage is 5V and current on-contact is up to 10A. It can drive AC or DC high power loads. NO is Normally Open. NC is Normally Closed. COM is Common. When writing high to pin S NO will be open and NC will be closed.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Relay to the NanoPi <br><br />
[[File:matrix-relay_nanopi.jpg|frameless|600px|matrix-relay_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-LED || NanoPi<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Relay" module is "matrix-relay".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-relay<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <string.h><br />
#include "libfahw.h"<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
char *status = "off";<br />
if (argc != 2) {<br />
printf("Set relay on\n");<br />
} else {<br />
status = argv[1];<br />
printf("Set relay %s\n", argv[1]);<br />
}<br />
<br />
int pin = GPIO_PIN1;<br />
int ret = -1;<br />
if ((ret = exportGPIOPin(pin)) != 0) { <br />
printf("exportGPIOPin(%d) failed!", pin);<br />
}<br />
if ((ret = setGPIODirection(pin, GPIO_OUT)) != 0) {<br />
printf("setGPIODirection(%d) failed", pin);<br />
}<br />
<br />
if (strcmp(status, "on") == 0) {<br />
ret = setGPIOValue(pin, GPIO_HIGH);<br />
} else if (strcmp(status, "off") == 0) {<br />
ret = setGPIOValue(pin, GPIO_LOW);<br />
}<br />
return ret;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Relay to the Tiny4412 <br><br />
[[File:matrix-relay_tiny4412.jpg|frameless|600px|matrix-relay_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-LED || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Relay" module is "matrix-relay".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-relay<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <string.h><br />
#include "libfahw.h"<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
char *status = "off";<br />
if (argc != 2) {<br />
printf("Set relay on\n");<br />
} else {<br />
status = argv[1];<br />
printf("Set relay %s\n", argv[1]);<br />
}<br />
<br />
int pin = GPIO_PIN1;<br />
int ret = -1;<br />
if ((ret = exportGPIOPin(pin)) != 0) { <br />
printf("exportGPIOPin(%d) failed!", pin);<br />
}<br />
if ((ret = setGPIODirection(pin, GPIO_OUT)) != 0) {<br />
printf("setGPIODirection(%d) failed", pin);<br />
}<br />
<br />
if (strcmp(status, "on") == 0) {<br />
ret = setGPIOValue(pin, GPIO_HIGH);<br />
} else if (strcmp(status, "off") == 0) {<br />
ret = setGPIOValue(pin, GPIO_LOW);<br />
}<br />
return ret;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://www.micro4you.com/files/sensor/DHT11.pdf DHT11.pdf]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Potentiometer&diff=1149Matrix - Potentiometer2016-02-10T04:55:56Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Potentiometer .png|thumb|Potentiometer]]<br />
*The Matrix-Potentiometer module is a Potentiometer module. It can be used in audio control, motion control, transducers, computation and etc.<br />
*3 Pin 2.54mm spacing pin header, V is supply voltage, G is ground and S is output analog signal. Users can convert output analog signals to digital signals via ADC conversion.<br />
*Output Voltage: 0 ~ Vcc<br />
<br />
==Features==<br />
* GPIO<br />
* Small<br />
* 2.54mm spacing pin header<br />
* PCB Dimension(mm): 8 x 24<br />
[[File:Potentiometer.png | frameless|400px|Potentiometer_PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || Analog GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
*A potentiometer is a three-terminal resistor with a sliding or rotating contact that forms an adjustable voltage divider.If only two terminals are used, one end and the wiper, it acts as a variable resistor or rheostat.<br />
*This module mainly contains a potentiometer where the resistance changes with changes between the contact and one end terminal.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub :https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi;<br />
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2;<br />
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;<br />
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br><br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br><br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Potentiometer to the NanoPi 2:<br><br />
[[File:Matrix-Potentiometer.jpg|frameless|600px|Matrix-Potentiometer]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Analog_to_Digital_Converter || NanoPi 2 <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Potentiometer || <br />
|-<br />
|GND || NanoPi 2 Pin9<br />
|-<br />
|5V || NanoPi 2 Pin2<br />
|-<br />
|S || Matrix-Analog_to_Digital_Converter A0<br />
|}<br />
This module's output signals are analog signals. You can use our Matrix-Analog_to_Digital_Converter to convert them to digital signals.<br><br />
Please connect the Matrix-Analog_to_Digital_Converter to the NanoPi 2 and then connect Pin S of the Matrix-Photoresistor's pin header to Matrix-Analog_to_Digital_Converter's A0.<br><br />
For more details about the Matrix-Analog_to_Digital_Converter module please refer to wiki: [[Matrix_-_Analog_to_Digital_Converter]].<br><br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. Its test program is "matrix-adc".<br><br />
The modules are under the "modules" directory. Its driver's source code is in https://github.com/friendlyarm/linux-3.4.y.git <br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the driver, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod pcf8591.ko<br />
</syntaxhighlight><br />
<br />
Please run the following command to test the Matrix-Potentiometer module.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-adc<br />
</syntaxhighlight><br />
Here is what you should expect:<br><br />
[[File:matrix-adc_result.png|frameless||matrix-adc_result]] <br><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int i = 0;<br />
int value = 0;<br />
int channel = 0;<br />
<br />
if (argc == 2) {<br />
channel = atoi(argv[1]);<br />
}<br />
<br />
for (i=0; i<ADC_READ_TIMES; i++) {<br />
if (pcf8591Read(channel, &value) != -1) {<br />
printf("channel%d value=%d\n", channel, value);<br />
} else {<br />
printf("Fail to get channel%d value\n", channel); <br />
}<br />
usleep(10000);<br />
}<br />
return 0;<br />
}<br />
</syntaxhighlight></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Photoresistor&diff=1148Matrix - Photoresistor2016-02-10T04:55:29Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Photoresistor.png|thumb|Photoresistor]]<br />
*The Matrix-Photoresistor is a photoresistor module. It has a 3 pin 2.54mm spacing pin-header of which V is supply voltage, G is ground and s is output analog signal. The output signal decreases with increasing incident light intensity. Users can convert its output analog signal to a digital signal via ADC conversion.<br />
*Output Voltage: 0 ~ Vcc<br />
<br />
==Features==<br />
* GPIO 3.3/5V <br />
* Small<br />
* 2.54mm spacing pin-header<br />
* PCB Dimension(mm): 8 x 24<br />
[[File:xxx.png | frameless|400px|Photoresistor.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || Analog GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
*The module has a photoresistor. The resistance of a photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity.If incident light on a photoresistor exceeds a certain frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electrons (and their hole partners) conduct electricity, thereby lowering resistance.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub: https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* the tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* the raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Photoresistor to the NanoPi 2:<br><br />
[[File:Matrix-Photoresistor_nanopi_2.jpg|frameless|600px|Matrix-Photoresistor_nanopi_2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Analog_to_Digital_Converter || NanoPi 2 <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Photoresistor || <br />
|-<br />
|GND || NanoPi 2 Pin9<br />
|-<br />
|5V || NanoPi 2 Pin2<br />
|-<br />
|S || Matrix-Analog_to_Digital_Converter A0<br />
|}<br />
This module's output signals are analog signals. You can use our Matrix-Analog_to_Digital_Converter to convert them to digital signals.<br><br />
Please connect the Matrix-Analog_to_Digital_Converter to the NanoPi 2 and then connect Pin S of the Matrix-Photoresistor's pin header to Matrix-Analog_to_Digital_Converter's A0.<br><br />
For more details about the Matrix-Analog_to_Digital_Converter module please refer to wiki:[[Matrix_-_Analog_to_Digital_Converter]].<br><br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. Its test program is "matrix-adc"<br><br />
The modules are under the "modules" directory. Its driver's source code is in https://github.com/friendlyarm/linux-3.4.y.git <br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the driver, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod pcf8591.ko<br />
</syntaxhighlight><br />
<br />
Please run the following command to test the Matrix-Photoresistor module.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-adc<br />
</syntaxhighlight><br />
Here is what you should expect:<br><br />
[[File:matrix-adc_result.png|frameless||matrix-adc_result]] <br><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int i = 0;<br />
int value = 0;<br />
int channel = 0;<br />
<br />
if (argc == 2) {<br />
channel = atoi(argv[1]);<br />
}<br />
<br />
for (i=0; i<ADC_READ_TIMES; i++) {<br />
if (pcf8591Read(channel, &value) != -1) {<br />
printf("channel%d value=%d\n", channel, value);<br />
} else {<br />
printf("Fail to get channel%d value\n", channel); <br />
}<br />
usleep(10000);<br />
}<br />
return 0;<br />
}<br />
</syntaxhighlight></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_LED&diff=1147Matrix - LED2016-02-10T04:53:46Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:led01.png|thumb|LED]]<br />
[[File:led02.png|thumb|LED]]<br />
[[File:led03.png|thumb|LED]]<br />
The Matrix-LED is an LED module with three 2.54 mm spacing pins: V(supply voltage),G(ground) and S(signal) which is connected to a triode to turn the LED on or off. You can write high or low, or PWN signals(3.3V or 5V) to S. When you write high to S the LED will turn on and become brightest. When you write low to S the LED will turn off. If you write PWM signals to S the LED's brightness will vary depending on the PWM's signal variances. <br />
<br />
==Features==<br />
* GPIO/PWM interface, 3.3/5V, PWM brightness control<br />
* Small, easy to be used in various situations<br />
* 2.54 mm spacing pin<br />
* PCB Dimension(mm): 8 x 24<br />
[[File:led02pcb.png | frameless|400px|LED-01.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
The module has three 2.54 mm spacing pins: V(supply voltage),G(ground) and S(signal) which is connected to a triode to turn the LED on or off. You can write high or low, or PWN signals(3.3V or 5V) to S. When you write high to S the LED will turn on and become brightest. When you write low to S the LED will turn off. If you write PWM signals to S the LED's brightness will vary depending on the PWM's signal variances. <br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch. <br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-LED to the NanoPi <br><br />
[[File:matrix-led_nanopi.jpg|frameless|600px|matrix-led_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-LED || NanoPi<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-LED" module is "matrix-led".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-led<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv) <br />
{<br />
int ledPin = GPIO_PIN1; <br />
int i = 0;<br />
int ret = -1;<br />
<br />
if ((ret = exportGPIOPin(ledPin)) == -1) { <br />
printf("exportGPIOPin(%d) failed\n", ledPin);<br />
}<br />
if ((ret = setGPIODirection(ledPin, GPIO_OUT)) == -1) {<br />
printf("setGPIODirection(%d) failed\n", ledPin);<br />
}<br />
<br />
for (i = 0; i < LED_BLINK_TIMES; i++) {<br />
if (i % 2) {<br />
ret = setGPIOValue(ledPin, GPIO_HIGH);<br />
} else {<br />
ret = setGPIOValue(ledPin, GPIO_LOW);<br />
}<br />
if (ret == -1) {<br />
printf("setGPIOValue(%d) failed\n", ledPin);<br />
}<br />
printf("LED blinking times %d\n", i);<br />
sleep(1);<br />
}<br />
unexportGPIOPin(ledPin);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-LED to the Tiny4412 <br><br />
[[File:matrix-led_tiny4412.jpg|frameless|600px|matrix-led_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-LED || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore. <br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-LED" module is "matrix-led".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-led<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv) <br />
{<br />
int ledPin = GPIO_PIN1; <br />
int i = 0;<br />
int ret = -1;<br />
<br />
if ((ret = exportGPIOPin(ledPin)) == -1) { <br />
printf("exportGPIOPin(%d) failed\n", ledPin);<br />
}<br />
if ((ret = setGPIODirection(ledPin, GPIO_OUT)) == -1) {<br />
printf("setGPIODirection(%d) failed\n", ledPin);<br />
}<br />
<br />
for (i = 0; i < LED_BLINK_TIMES; i++) {<br />
if (i % 2) {<br />
ret = setGPIOValue(ledPin, GPIO_HIGH);<br />
} else {<br />
ret = setGPIOValue(ledPin, GPIO_LOW);<br />
}<br />
if (ret == -1) {<br />
printf("setGPIOValue(%d) failed\n", ledPin);<br />
}<br />
printf("LED blinking times %d\n", i);<br />
sleep(1);<br />
}<br />
unexportGPIOPin(ledPin);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
<br />
<br />
<!--<br />
<br />
==Introduction==<br />
[[File:led01.png|thumb|LED]]<br />
[[File:led02.png|thumb|LED]]<br />
[[File:led03.png|thumb|LED]]<br />
On this module we put a 5mm LED and extend all pins to a 3-Pin 2.54mm spacing pin header. Pin V is power, G is grounded and S is data which is connected to a triode to turn the LED on or off. You can write high or low, or PWN signals(3.3V or 5V) to S. When you write high to S the LED will turn on and become brightest. When you write low to S the LED will turn off. If you write PWM signals to S the LED's brightness will vary depending on the PWM's signal variances. We provide red, green and white LED modules.<br />
<br />
==Features==<br />
* GPIO/PWM interface, 3.3/5V, PWM brightness control<br />
* Tiny, easy to be used in various situations<br />
* 2.54mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::Connect the module's pin S to GPIO PIN1, V to 5V and G grounded<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <unistd.h><br />
#include "libfahw.h"<br />
<br />
#define LED_BLINK_TIMES 10<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int ledPin = TINY4412_GPIO_PIN1;<br />
int i = 0;<br />
int ret = -1;<br />
<br />
if ((ret = exportGPIOPin(ledPin)) == -1) {<br />
printf("exportGPIOPin(%d) failed\n", ledPin);<br />
}<br />
if ((ret = setGPIODirection(ledPin, GPIO_OUT)) == -1) {<br />
printf("setGPIODirection(%d) failed\n", ledPin);<br />
}<br />
<br />
for (i = 0; i < LED_BLINK_TIMES; i++) {<br />
if (i % 2) {<br />
ret = setGPIOValue(ledPin, GPIO_HIGH);<br />
} else {<br />
ret = setGPIOValue(ledPin, GPIO_LOW);<br />
}<br />
if (ret == -1) {<br />
printf("setGPIOValue(%d) failed\n", ledPin);<br />
}<br />
printf("LED blinking times %d\n", i);<br />
sleep(1);<br />
}<br />
unexportGPIOPin(ledPin);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-led<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Joystick&diff=1146Matrix - Joystick2016-02-10T04:53:20Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Joystick01.png|thumb|Joystick]]<br />
* The matrix-joystick module is a two-axis stick module. It consists of two Sliding rheostats and one button. It has two analog outputs and one digital output. Its positional states can be measured as X and Y axis values as the calibrated resistance of the two potentiometers. <br />
* When you move the joystick the sliding rheostats' resistance will change and the corresponding x/y values will change too. When you push the joystick the SW level will turn low.<br />
<br />
==Features==<br />
* X and Y axis, and one button<br />
* 2.54mm spacing pin<br />
* PCB dimension(mm): 24 X 32<br />
[[File:stkpcb.png|frameless|400px|双轴摇杆PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|GND || Ground<br />
|-<br />
|5V || Supply Voltage 5V<br />
|-<br />
|SW || Button<br />
|- <br />
|X || X Axis<br />
|-<br />
|Y || Y Axis<br />
|}<br />
<br />
==Basic Device Operation==<br />
* It has two analog outputs and one digital output. The two analog outputs are measured as X and Y values as the calibrated resistance of the two potentiometers. The digital output is measured as Z value indicating whether or not the button is pressed. <br><br />
* We extend all three outputs: X, Y and Z and users can use them easily.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki: [[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Joystick and Matrix-Analog_to_Digital_Converter to the NanoPi <br><br />
[[File:matrix-joystick_nanopi.jpg|frameless|600px|matrix-joystick_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Joystick || <br />
|-<br />
|GND || NanoPi Pin14<br />
|-<br />
|5V || NanoPi Pin2<br />
|- <br />
|SW || Matrix-Analog_to_Digital_Converter A2<br />
|-<br />
|X || Matrix-Analog_to_Digital_Converter A1<br />
|-<br />
|Y || Matrix-Analog_to_Digital_Converter A0<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Joystick" module is "matrix-joystick".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-joystick<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int mode = 0x0;<br />
<br />
if ((devFD = pcf8591Init()) == -1) {<br />
printf("Fail to init pcf8591 AD\n");<br />
return -1;<br />
}<br />
if (pcf8591SetCtrl(devFD, PCF8591_INIT_AD_CONTROL) == -1) {<br />
printf("Fail to Set pcf8591 control AD\n");<br />
pcf8591DeInit(devFD);<br />
return -1;<br />
}<br />
<br />
int i = 0;<br />
int x, y, z;<br />
signal(SIGINT, PS2Handler);<br />
for (i=0; i<PS2_READ_TIMES; i++) {<br />
x = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL0);<br />
y = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL1);<br />
z = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL2);<br />
if (z > SW_TRIGGER) {<br />
z = 0;<br />
} else {<br />
z = 1;<br />
}<br />
printf("X=%3d Y=%3d Z=%d\n", x, y, z);<br />
sleep(1);<br />
}<br />
pcf8591DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Joystick and Matrix-Analog_to_Digital_Converter to the Tiny4412 <br><br />
[[File:matrix-joystick_tiny4412.jpg|frameless|600px|matrix-joystick_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Joystick || <br />
|-<br />
|GND || Tiny4412 CON16 GND<br />
|-<br />
|5V || Tiny4412 CON16 5V<br />
|- <br />
|SW || Matrix-Analog_to_Digital_Converter A2<br />
|-<br />
|X || Matrix-Analog_to_Digital_Converter A1<br />
|-<br />
|Y || Matrix-Analog_to_Digital_Converter A0<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Joystick" module is "matrix-joystick".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal<br />
<syntaxhighlight lang="bash"><br />
$ matrix-joystick<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int mode = 0x0;<br />
<br />
if ((devFD = pcf8591Init()) == -1) {<br />
printf("Fail to init pcf8591 AD\n");<br />
return -1;<br />
}<br />
if (pcf8591SetCtrl(devFD, PCF8591_INIT_AD_CONTROL) == -1) {<br />
printf("Fail to Set pcf8591 control AD\n");<br />
pcf8591DeInit(devFD);<br />
return -1;<br />
}<br />
<br />
int i = 0;<br />
int x, y, z;<br />
signal(SIGINT, PS2Handler);<br />
for (i=0; i<PS2_READ_TIMES; i++) {<br />
x = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL0);<br />
y = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL1);<br />
z = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL2);<br />
if (z > SW_TRIGGER) {<br />
z = 0;<br />
} else {<br />
z = 1;<br />
}<br />
printf("X=%3d Y=%3d Z=%d\n", x, y, z);<br />
sleep(1);<br />
}<br />
pcf8591DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
<br />
<br />
<!--<br />
==Introduction==<br />
[[File:Joystick01.png|thumb|Joystick]]<br />
This module consists of two Sliding rheostats and one button. When you move the joystick the sliding rheostats' resistance will change and the corresponding x/y values will change too. When you push the joystick the SW level will turn low.<br />
<br />
==Features==<br />
* two sliding rheostat and one button<br />
* 2.54mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::1) Please connect the Tiny4412 SDK to [[Matrix - Analog to Digital Converter]]<br />
::2) Please connect the Joystick to [[Matrix - Analog to Digital Converter]]:<br />
::::GND to ground<br />
::::V to 5V<br />
::::VRX to Analog to Digital Converter's AIN0<br />
::::VRY to Analog to Digital Converter's AIN1<br />
::::SW to Analog to Digital Converter's AIN2<br />
<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <unistd.h><br />
#include <signal.h><br />
#include <stdlib.h><br />
#include "libfahw.h"<br />
<br />
#define SW_TRIGGER (5)<br />
#define PS2_READ_TIMES (10)<br />
<br />
static int devFD;<br />
void PS2Handler(int signNum)<br />
{<br />
if (signNum == SIGINT) {<br />
printf("Quit reading PS2 rocker\n");<br />
pcf8591DeInit(devFD);<br />
}<br />
exit(0);<br />
}<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int mode = 0x0;<br />
<br />
if ((devFD = pcf8591Init()) == -1) {<br />
printf("Fail to init pcf8591 AD\n");<br />
return -1;<br />
}<br />
if (pcf8591SetCtrl(devFD, PCF8591_INIT_AD_CONTROL) == -1) {<br />
printf("Fail to Set pcf8591 control AD\n");<br />
pcf8591DeInit(devFD);<br />
return -1;<br />
}<br />
<br />
int i = 0;<br />
int x, y, z;<br />
signal(SIGINT, PS2Handler);<br />
for (i=0; i<PS2_READ_TIMES; i++) {<br />
x = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL0);<br />
y = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL1);<br />
z = pcf8591Read(devFD, mode, PCF8591_AIN_CHANNEL2);<br />
if (z > SW_TRIGGER) {<br />
z = 0;<br />
} else {<br />
z = 0;<br />
} else {<br />
z = 1;<br />
}<br />
printf("X=%3d Y=%3d Z=%d\n", x, y, z);<br />
sleep(1);<br />
}<br />
pcf8591DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-joystick<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_IR_Receiver&diff=1145Matrix - IR Receiver2016-02-10T04:52:48Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:IR Receiver01.png|thumb|IR Receiver]]<br />
* The Matrix-IR receiver is a 38KHz infrared receiver that receives 38KHz signals from an infrared remote control, amplifies and filers them to other devices. Its signal decoding is implemented by programming MCU. <br />
* Transmission distance: 12 ~ 13 meters.<br />
<br />
==Features==<br />
* GPIO control, 3.3/5V <br />
* Small<br />
* 2.54mm spacing pin header<br />
* PCB Dimension(mm): 8 x 24<br />
[[File:IR Receiver.png | frameless|400px|IR Receiver.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
*The IR receiver contains a photo diode, amplifier, band pass filter, integrator, hysteresis comparator and etc. When the IR receiver detects infrared signals it sends them to the preamplifier and band pass filter. After the signals are processed by the band pass filter (30KHz ~ 60KHz) they will be further processed by the integrator and comparator and finally be output as High or Low.<br />
*Note: the output signal is the reversal of the input signal.<br />
<br />
==Download Matrix Source Code==<br />
<br />
All the matrix modules' code samples are open source. They are maintained on GitHub: https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;<br />
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi;<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-IR_Receiver to the NanoPi 2:<br><br />
[[File:Matrix-IR_Receiver_nanopi_2.jpg|frameless|600px|Matrix-IR_Receiver_nanopi_2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-IR_Receiver || NanoPi 2<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory.<br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the module, library and test program to the card<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod matrix_ir_recv.ko<br />
</syntaxhighlight><br />
If the driver is successfully loaded a device node will be generated under /dev/input/. In our test case the node was event1.<br><br />
<br />
There is an open source utility "input-utils" which can be used to read the event device's data. Here is how it works:<br><br />
<syntaxhighlight lang="bash"><br />
$ apt-get install input-utils<br />
$ input-events 1<br />
</syntaxhighlight><br />
1 stands for device node "event1"<br><br />
<br />
You can use a regular remote control to send signals to it. Here is what you expect to observe:<br><br />
[[File:matrix-ir_receiver_result.png|frameless|600px|matrix-ir_receiver_result]]<br />
<br />
==Connect to NanoPi==<br />
<br />
==Connect to Tiny4412==<br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_I2C_LCD1602&diff=1144Matrix - I2C LCD16022016-02-10T04:51:34Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:LCD160201.png|thumb|I2C LCD1602]]<br />
[[File:LCD160202.png|thumb|I2C LCD1602]]<br />
* The Matrix-I2C_LCD1602 is an LCD display module composed of an LCD1602 and a PCF8574 module.<br><br />
* The LCD1602 can display up to 16x2 characters. It has a parallel interface.<br><br />
* The PCF8574 provides GPIO expansion up to 8 bit for I2C. It communicates with a master via I2C and converts data from the master to parallel signals to the LCD1602 thus controls the LCD's display and back light.<br />
<br />
==Features==<br />
* I2C interface, LCD display and backlight control<br />
* 2.54mm spacing pin<br />
* IIC Module PCB dimension(mm): 16 x 42 <br />
* LCD1602 PCB dimension (mm): 36 x 80<br />
[[File:lpdpcb.png|frameless|400px|IIC模块PCB]]<br />
[[File:lcdpcb.png|frameless|400px|LCD1602 PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|SDA || I2C SDA<br />
|-<br />
|SCL || I2C SCL<br />
|- <br />
|5V || Supply Voltage 5V<br />
|-<br />
|GND || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
===PCF8574===<br />
* The PCF8574 has I2C parallel expansion. It has an 8bit (P0 - P7) I2C interface.<br />
* The PCF8574 communicates with a master via I2C. The PCF8574's chip model is PCF8574T whose address specification is as follows:<br />
[[File:pcf8574.png|frameless|400px|PCF8574]]<br />
* If A2 - A0 are all set to 1 the 7bit address will be 0x27(0100111). By default RW is 0 and it is in the write mode.<br />
* In the write mode after opening the i2c-0 device and setting up its address the master can write data to it.<br />
* If you need to read data from it you will need to set the module to the read mode (RW set to 1). Please refer to the PCF8574's datasheet for more details.<br />
<br />
===LCD1602===<br />
* The connection diagram between the PCF8574 module and the LCD module is as follows:<br />
[[File:1602.png|frameless|400px|1602]]<br />
* RS is instruction/data register selection. RW is read/write selection. E is enable signal(edge triggering). BL is back light control. D4-D7 are data bits.<br />
* The LCD module is controlled by four data bits through which we can send instructions to control its state. Because it has eight instruction/data bits (DB7 - DB0) when writing each instruction/data we need to write the most significant four bits DB7 - DB4 first and then the least significant four bits DB3 - DB0.<br />
* Note: the LCD module has 192 most commonly used characters stored in CGROM. When we write a common character e.g "A" it will directly display "A". In addition it can store up to eight user defined characters in RAM called CGRAM.<br />
<br />
==Download Matrix Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
<br />
Please refer to the following connection diagram to connect the Matrix-I2C_LCD1602 to the NanoPi <br><br />
[[File:matrix-i2c_lcd1602_nanopi.jpg|frameless|600px|matrix-i2c_lcd1602_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-I2C_LCD1602 || NanoPi <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-I2C_LCD1602" module is "matrix-lcd1602".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-lcd1602<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
if ((devFD = LCD1602Init()) == -1) {<br />
printf("Fail to init LCD1602\n");<br />
return -1;<br />
}<br />
<br />
if (LCD1602Clear(devFD) == -1) {<br />
printf("Fail to Clear\n");<br />
return -1;<br />
}<br />
printf("clearing LCD1602\n");<br />
sleep(1);<br />
<br />
if (LCD1602DispLines(devFD, " B&G Char LCD", "--by FriendlyARM") == -1) {<br />
printf("Fail to Display String\n");<br />
return -1;<br />
}<br />
printf("displaying LCD1602\n");<br />
LCD1602DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-I2C_LCD1602 to the Tiny4412 <br><br />
[[File:matrix-i2c_lcd1602_tiny4412.jpg|frameless|600px|matrix-i2c_lcd1602_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-I2C_LCD1602 || Tiny4412 <br />
|-<br />
|SDA || CON18 SDA<br />
|-<br />
|SCL || CON18 SCL<br />
|- <br />
|5V || CON18 5V<br />
|-<br />
|GND || CON18 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-I2C_LCD1602" module is "matrix-lcd1602".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-lcd1602<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
if ((devFD = LCD1602Init()) == -1) {<br />
printf("Fail to init LCD1602\n");<br />
return -1;<br />
}<br />
<br />
if (LCD1602Clear(devFD) == -1) {<br />
printf("Fail to Clear\n");<br />
return -1;<br />
}<br />
printf("clearing LCD1602\n");<br />
sleep(1);<br />
<br />
if (LCD1602DispLines(devFD, " B&G Char LCD", "--by FriendlyARM") == -1) {<br />
printf("Fail to Display String\n");<br />
return -1;<br />
}<br />
printf("displaying LCD1602\n");<br />
LCD1602DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
===Preparations===<br />
Make sure your Arduino board can work. Here is a reference link - https://www.arduino.cc/en/Guide/HomePage <br><br />
Here we tried the Arduino Uno<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-I2C_LCD1602 to the Arduino Uno <br><br />
[[File:matrix-i2c_lcd1602_arduino.jpg|frameless|600px|matrix-i2c_lcd1602_arduino]]<br />
<br />
===Compile & Run Test Program===<br />
All the matrix modules' code samples for Arduino are maintained on GitHub - https://github.com/friendlyarm/matrix-arduino.git <br><br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix-arduino.git<br />
</syntaxhighlight><br />
If this is successful a "matrix-arduino" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
Please copy the entire directory "matrix-i2c_lcd1602" to "Arduino_IDE/libraries"<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix-arduino<br />
$ cp matrix-i2c_lcd1602 Arduino_IDE/libraies -r<br />
</syntaxhighlight><br />
<br />
Start Arduino IDE <br><br />
Click on File->Examples->matrix-i2c_lcd1602->displaychar and run the test program. <br><br />
Click on upload and run the test program. <br><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
#include <Wire.h> <br />
#include <LiquidCrystal_I2C.h><br />
<br />
// set the LCD address to 0x27 for a 16 chars and 2 line display<br />
LiquidCrystal_I2C lcd(0x27,16,2); <br />
<br />
void setup()<br />
{<br />
lcd.init(); <br />
lcd.backlight();<br />
lcd.setCursor(2, 0);<br />
lcd.print("B&G Char LCD"); <br />
lcd.setCursor(0, 1);<br />
lcd.println("--by FriendlyARM");<br />
}<br />
<br />
void loop()<br />
{<br />
}<br />
</syntaxhighlight><br />
<br />
==Resources==<br />
[http://www.wvshare.com/datasheet/LCD_en_PDF/LCD1602.pdf LCD1602.pdf] <br><br />
[http://www.ti.com/lit/ds/symlink/pcf8574.pdf pcf8574.pdf]<br />
<br />
<br />
<!--<br />
<br />
==Introduction==<br />
[[File:LCD160201.png|thumb|I2C LCD1602]]<br />
[[File:LCD160202.png|thumb|I2C LCD1602]]<br />
This is an LCD module which has an I2C controller. It can display 16 x 2 characters. Its interface is parallel. To simplify its application we designed a controller on this module, which interfaces with other modules through I2C and transfers received signals to parallel signals to LCD1602. It can display, turn on and off back light.<br />
<br />
==Features==<br />
* I2C interface. It can display characters, and turn on and off back light<br />
* 2.54 mm spacing pin<br />
* I2C PCB dimension:16 x 42 mm <br />
* LCD1602 PCB dimension: 36 x 80 mm<br />
[[File:lpdpcb.png|frameless|400px|IIC模块PCB]]<br />
*<br />
[[File:lcdpcb.png|frameless|400px|LCD1602 PCB]]<br />
<br />
<br />
==How They Work==<br />
===PCF8574===<br />
*The PCF8574 module's interface is I2C parallel which is 8 bit and has 8 IO (P0 - P7) outputs. <br />
*The PCF8574 module uses the PCF8574T chip whose address diagram is as follows:<br />
[[File:pcf8574.png|frameless|400px|PCF8574]]<br />
*If you set A2-A0 all to "1" the address will be 0x27(0100111). By default RW is "0" and the module is in the "write" mode.<br />
*If it is in the write mode and the address is set you can open "i2c-0" and write data to it.<br />
*If you want to set it to "read" (RW set to "1") please refer to PCF8574's datasheet for more details<br />
<br />
===LCD1602===<br />
*The PCF8574 module's P0 - P7's pin spec are as follows:<br />
[[File:1602.png|frameless|400px|1602]]<br />
*RS is command/data, RW is read/write, E is Enable(Edge-triggering), BL is backlight and D4-D7 are data bits.<br />
*An LCD uses four data bits. However the RS has eight bits. Therefore for each write to RS you need to write DB7-DB4 first and then DB3-DB0. <br />
*Note:the LCD has 192 commonly used characters stored in CGROM. For example if you want to display "A" you can directly write "A". In addition the LCD module allows users to define eight user-defined characters which are stored in CGRAM. The details about CGRAM are not be covered here.<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::GND: Ground<br />
::VCC: 5V<br />
::SDA: I2C SDA<br />
::SCL: I2C SCL<br />
[[File:LCD&NanoPi.png|frameless|600px|NanoPi+lcd]]<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <unistd.h><br />
#include <sys/types.h><br />
#include <sys/stat.h><br />
#include <fcntl.h><br />
#include <stdlib.h><br />
#include "libfahw.h"<br />
<br />
void test(char* line1, char* line2)<br />
{<br />
int devFD;<br />
if ((devFD = LCD1602Init()) == -1) {<br />
printf("Fail to init LCD1602\n");<br />
return;<br />
}<br />
<br />
if (LCD1602Clear(devFD) == -1) {<br />
printf("Fail to Clear\n");<br />
return;<br />
}<br />
<br />
if (LCD1602DispLines(devFD, line1, line2) == -1) {<br />
printf("Fail to Display String\n");<br />
return ;<br />
}<br />
<br />
LCD1602DeInit(devFD);<br />
}<br />
<br />
int main(int argc, char ** argv) {<br />
int i;<br />
for (i=0; i<10; i++) {<br />
test("FriendlyARM", "From 2003");<br />
sleep(3);<br />
}<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-i2c_lcd1602<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_GPS&diff=1143Matrix - GPS2016-02-10T04:51:04Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:GPS01.png|thumb|GPS]]<br />
The matrix GPS module is a small GPS module with high performance. It can be used in navigation devices, four-axle drones and etc.<br />
<br />
*U-blox NEO-7M GPS module;<br />
*MAXIM’s high gain LNA chip and high performance porcelain antenna;<br />
*Support GPS and GLONASS(Russia's Navigation System);<br />
*Serial Communication: baud rate 为9600, 8 data bits, no parity, 1 stop bit;<br />
*Horizontal position accuracy: 2.5m CEP;<br />
*Max navigation update rate: 10Hz;<br />
*Time To First Fix: 30S;<br />
*Sensitivity-Tracking & Navigation: -161dBm;<br />
*Sensitivity-Cold Start: -148dBm;<br />
*Protocol: NMEA(default)/UBX Binary;<br />
*Operational Limits – Velocity: 500m/s;<br />
*Operational Limits- Altitude: 50000m;<br />
*TXD/RXD resistance: 510 Ohm;<br />
*Working Temperature: -40 degree Celsius ~ 85 degree Celsius;<br />
*Supply Voltage:: 5.0V;<br />
*Supply Current: 22mA;<br />
*Onboard LED. After the module is powered on the LED will turn on. If the module gets GPS data successfully the LED will be flashing<br />
<br />
==Features==<br />
* UART interface<br />
* Small<br />
* PCB Dimension(mm): 40 x 40<br />
[[File:GPS.png | frameless|400px|GPS-01.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|RXD || Receive<br />
|-<br />
|TXD || Transmit<br />
|-<br />
|5V || Supply Voltage 5V<br />
|-<br />
|GND || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
*GPS is the abbreviated form of Global Positioning System. This system provides global users with continuous, real time and high precision location and time information.<br />
*The current GPS consists of three major segments: the space segment, a control segment and a user segment.<br />
*Each GPS satellite continually broadcasts a signal (carrier wave with modulation).The receiver measures the time of arrival of the signal. From the time of arrival and the time of transmission the receiver then computes its three-dimensional position<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-GPS to the NanoPi 2:<br><br />
[[File:GPS.jpg|frameless|600px|GPS_NanoPi_2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-GPS || NanoPi 2 <br />
|-<br />
|RXD || Pin8<br />
|-<br />
|TXD || Pin10<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
<br />
<br />
===Resources===</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Compact_Kit&diff=1142Matrix - Compact Kit2016-02-10T04:47:30Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Matrix-Compact_Kit.png|thumb|]]<br />
*The Matrix-Compact Kit is a compact board with various hardware resources, interfaces and ports including user keys, LED, buzzer, ADC, compass, temperature sensor, IR receiver, TFT port and etc. This board can be connected to the NanoPi, NanoPi 2 and Raspberry Pi via its 40 pin header. In addition you can connect other external modules to its GPIOs.<br />
<br />
==Features==<br />
Matrix - Compact Kit has the following onboard resources:<br><br />
* 0.9 TFT LCD<br />
<br />
* 3 x tact switch<br />
<br />
* 4 x 5mm LED <br />
<br />
* Buzzer<br />
<br />
* ADC<br />
<br />
* Sliding rheostat<br />
<br />
* 40 pin female connector<br />
<br />
* 4 pin header - I2C interface<br />
<br />
* 4 pin header - UART interface<br />
<br />
* 3 pin double row pin-header - 3.3V and GND<br />
<br />
* 18B20 temperature sensor<br />
<br />
* IR receiver<br />
<br />
* 10 x 3 pin header - 3 x AIO, 7 x DIO (two of them can be configured to PWM and four of them can be configured to SPI)<br />
<br />
* Compass<br />
<br />
==Dimensional Diagram and Pin Description==<br />
* PCB Dimension(mm):<br />
[[File:Matrix-Compact_Kit_PCB.png|frameless|400px|]]<br />
[[File:Matrix-Compact_Kit01.png |thumb|300px|Matrix-Compact_Kit Interface]]<br />
* '''40 pin female connector's pin description'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name ||Pin# || Name <br />
|-<br />
|1 || VDD_SYS_3.3V ||2 || VDD_5V<br />
|-<br />
|3 || I2C0_SDA ||4 || VDD_5V<br />
|- <br />
|5 || I2C0_SCL ||6 || DGND<br />
|-<br />
|7 || GPIOB28 ||8 || UART3_TXD<br />
|-<br />
|9 || DGND ||10 || UART3_RXD <br />
|-<br />
|11 || GPIOB29 ||12 || GPIOB26<br />
|-<br />
|13 || GPIOB30 ||14 || DGND<br />
|-<br />
|15 || GPIOB31 ||16 || PWM2<br />
|-<br />
|17 || VDD_SYS_3.3V ||18 || GPIOB27<br />
|-<br />
|19 || SPI0_MOSI ||20 || DGND<br />
|-<br />
|21 || SPI0_MISO ||22 || PWM0<br />
|-<br />
|23 || SPI0_CLK ||24 || SPI0_CS<br />
|-<br />
|25 || DGND ||26 || PWM1<br />
|-<br />
|27 || I2C1_SDA ||28 || I2C1_SCL<br />
|-<br />
|29 || GPIOC8 ||30 || DGND<br />
|-<br />
|31 || SPI2_CLK ||32 || GPIOC28<br />
|-<br />
|33 || SPI2_CS ||34 || DGND<br />
|-<br />
|35 || SPI2_MOSI ||36 || GPIOC7<br />
|-<br />
|37 || SPI2_MISO ||38 || ALIVEGPIO2<br />
|-<br />
|39 || DGND ||40 || ALIVEGPIO3<br />
|}<br />
<br />
[[File:Matrix-Compact_Kit3*10.png |thumb|300px|Matrix-Compact_Kit Interface]]<br />
* '''30 pin header's pin description'''<br />
::{| class="wikitable"<br />
|-<br />
|Ch# || G ||Ch# || V ||Ch# || S <br />
|-<br />
|1 || GND ||2 || VDD_5V ||3 ||A1_PCF<br />
|-<br />
|4 || GND ||5 || VDD_5V ||6 ||A2_PCF<br />
|- <br />
|7 || GND ||8 || VDD_5V ||9 ||A3_PCF<br />
|- <br />
|10 || GND ||11 || VDD_5V ||12 ||D1_Pi11<br />
|- <br />
|13 || GND ||14 || VDD_5V ||15 ||D2_Pi26<br />
|- <br />
|16 || GND ||17 || VDD_5V ||18 ||D3_Pi16<br />
|- <br />
|19 || GND ||20 || VDD_5V ||21 ||D4_Pi19<br />
|- <br />
|22 || GND ||23 || VDD_5V ||24 ||D5_Pi21<br />
|- <br />
|25 || GND ||26 || VDD_5V ||27 ||D6_Pi23<br />
|- <br />
|28 || GND ||29 || VDD_5V ||30 ||D7_Pi24<br />
|- <br />
|}<br />
<br />
[[File:18B20 and IRR.png |thumb|300px|18B20 and IR receiver's interface]]<br />
* '''18B20 and IR receiver's pin description'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name ||Pin# || Name ||Pin# || Name <br />
|-<br />
|1 || VDD_5V ||2 || DATA ||3 || GND<br />
|-<br />
|1 || DATA ||2 || GND ||3 || VDD_5V<br />
|- <br />
|}<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub: https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with<br><br />
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;<br />
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi;<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Compact_Kit to the NanoPi 2:<br><br />
[[File:Matrix-Compact_Kit_nanopi2.jpg|frameless|600px|Matrix-Compact_Kit_nanopi2]]<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory<br><br />
<br />
===Copy Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the module, library and test program to the card<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
===Test LCD===<br />
Insert this TF card to your NanoPi 2, power on and run the following commands.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod fbtft_device.ko name=matrix-st7735s gpios=dc:58,reset:63,cs:59<br />
$ sudo FRAMEBUFFER=/dev/fb-st7735s startx &<br />
</syntaxhighlight><br />
"fbtft_device" is the LCD's driver.After it is loaded the LCD will be initialized.<br> <br />
"startx" sets the LCD to the output device. Here is what you should expect:<br><br />
[[File:matrix-cpt_kit_result1.png|frameless|600px|matrix-cpt_kit_result_lcd]]<br />
<br />
===Test AD===<br />
Please run the following command to get Channel 0's value:<br />
<syntaxhighlight lang="bash"><br />
$ matrix-adc<br />
</syntaxhighlight><br />
When you turn the resistor the AD value will be changing. Here is what you should expect:<br><br />
[[File:matrix-cpt_kit_result2.png|frameless|600px|matrix-cpt_kit_result_ad]]<br />
<br />
===Test Compass===<br />
Please run the following command to activate the compass:<br />
<syntaxhighlight lang="bash"><br />
$ matrix-compass<br />
</syntaxhighlight><br />
When you change the module's directon you will get a changing value. Here is what you should expect:<br><br />
[[File:matrix-cpt_kit_result3.png|frameless|600px|matrix-cpt_kit_result_cps]]<br />
<br />
===Test Key===<br />
{| class="wikitable"<br />
|-<br />
|Key || CPU GPIO || linux ID<br />
|- <br />
|KEY1 || GPIOC7 || 71<br />
|- <br />
|KEY2 || ALIVEGPIO2 || 162<br />
|- <br />
|KEY3 || ALIVEGPIO3 || 163<br />
|}<br />
We took KEY1 as an example. Running the following commands reads its value:<br />
<syntaxhighlight lang="bash"><br />
$ cd /sys/class/gpio/<br />
$ echo 71 > export<br />
$ echo in > gpio71/direction<br />
$ cat gpio71/value<br />
</syntaxhighlight><br />
After you press KEY1 the value will be 0. After it is released the value will be 1.<br />
<br />
===Access LED===<br />
{| class="wikitable"<br />
|-<br />
|LED || CPU GPIO || linux ID<br />
|- <br />
|LED1 || GPIOC10 || 74<br />
|- <br />
|LED2 || GPIOC9 || 73<br />
|- <br />
|LED3 || GPIOC11 || 75<br />
|- <br />
|LED4 || GPIOC12 || 76<br />
|}<br />
We took LED1 as an example. Please run the following commands to access LED1:<br />
<syntaxhighlight lang="bash"><br />
$ cd /sys/class/gpio/<br />
$ echo 74 > export<br />
$ echo out > gpio74/direction<br />
$ echo 1 > gpio74/value<br />
</syntaxhighlight><br />
1 indicates LED on and 0 indicates LED1 off.<br />
<br />
==Connect to NanoPi==<br />
<br />
==Connect to Tiny4412==<br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
*[Schematic]([http://pan.baidu.com/s/1pJQ29Az?qq-pf-to=pcqq.temporaryc2c Matrix - Compact Kit-Schematic.pdf])</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_CAM500A&diff=1141Matrix - CAM500A2016-02-10T04:46:04Z<p>Adminhammer: </p>
<hr />
<div>[http://www.friendlyarm.com/index.php?route=product/product&product_id=70 CAM500A]<br />
<br />
==Introduction==<br />
[[File:CAM500A.jpg|thumb|CAM500A]]<br />
The CAM500A module uses Omni Vision’s QSXGA CMOS OV5640 module. It has DVP parallel output interface and supports up to 2592 x 1944 photographing and 720P@30fps video recording. It has automatic image control functions: AFC, AWB and AEC etc.<br />
<br />
The CAM500A uses a cell phone camera. This camera’s focal length is 2.7mm. Its aperture is 2.8. Its viewing angle is 66 degree.<br />
<br />
==Features==<br />
* 5MP (2592 x 1944) photographing, 720P@30fps video recording<br />
* Focal length: 2.7mm, Aperture: 2.8, Viewing angle: 66 degree<br />
* Automatic image control functions: AFC, AWB and AEC etc<br />
* 24 PIN FPC interface including DVC parallel output, 3.3V power, I2C and GPIO</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Buzzer&diff=1140Matrix - Buzzer2016-02-10T04:45:26Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Buzzer.jpg|thumb|Buzzer]]<br />
* The Matrix-Buzzer is a passive buzzer. To drive this buzzer an oscillating source generating 2K - 5K square waves is needed. <br />
* It can be used in electronic devices that need sound generators.<br />
<br />
==Features==<br />
* 3 PIN interface<br />
* PCB dimension (mm): 16 x 24<br />
[[File:buzzerpcb.png|frameless|400px|无源蜂鸣器PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|- <br />
|S || PWM Input<br />
|}<br />
<br />
==Basic Device Operation==<br />
A passive buzzer will not tweet if DC signals are used; instead, you need to use square waves whose frequency is between 2K and 5K to drive it. If you use GPIO signals to drive it you need to pull the GPIO high first and then low to generate oscillation. The oscillation frequency is generated by the time in which GPIO signals turn from high to low. The buzzer will generate different sounds based on different frequencies.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki: [[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Buzzer to the NanoPi <br><br />
[[File:matrix-buzzer_nanopi.jpg|frameless|600px|matrix-buzzer_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Buzzer || NanoPi <br />
|-<br />
|G || Pin6<br />
|-<br />
|V || Pin4<br />
|- <br />
|S || Pin22<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Buzzer" module is "matrix-buzzer".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-buzzer<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int pin = PWM_PIN1;<br />
int Hz;<br />
int duty;<br />
<br />
if (argc == 4) {<br />
if (parseCmd(argc, argv, &pin, &Hz, &duty) == -1) {<br />
return -1;<br />
}<br />
} else {<br />
Hz = 1000;<br />
duty = 500;<br />
printf("Usage:%s PWM[0~1] freq duty[0~1000]\n", argv[0]);<br />
printf("Using default config: pin=PWM0 freq=%dHz duty=%d\n", Hz, duty);<br />
}<br />
<br />
if (PWMPlay(pin, Hz, duty) == -1) {<br />
printf("Fail to output PWM\n");<br />
} <br />
printf("Press enter to stop PWM\n");<br />
getchar();<br />
PWMStop(pin);<br />
printf("Stopped PWM\n");<br />
return 0;<br />
}<br />
<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Buzzer to the Tiny4412 <br><br />
[[File:matrix-buzzer_tiny4412.jpg|frameless|600px|matrix-buzzer_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Buzzer || Tiny4412<br />
|-<br />
|G || GPIO1 GND<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|S || GPIO11 S<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore. <br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Buzzer" module is "matrix-buzzer".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal<br />
<syntaxhighlight lang="bash"><br />
$ matrix-buzzer<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int pin = PWM_PIN1;<br />
int Hz;<br />
int duty;<br />
<br />
if (argc == 4) {<br />
if (parseCmd(argc, argv, &pin, &Hz, &duty) == -1) {<br />
return -1;<br />
}<br />
} else {<br />
Hz = 1000;<br />
duty = 500;<br />
printf("Usage:%s PWM[0~1] freq duty[0~1000]\n", argv[0]);<br />
printf("Using default config: pin=PWM0 freq=%dHz duty=%d\n", Hz, duty);<br />
}<br />
<br />
if (PWMPlay(pin, Hz, duty) == -1) {<br />
printf("Fail to output PWM\n");<br />
} <br />
printf("Press enter to stop PWM\n");<br />
getchar();<br />
PWMStop(pin);<br />
printf("Stopped PWM\n");<br />
return 0;<br />
}<br />
<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
<br />
<br />
<!--<br />
<br />
==Introduction==<br />
[[File:Buzzer.jpg|thumb|Buzzer]]<br />
We utilize a 5V passive buzzer. To drive this buzzer an oscillating source is needed. Pin V is power, Pin G is grounded and Pin S is PMW signal input. Pin S is connected to a triode to turn on/off the buzzer. A PWM signal can be either 3.3V or 5V and the buzzer's sound will vary accordingly.<br />
<br />
==Features==<br />
* 5V Power Supply<br />
* 3.3V/5V PWM<br />
* Tiny, easy to be used in various situations<br />
* 2.54mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
<div id="Tiny4412"></div><br />
*Connect to Tiny4412 SDK (1506)<br />
::Firstly you need to remove the jumper on BP1_EN on the Tiny4412 SDK 1506 carrier board<br />
::Please connect Pin S to GPIO PIN1, V to 5V and G grounded<br />
<div id="NanoPi"></div><br />
*Connect to NanoPi<br />
::TODO<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <unistd.h><br />
#include <stdlib.h><br />
#include "libfahw.h"<br />
<br />
int parseCmd(int argc, char **argv, int *pin, int *Hz, int *duty)<br />
{<br />
int num = atoi(argv[1]);<br />
int hz = atoi(argv[2]);<br />
int dt = atoi(argv[3]);<br />
<br />
if (hz<0) {<br />
return -1;<br />
}<br />
if (dt<0 || dt>1000) {<br />
return -1;<br />
}<br />
switch(num) {<br />
case 0:<br />
*pin = TINY4412_PWM0; <br />
break;<br />
case 1:<br />
*pin = TINY4412_PWM1;<br />
break;<br />
default:<br />
printf("Unsupported pin TINY4412_PWM%d\n", num);<br />
num = 0;<br />
*pin = TINY4412_PWM0;<br />
}<br />
*Hz = hz;<br />
*duty = dt;<br />
printf("Using config: pin=PWM%d freq=%dHz duty=%d\n", num, hz, dt);<br />
return 0;<br />
}<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int pin = TINY4412_PWM0;<br />
int Hz;<br />
int duty;<br />
<br />
if (argc == 4) {<br />
if (parseCmd(argc, argv, &pin, &Hz, &duty) == -1) {<br />
return -1;<br />
}<br />
} else {<br />
Hz = 1000;<br />
duty = 500;<br />
printf("Usage:%s PWM[0~1] freq duty[0~1000]\n", argv[0]);<br />
printf("Using default config: pin=PWM0 freq=%dHz duty=%d\n", Hz, duty);<br />
}<br />
<br />
if (PWMPlay(pin, Hz, duty) == -1) {<br />
printf("Fail to output PWM\n");<br />
} <br />
printf("Press enter to stop PWM\n");<br />
getchar();<br />
PWMStop(pin);<br />
printf("Stopped PWM\n");<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-buzzer<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Button&diff=1139Matrix - Button2016-02-10T04:44:42Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Btn01.jpg|thumb|按键]]<br />
* The Matrix-Button module is used to detect button events.<br />
* If the button is not pressed S will output high otherwise S will output low.<br />
<br />
==Features==<br />
* 3 PIN interface<br />
* PCB dimension (mm): 8 x 24<br />
[[File:btn002.png | frameless|400px|BTN-01.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
* The Matrix-Button is an instant(non self-lock) button. The button's status can be read from pin S in the 3-pin 2.54 mm spacing pin header.<br />
* If the button is not pressed S will output high otherwise S will output low.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub --https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Button to the NanoPi 2:<br><br />
[[File:Matrix-Button_nanopi_2.jpg|frameless|600px|Matrix-Button_nanopi_2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Button || NanoPi 2 <br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi2.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Button" module is "matrix-button".<br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the driver, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod matrix_gpio_int.ko<br />
</syntaxhighlight><br />
<br />
Start the matrix-button program<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-button<br />
</syntaxhighlight><br />
<br />
Here is what you should expect:<br><br />
[[File:matrix-button_result.png|frameless|600px|matrix-button_result]]<br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
static struct sensor button[] = {<br />
{<br />
GPIO_PIN(7),<br />
IRQ_TYPE_EDGE_FALLING,<br />
}<br />
};<br />
int main(int argc, char ** argv)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(button)];<br />
int devFD = -1;<br />
<br />
if (argc == 2) {<br />
button[0].pin = atoi(argv[1]);<br />
}<br />
<br />
printf("Using GPIO_PIN(%d)\n", button[0].pin);<br />
if ((devFD =sensorInit(button, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
printf("Press the button...\n");<br />
if ((retSize = sensorRead(devFD, value, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for (i=0; i<retSize; i++) {<br />
printf("Button[%d]:%d\n", i, value[i]);<br />
}<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] & [[How_to_build_the_Compiling_Environment/zh|How to Build the Compiling Environment]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
A newly generated zImage will be under arch/arm/boot/. You can replace the one under "sd-fuse_nanopi/prebuilt" with this new image file.<br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Button to the NanoPi <br><br />
[[File:matrix-button_nanopi.jpg|frameless|600px|matrix-button_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Button || NanoPi <br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Button" module is "matrix-button".<br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy these files to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi, power on and run the following commands.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-button<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(button)];<br />
int devFD = -1;<br />
<br />
printf("Using pin GPIO_PIN1\n");<br />
if ((devFD =sensorInit(button, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
printf("Press the button...\n");<br />
if ((retSize = sensorRead(devFD, value, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for (i=0; i<retSize; i++) {<br />
printf("Button[%d]:%d\n", i, value[i]);<br />
}<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Button to the Tiny4412 <br><br />
[[File:matrix-button_tiny4412.jpg|frameless|600px|matrix-button_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Button || Tiny4412<br />
|-<br />
|S || GPIO1 S<br />
|-<br />
|V || GPIO1 5V<br />
|- <br />
|G || GPIO1 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore. <br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Button" module is "matrix-button".<br />
<br />
===Run Test Program===<br />
Please insert an SD card which is flashed with UbuntuCore to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy these files the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Insert this card to your Tiny4412, power on and run the following command to start the Matrix-Button test program。<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-button<br />
</syntaxhighlight><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(button)];<br />
int devFD = -1;<br />
<br />
printf("Using pin GPIO_PIN1\n");<br />
if ((devFD =sensorInit(button, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
printf("Press the button...\n");<br />
if ((retSize = sensorRead(devFD, value, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for (i=0; i<retSize; i++) {<br />
printf("Button[%d]:%d\n", i, value[i]);<br />
}<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
<br />
<br />
<!--<br />
<br />
==Introduction==<br />
[[Image:Btn.png|thumb|按键]]<br />
The Matrix-Button is an instant(non self-lock) button. The button's status can be read from pin S in the 3-pin 2.54 mm spacing pin header. If the button is not pressed S will output high otherwise S will output low.<br />
<br />
==Features==<br />
* Instant, non self-lock<br />
* Tiny, easy to be used in various situations<br />
* 2.54mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::Connect the module's pin S to GPIO PIN1, pin V to 5V and pin G grounded<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include "libfahw.h"<br />
<br />
static struct sensor button[] = {<br />
{<br />
TINY4412_GPIO_PIN1,<br />
IRQ_TYPE_EDGE_FALLING,<br />
}<br />
};<br />
<br />
int main(void)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(button)];<br />
int devFD = -1;<br />
if ((devFD =sensorInit(button, ARRAY_SIZE(button))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
printf("Press the button...\n");<br />
if (( retSize = sensorRead(devFD, value, ARRAY_SIZE(button)) ) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for (i=0; i<retSize; i++) {<br />
printf("Button[%d]:%d\n", i, value[i]);<br />
}<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-button<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Ball_Rolling_Switch&diff=1138Matrix - Ball Rolling Switch2016-02-10T04:44:06Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:BAll Rolling Switch01.png|thumb|BAll Rolling Switch]]<br />
*The Matrix-Ball_Rolling_Switch module is a ball switch. Its electrical characteristics are very similar to a mercury switch's however a mercury switch is easily broken, oxidized, leaking and not environment-friendly. This ball switch prevents all these issues.<br />
*The switch is free to move any angle and if that angle is between 15 degrees and 45 degrees a signal will be generated and used as an input to a Schmitt trigger. <br />
<br />
<br />
==Features==<br />
* GPIO<br />
* Small<br />
* 2.54 mm spacing pin header<br />
* PCB Dimension(mm):16 x 16<br />
[[File:BAll Rolling Switchpcb.png | frameless|400px|BAll Rolling Switch-01.PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|S || Digital GPIO<br />
|-<br />
|V || Supply Voltage 5V<br />
|-<br />
|G || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
Please connect Pin V to a power supply, Pin G grounded and Pin S to a digital output. When you move the switch pushing the internal metal ball to connect the trigger point a high level signal will be generated and output to a Schmitt trigger which reverses this signal to output a low level signal. When you move the switch pushing the internal metal ball away from the trigger point a low level signal will be generated and output to a Schmitt trigger which reverses this signal to output a high level signal.<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub: https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with<br><br />
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;<br />
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi;<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Ball_Rolling_Switch to the NanoPi 2:<br><br />
[[File:matrix-BAll Rolling Switch_nanopi.jpg|frameless|600px|matrix-BAll Rolling Switch_nanopi2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Ball_Rolling_Switch || NanoPi2<br />
|-<br />
|S || Pin7<br />
|-<br />
|V || Pin4<br />
|- <br />
|G || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory.<br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the module, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to start the matrix-ball_switch program.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-ball_switch<br />
</syntaxhighlight><br />
Here is what you should expect:<br><br />
[[File:matrix-ball_switch_result.png|frameless|600px|matrix-ball_switch_result]] <br><br />
After you get the prompt "Lean the switch" please tilt the module to roll the ball making it touch the trigger point you will see "Switch[0]:1".<br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
static struct sensor brSwitch[] = {<br />
{<br />
GPIO_PIN(7),<br />
IRQ_TYPE_EDGE_FALLING,<br />
}<br />
};<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int i;<br />
int retSize = -1;<br />
char value[ARRAY_SIZE(brSwitch)];<br />
int devFD = -1;<br />
<br />
if (argc == 2) {<br />
brSwitch[0].pin = atoi(argv[1]);<br />
}<br />
<br />
printf("Using GPIO_PIN(%d)\n", brSwitch[0].pin);<br />
if ((devFD =sensorInit(brSwitch, ARRAY_SIZE(brSwitch))) == -1) {<br />
printf("Fail to init sensor\n");<br />
return -1;<br />
}<br />
printf("Lean the switch...\n");<br />
if ((retSize = sensorRead(devFD, value, ARRAY_SIZE(brSwitch))) == -1) {<br />
printf("Fail to read sensors\n");<br />
}<br />
if (retSize > 0) {<br />
i = 0;<br />
for (i=0; i<retSize; i++) {<br />
printf("Switch[%d]:%d\n", i, value[i]);<br />
}<br />
}<br />
sensorDeinit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_Analog_to_Digital_Converter&diff=1137Matrix - Analog to Digital Converter2016-02-10T04:43:33Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:ADC.png|thumb|Analog to Digital Converter]]<br />
* The Matrix-Analog_to_Digital_Converter is a single-chip, single-supply low-power 8-bit CMOS data acquisition device.<br />
* It utilizes the PCF8591 chip with four analog inputs, one analog output and a serial I2C-bus interface. Three address pins A0, A1 and A2 are used for programming the hardware address, allowing<br />
the use of up to eight devices connected to the I2C-bus without additional hardware. Address, control and data to and from the device are transferred serially via the two-line bidirectional I2C-bus. The<br />
maximum conversion rate is given by the maximum speed of the I2C-bus.<br />
* The I2C hardware address is configured to 1001000x<br />
* The operating supply voltage is from 2.5V to 6.0V,Among the 2.54 mm spacing pin header the 5V pin is the supply voltage. If you need 0 - 3.3V analog signals and keep the acquisition resolution you can connect it to a 3.3V supply voltage.<br />
<br />
==Features==<br />
* Wide range supply voltage: 2.5V - 6.0V<br />
* I2C interface: 3.3V/5V<br />
* 8-bit A/D x 4 <br />
* 8-bit D/A x 1<br />
* Small and easy to be used in various situations<br />
* 2.54 mm spacing pin<br />
* PCB dimension (mm): 16 x 24<br />
[[File:adcpcb.png|frameless|400px|模数PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description <br />
|-<br />
|SDA || I2C SDA<br />
|-<br />
|SCL || I2C SCL<br />
|- <br />
|5V || Supply Voltage 5V<br />
|-<br />
|GND || Ground<br />
|-<br />
|AOUT || Analog Output<br />
|-<br />
|A3 || Analog Input3<br />
|-<br />
|A2 || Analog Input2<br />
|-<br />
|A1 || Analog Input1<br />
|-<br />
|A0 || Analog Input0<br />
|}<br />
<br />
==Basic Device Operation==<br />
The PCF8591's I2C-bus is for bidirectional, two-line communication between different ICs or modules. The two lines are a Serial DAta line (SDA) and a Serial CLock line (SCL). Both lines must<br />
be connected to a positive supply via a pull-up resistor. Data transfer may be initiated only when the bus is not busy. The AINT0 - AINT4 pins are analog inputs which can be configured to single-ended or differential inputs. The supply voltage is 0 - VDD.<br><br />
1. Each PCF8591 device in an I2C-bus system is activated by sending a valid address to the device. The address consists of a fixed part and a programmable part. The programmable part must be set according to the address pins A0, A1 and A2. The address is always sent as the first byte after the start condition in the I2C-bus protocol. The last bit of the address byte is the read/write-bit which sets the direction of the following data transfer. <br><br />
2. The second byte sent to a PCF8591 device is stored in its control register and is required to control the device function. The upper nibble of the control register is used for enabling the analog output, and for programming the analog inputs as single-ended or differential inputs. The lower nibble selects one of the analog input channels defined by the upper nibble.<br><br />
3. The on-chip D/A converter and a high-gain comparator are used temporarily during an A/D conversion cycle. An A/D conversion cycle is always started after sending a valid read mode address to a PCF8591 device. The A/D conversion cycle is triggered at the trailing edge of the acknowledge clock pulse and is executed while transmitting the result of the previous conversion。 <br><br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code: <br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-Analog_to_Digital_Converter to the NanoPi <br><br />
[[File:matrix-analog_to_digital_converter_nanopi.jpg|frameless|600px|matrix-analog_to_digital_converter_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Analog_to_Digital_Converter || NanoPi <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Analog_to_Digital_Converter" module is "matrix-adc".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-adc<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
int data, channel, mode;<br />
<br />
if ((devFD = pcf8591Init()) == -1) {<br />
printf("Fail to init pcf8591\n");<br />
return -1;<br />
}<br />
<br />
if (pcf8591SetCtrl(devFD, PCF8591_INIT_AD_CONTROL) == -1) {<br />
printf("Fail to Set pcf8591 control AD\n");<br />
pcf8591DeInit(devFD);<br />
return -1;<br />
}<br />
<br />
mode = 0;<br />
printf("pcf8591 working as AD in mode%d\n",mode);<br />
for (channel = PCF8591_AIN_CHANNEL0; channel <= PCF8591_AIN_CHANNEL3; channel++) {<br />
data = pcf8591Read(devFD, mode, channel);<br />
printf("Channel%d's value: %d\n",channel,data);<br />
}<br />
<br />
pcf8591DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-Analog_to_Digital_Converter to the Tiny4412 <br><br />
[[File:matrix-analog_to_digital_converter_tiny4412.jpg|frameless|600px|matrix-analog_to_digital_converter_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-Analog_to_Digital_Converter || NanoPi <br />
|-<br />
|SDA || CON18 SDA<br />
|-<br />
|SCL || CON18 SCL<br />
|- <br />
|5V || CON18 5V<br />
|-<br />
|GND || CON18 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore. <br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-Analog_to_Digital_Converter" module is "matrix-adc".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br />
<syntaxhighlight lang="bash"><br />
$ matrix-adc<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
int data, channel, mode;<br />
<br />
if ((devFD = pcf8591Init()) == -1) {<br />
printf("Fail to init pcf8591\n");<br />
return -1;<br />
}<br />
<br />
if (pcf8591SetCtrl(devFD, PCF8591_INIT_AD_CONTROL) == -1) {<br />
printf("Fail to Set pcf8591 control AD\n");<br />
pcf8591DeInit(devFD);<br />
return -1;<br />
}<br />
<br />
mode = 0;<br />
printf("pcf8591 working as AD in mode%d\n",mode);<br />
for (channel = PCF8591_AIN_CHANNEL0; channel <= PCF8591_AIN_CHANNEL3; channel++) {<br />
data = pcf8591Read(devFD, mode, channel);<br />
printf("Channel%d's value: %d\n",channel,data);<br />
}<br />
<br />
pcf8591DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://www.nxp.com/documents/data_sheet/PCF8591.pdf PCF8591.pdf]<br />
<br />
<br />
<!--<br />
<br />
==Introduction==<br />
[[File:ADC.png|thumb|Analog to Digital Converter]]<br />
We utilize the PFC8591T in this module and extend necessary pins through a 2.54 mm spacing pin header. The PFC8591T is an 8-bit A/D and D/A converter. It has 4 A/D channels and 1 D/A channel. In this module we use the PFC8591T's power, ground, I2C, A/D and D/A pins. The I2C's address is configured as 1001000x. Its power source range is 2.5V - 6.0V. By default the power pin is 5V however if you want to take a 0 - 3.3V analog signal and keep its accuracy you can connect it to a 3.3V power source.<br />
<br />
==Features==<br />
* Wide power input range: 2.5V-6.0V<br />
* I2C, 3.3V/5V<br />
* 8-bit A/D x 4 <br />
* 8-bit D/A x 1<br />
* Tiny dimension, easy to use in various situations<br />
* 2.54 mm spacing pin<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::VCC: 5V<br />
::G: Ground<br />
::SDA: I2C SDA<br />
::SCL: I2C SCL<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <sys/types.h><br />
#include <sys/stat.h><br />
#include <fcntl.h><br />
#include <unistd.h><br />
#include "libfahw.h"<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
int data, channel, mode;<br />
<br />
if ((devFD = pcf8591Init()) == -1) {<br />
printf("Fail to init pcf8591\n");<br />
return -1;<br />
}<br />
<br />
if (pcf8591SetCtrl(devFD, PCF8591_INIT_AD_CONTROL) == -1) {<br />
printf("Fail to Set pcf8591 control AD\n");<br />
pcf8591DeInit(devFD);<br />
return -1;<br />
}<br />
mode = 0;<br />
printf("pcf8591 working as AD in mode%d\n",mode);<br />
for(channel = PCF8591_AIN_CHANNEL0;channel <= PCF8591_AIN_CHANNEL3; channel++) {<br />
data = pcf8591Read(devFD, mode, channel);<br />
printf("Channel%d's value: %d\n",channel,data);<br />
}<br />
pcf8591DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo/matrix-analog_to_digital_converter<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_3-Axis_Digital_Compass&diff=1136Matrix - 3-Axis Digital Compass2016-02-10T04:42:49Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Example.jpg|thumb|3-Axis Digital Accelerometer]]<br />
* The Matrix-3_Axis_Digital_Compass module is designed to measure the direction and functions like to a compass.<br />
* It utilizes the HMC5883L chip. The HMC5883L includes high-resolution HMC118X series magneto-resistive sensors plus an ASIC containing amplification, automatic degaussing strap drivers, offset cancellation, and a 12-bit ADC that enables 1° to 2° compass heading accuracy. It achieves 2 milli-gauss field resolution in ±8 gauss fields. These sensors’ solid-state construction with very low cross-axis sensitivity is designed to measure both the direction and the magnitude of Earth’s magnetic fields, from milli-gauss to 8 gauss. It has an I2C serial bus interface.<br />
* It integrates a 3.3V power conversion IC allowing it to be powered by an external 5V power source. It can be controlled by an I2C master. <br />
<br />
==Features==<br />
* I2C,3.3V<br />
* 1° to 2° compass heading accuracy<br />
* 2.54 mm spacing pin<br />
* PCB Dimension(mm): 16 x 16<br />
[[File:Example.jpg|frameless|400px|重力加速度PCB]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|SDA || I2C SDA<br />
|-<br />
|SCL || I2C SCL<br />
|- <br />
|5V || Supply Voltage 5V<br />
|-<br />
|GND || Ground<br />
|}<br />
<br />
==Basic Device Operation== <br />
* The Honeywell HMC5883L magnetoresistive sensor circuit is a trio of sensors and application specific support circuits to measure magnetic fields. With power supply applied, the sensor converts any incident magnetic field in the sensitive axis directions to a differential voltage output. The magnetoresistive sensors are made of a nickel-iron (Permalloy) thin-film and patterned as a resistive strip element. In the presence of a magnetic field, a change in the bridge resistive elements causes a corresponding change in voltage across the bridge outputs. These resistive elements are aligned together to have a common sensitive axis (indicated by arrows in the pinout diagram) that will provide positive voltage change with magnetic fields increasing in the sensitive direction. Because the output is only proportional to the magnetic field component along its axis, additional sensor bridges are placed at orthogonal directions to permit accurate measurement of magnetic field in any orientation.<br />
* The HMC5883L communicates via a two-wire I2C bus system as a slave device. It has 8-bit read address and 8-bit write address. This device supports standard and fast modes, 100kHz and 400kHz, respectively, but does not support the high speed mode (Hs). The bus bit format is an 8-bit Data/Address send and a 1-bit acknowledge bit. The format of the data bytes (payload) shall be case sensitive ASCII characters or binary data to the HMC5883L slave, and binary data returned. Negative binary values will be in two’s complement form. The default (factory) HMC5883L 8-bit slave address is 0x3C for write operations, or 0x3D for read operations.<br />
* The module has an I2C interface which complies to the I2C standard protocol and the connection diagram is as follows<br />
[[File:三轴重力.png|frameless|400px|三轴重力加速度]]<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code:<br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-3_Axis_Digital_Compass to the NanoPi 2:<br><br />
[[File:Matrix-3_Axis_Digital_Compass_nanopi_2.jpg|frameless|600px|Matrix-3_Axis_Digital_Compass_nanopi_2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-3_Axis_Digital_Compass || NanoPi 2 <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory.<br><br />
<br />
<br />
<br />
===Run Test Program===<br />
<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the module, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following command to start the matrix-compass program.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-compass<br />
</syntaxhighlight><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi 2.<br><br />
Here is what you should expect:<br><br />
[[File:matrix-compass_result.png|frameless|600px|matrix-compass_result]]<br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
double angle;<br />
<br />
if ((devFD = hmc5883Init()) == -1) {<br />
printf("Fail to init hmc5883\n");<br />
return -1;<br />
}<br />
<br />
if ((angle = hmc5883Read(devFD)) == -1) {<br />
printf("Fail to read hmc5883\n");<br />
hmc5883DeInit(devFD);<br />
return -1;<br />
}<br />
printf("The angle is %f\n", angle);<br />
printf("You are heading ");<br />
if((angle < 22.5) || (angle > 337.5 )) { <br />
printf("South\n");<br />
}<br />
else if((angle > 22.5) && (angle < 67.5 )) {<br />
printf("South-West\n");<br />
}<br />
else if((angle > 67.5) && (angle < 112.5 )) { <br />
printf("West\n");<br />
}<br />
else if((angle > 112.5) && (angle < 157.5 )) { <br />
printf("North-West\n");<br />
}<br />
else if((angle > 157.5) && (angle < 202.5 )) { <br />
printf("North\n");<br />
}<br />
else if((angle > 202.5) && (angle < 247.5 )) { <br />
printf("NorthEast\n");<br />
}<br />
else if((angle > 247.5) && (angle < 292.5 )) { <br />
printf("East\n");<br />
}<br />
else if((angle > 292.5) && (angle < 337.5 )) { <br />
printf("SouthEast\n");<br />
}<br />
hmc5883DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki: [[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch.<br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-3_Axis_Digital_Compass module to the NanoPi <br><br />
[[File:matrix-3_axis_digital_compass_nanopi.jpg|frameless|600px|matrix-3_axis_digital_compass_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-3_Axis_Digital_Compass || NanoPi <br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SCL || Pin5<br />
|- <br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-3_Axis_Digital_Compass" module is "matrix-compass".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-3_axis_digital_compass<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
double angle;<br />
<br />
if ((devFD = hmc5883Init()) == -1) {<br />
printf("Fail to init hmc5883\n");<br />
return -1;<br />
}<br />
<br />
if ((angle = hmc5883Read(devFD)) == -1) {<br />
printf("Fail to read hmc5883\n");<br />
hmc5883DeInit(devFD);<br />
return -1;<br />
}<br />
printf("The angle is %f\n", angle);<br />
printf("You are heading ");<br />
if((angle < 22.5) || (angle > 337.5 )) { <br />
printf("South\n");<br />
}<br />
else if((angle > 22.5) && (angle < 67.5 )) {<br />
printf("South-West\n");<br />
}<br />
else if((angle > 67.5) && (angle < 112.5 )) { <br />
printf("West\n");<br />
}<br />
else if((angle > 112.5) && (angle < 157.5 )) { <br />
printf("North-West\n");<br />
}<br />
else if((angle > 157.5) && (angle < 202.5 )) { <br />
printf("North\n");<br />
}<br />
else if((angle > 202.5) && (angle < 247.5 )) { <br />
printf("NorthEast\n");<br />
}<br />
else if((angle > 247.5) && (angle < 292.5 )) { <br />
printf("East\n");<br />
}<br />
else if((angle > 292.5) && (angle < 337.5 )) { <br />
printf("SouthEast\n");<br />
}<br />
hmc5883DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-3_Axis_Digital_Compass to the Tiny4412 <br><br />
[[File:matrix-3_axis_digital_compass_tiny4412.jpg|frameless|600px|matrix-3_axis_digital_compass_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-3_Axis_Digital_Compass || Tiny4412 <br />
|-<br />
|SDA || CON18 SDA<br />
|-<br />
|SCL || CON18 SCL<br />
|- <br />
|5V || CON18 5V<br />
|-<br />
|GND || CON18 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-3_Axis_Digital_Compass" module is "matrix-compass".<br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal <br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-3_axis_digital_compass<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv)<br />
{<br />
int devFD;<br />
double angle;<br />
<br />
if ((devFD = hmc5883Init()) == -1) {<br />
printf("Fail to init hmc5883\n");<br />
return -1;<br />
}<br />
<br />
if ((angle = hmc5883Read(devFD)) == -1) {<br />
printf("Fail to read hmc5883\n");<br />
hmc5883DeInit(devFD);<br />
return -1;<br />
}<br />
printf("The angle is %f\n", angle);<br />
printf("You are heading ");<br />
if((angle < 22.5) || (angle > 337.5 )) { <br />
printf("South\n");<br />
}<br />
else if((angle > 22.5) && (angle < 67.5 )) {<br />
printf("South-West\n");<br />
}<br />
else if((angle > 67.5) && (angle < 112.5 )) { <br />
printf("West\n");<br />
}<br />
else if((angle > 112.5) && (angle < 157.5 )) { <br />
printf("North-West\n");<br />
}<br />
else if((angle > 157.5) && (angle < 202.5 )) { <br />
printf("North\n");<br />
}<br />
else if((angle > 202.5) && (angle < 247.5 )) { <br />
printf("NorthEast\n");<br />
}<br />
else if((angle > 247.5) && (angle < 292.5 )) { <br />
printf("East\n");<br />
}<br />
else if((angle > 292.5) && (angle < 337.5 )) { <br />
printf("SouthEast\n");<br />
}<br />
hmc5883DeInit(devFD);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://www51.honeywell.com/aero/common/documents/myaerospacecatalog-documents/Defense_Brochures-documents/HMC5883L_3-Axis_Digital_Compass_IC.pdf HMC5883L_3-Axis_Digital_Compass_IC.pdf]</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_3-Axis_Digital_Accelerometer&diff=1135Matrix - 3-Axis Digital Accelerometer2016-02-10T04:42:14Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:3AD.png|thumb|3-Axis Digital Accelerometer]]<br />
* This module measures the static acceleration of gravity in three axis x, y and z resulting from motion or shock. <br />
* Its digital interface is IIC or SPI. <br />
* It is integrated with an ADXL345 chip with high resolution (13-bit) measurement at ±2g, ±4g, ±8g and ±16g. <br />
* The module is powered by 5V and converts 5V to 3.3V to ADXL345.<br />
<br />
==Features==<br />
* I2C, 3.3V<br />
* 13-bit, up to +-16g<br />
* 2.54mm spacing pin interface<br />
* PCB dimension(mm): 16 x 32<br />
[[File:adxpcb.png|frameless|400px|重力加速度PCB]]<br />
<br />
* Pin Description: <br><br />
{| class="wikitable"<br />
|-<br />
|Pin || Description <br />
|-<br />
|INT2 || Interrupt<br />
|-<br />
|INT1 || Interrupt<br />
|- <br />
|CS || Enable<br />
|-<br />
|SCL || I2C SCL<br />
|-<br />
|SDA || I2C SDA<br />
|-<br />
|SDO || Set Slave Address<br />
|-<br />
|5V || Supply Voltage 5V<br />
|-<br />
|GND || Ground<br />
|}<br />
<br />
==Basic Device Operation==<br />
* The ADXL345 is a small, thin, ultralow power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is acces-sible through either a SPI (3- or 4-wire) or I2C digital interface.<br />
* The ADXL345 is well suited for mobile device applications. It measures the static acceleration of gravity in tilt-sensing appli-cations, as well as dynamic acceleration resulting from motion or shock. Its high resolution (3.9 mg/LSB) enables measurement of inclination changes less than 1.0°.<br />
* The ADXL345 conforms to the UM1024 I2C Specification. It supports standard (100 kHz) and fast (400 kHz) data transfer modes. If the CS is tied high it will be in the I2C mode. If the CS or ALT ADDRESS pin is floating or unconnected the state will be unknown.<br />
* The module's I2C connection diagram is as follows:<br />
[[File:三轴重力.png|frameless|400px|三轴重力加速度]]<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;<br />
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi;<br />
<br />
Please follow the steps below to get the source code:<br> <br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-3_Axis_Digital_Accelerometer to the NanoPi 2:<br><br />
[[File:Matrix-3_Axis_Digital_Accelerometer_nanopi_2.jpg|frameless|600px|Matrix-3_Axis_Digital_Accelerometer_nanopi_2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-3_Axis_Digital_Accelerometer || NanoPi 2 <br />
|-<br />
|INT2 || Not Connected<br />
|-<br />
|INT1 || Not Connected<br />
|- <br />
|CS || Pin1<br />
|-<br />
|SCL || Pin5<br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SDO || Pin2<br />
|-<br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory.<br><br />
<br />
===Run Test Program===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the module, library and test program to the card<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod adxl34x.ko<br />
$ insmod adxl34x-i2c.ko<br />
</syntaxhighlight><br />
<br />
Start the matrix-accelerometer program.<br><br />
<syntaxhighlight lang="bash"><br />
$ matrix-accelerometer<br />
</syntaxhighlight><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi 2.<br><br />
Here is what you should expect:<br><br />
[[File:matrix-accelerometer_result.png|frameless|600px|matrix-accelerometer_result]]<br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv) <br />
{<br />
char position[BUF_SIZE];<br />
memset(position, 0, BUF_SIZE);<br />
<br />
if (adxl34xRead(position) > 0) {<br />
printf("Get position: %s", position);<br />
} else {<br />
printf("Fail to get position\n"); <br />
}<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
You need to install a Debian on the NanoPi and have a PC which has an appropriate cross compiler ready. For details you can refer to wiki:[[NanoPi/zh|NanoPi]]<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagrams to connect "Matrix-3_Axis_Digital_Accelerometer" to the NanoPi <br><br />
[[File:matrix-3_axis_digital_accelerometer_nanopi.jpg|frameless|600px|matrix-3_axis_digital_accelerometer_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-3_Axis_Digital_Accelerometer || NanoPi <br />
|-<br />
|INT2 || Floating<br />
|-<br />
|INT1 || Floating<br />
|- <br />
|CS || Pin1<br />
|-<br />
|SCL || Pin5<br />
|-<br />
|SDA || Pin3<br />
|-<br />
|SDO || Pin2<br />
|-<br />
|5V || Pin4<br />
|-<br />
|GND || Pin6<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix git and enter the matrix-nanopi branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout matrix-nanopi<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.4.3" on your PC, which is used to compile files for the NanoPi-Debian.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-3_Axis_Digital_Accelerometer" module is "matrix-3_axis_digital_accelerometer".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the NanoPi<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* nanopi_rootfs/usr/bin/<br />
$ cp install/lib/* nanopi_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the NanoPi and run the following command in Debian's terminal<br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a NanoPi.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-3_axis_digital_accelerometer<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv) <br />
{<br />
char position[BUF_SIZE];<br />
memset(position, 0, BUF_SIZE);<br />
<br />
if (adxl34xRead(position) > 0) {<br />
printf("Get position: %s", position);<br />
} else {<br />
printf("Fail to get position\n"); <br />
}<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
==Connect to Tiny4412==<br />
===Preparations===<br />
Please refer to the Tiny4412's user's manual to install a UbuntuCore on the Tiny4412 and install an appropriate cross compiler on a PC.<br><br />
Note: only the Tiny4412SDK-1506 carrier board can work with this module.<br />
<br />
===Hardware Connection===<br />
Please refer to the following diagram to connect the Matrix-3_Axis_Digital_Accelerometer to the Tiny4412 <br><br />
[[File:matrix-3_axis_digital_accelerometer_tiny4412.jpg|frameless|600px|matrix-3_axis_digital_accelerometer_tiny4412]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-3_Axis_Digital_Accelerometer || Tiny4412 <br />
|-<br />
|INT2 || Floating<br />
|-<br />
|INT1 || Floating<br />
|- <br />
|CS || CON16 5V<br />
|-<br />
|SCL || CON18 SCL<br />
|-<br />
|SDA || CON18 SDA<br />
|-<br />
|SDO || CON14 5V<br />
|-<br />
|5V || CON18 5V<br />
|-<br />
|GND || CON18 GND<br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the Matrix hub and enter the matrix-tiny4412 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout matrix-tiny4412<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- clean<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf-<br />
$ make CROSS_COMPILE=arm-linux-gnueabihf- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gnueabihf-gcc-4.7.3" on your PC, which is used to compile files for the Tiny4412-UbuntuCore.<br><br />
Generated library files are under the "install/lib" directory. Applications are under the "install/usr/bin" directory. The test program for the "Matrix-3_Axis_Digital_Accelerometer" module is "matrix-3_axis_digital_accelerometer".<br><br />
<br />
===Run Test Program===<br />
Please copy the library files and test program to the Tiny4412<br />
<syntaxhighlight lang="bash"><br />
$ cp install/usr/bin/* tiny4412_rootfs/usr/bin/<br />
$ cp install/lib/* tiny4412_rootfs/lib/ -d<br />
</syntaxhighlight><br />
<br />
Power on the Tiny4412 and run the following command in UbuntuCore's terminal<br><br />
Note: this module is not plug and play therefore before running the module please make sure it is connected to a Tiny4412.<br />
<syntaxhighlight lang="bash"><br />
$ matrix-3_axis_digital_accelerometer<br />
</syntaxhighlight><br />
<br />
===Code Sample===<br />
<syntaxhighlight lang="c"><br />
int main(int argc, char ** argv) <br />
{<br />
char position[BUF_SIZE];<br />
memset(position, 0, BUF_SIZE);<br />
<br />
if (adxl34xRead(position) > 0) {<br />
printf("Get position: %s", position);<br />
} else {<br />
printf("Fail to get position\n"); <br />
}<br />
return 0;<br />
}<br />
<br />
</syntaxhighlight><br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==<br />
[http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf ADXL345.pdf]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<!--<br />
<br />
<br />
==Features==<br />
* SPI/I2C,3.3V<br />
* 13-bit,up to +-16g<br />
* 2.54mm spacing pin interface<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::GND: Ground<br />
::VCC: 5V<br />
::INT2: NC, empty pin<br />
::INT1: NC, empty pin<br />
::CS: 5V<br />
::SCL: I2C SCL<br />
::SDA: I2C SDA<br />
::SDO: 5V for slave address<br />
<br />
===Code Sample in C Under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <string.h><br />
#include "libfahw-adxl34x.h"<br />
<br />
int main(int argc, char ** argv)<br />
{<br />
char *position = (char *) malloc(32);<br />
memset(position, 0, 32);<br />
<br />
if (adxl34xRead(position) > 0) {<br />
printf("Get position: %s", position);<br />
} else {<br />
printf("Fail to get position\n");<br />
}<br />
free(position);<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone http://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-3_axis_digital_accelerometer<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==<br />
<br />
--></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_2%278_SPI_TFT&diff=1134Matrix - 2'8 SPI TFT2016-02-10T04:41:41Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Matrix-SPI_TFT.png|thumb|]]<br />
*<br />
==Features==<br />
* PCB dimension(mm):<br />
[[File:Matrix-SPI_TFT_PCB.png|frameless|400px|]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
| || <br />
|-<br />
|}<br />
<br />
==Basic Device Operation==<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with。<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* the tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* the raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code: <br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-2'8 SPI_TFT to the NanoPi 2:<br><br />
[[File:Matrix-2'8_SPI_TFT_nanopi2.jpg|frameless|600px|Matrix-2'8_SPI_TFT_nanopi2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-2'8_SPI_TFT || NanoPi 2<br />
|-<br />
|GND || Pin6<br />
|-<br />
|5V || Pin2<br />
|- <br />
|LED_EN || Pin11<br />
|-<br />
|LCD_RESET || Pin7<br />
|-<br />
|LCD_D/C || Pin22<br />
|- <br />
|LCD_CS || Pin24<br />
|-<br />
|SPICLK || Pin23<br />
|-<br />
|SPIMOSI || Pin19<br />
|- <br />
|SPIMISO || Pin21<br />
|-<br />
|T_CS || Pin26<br />
|-<br />
|T_IRQ || Pin18<br />
|- <br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory.<br><br />
<br />
===Load Driver===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the driver, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod fbtft_device.ko name=matrix-st7789s gpios=dc:97,reset:60,cs:94<br />
$ insmod matrix_ads7846.ko<br />
</syntaxhighlight><br />
"fbtft_device" is the LCD's driver. "matrix_ads7846" is the touch driver. If they are successfully loaded the LCD will be cleared and reset.<br><br />
<br />
===Test LCD Display===<br />
Please run the following commands to set the display device to the Matrix-2'8_SPI_TFT:<br />
<syntaxhighlight lang="bash"><br />
$ sudo FRAMEBUFFER=/dev/fb-st7789s startx &<br />
</syntaxhighlight><br />
"&" schedules the program to run background and you will see the following messages:<br><br />
<syntaxhighlight lang="bash"><br />
Log file: "/var/log/Xorg.2.log"<br />
</syntaxhighlight><br />
Here the message shows that the X window's DISPLAY value is 2.<br><br />
<br />
===Calibrate Touch===<br />
Please run the following commands to calibrate touch:<br />
<syntaxhighlight lang="bash"><br />
$ DISPLAY=:2.0 xinput_calibrator<br />
</syntaxhighlight><br />
After you click on the four points highlighted on the LCD you will get calibration done and observe the following messages:<br />
<syntaxhighlight lang="bash"><br />
Section "InputClass" <br />
Identifier "calibration" <br />
MatchProduct "ADS7846 Touchscreen" <br />
Option "Calibration" "196 3825 3887 358" <br />
Option "SwapAxes" "0" <br />
EndSection <br />
</syntaxhighlight><br />
Save these calibration data to the "/usr/share/X11/xorg.conf.d/99-calibration.conf" file and reboot the system your touch will be ready to go.<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch. <br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-SPI_TFT to the NanoPi <br><br />
[[File:Matrix-SPI_TFT_nanopi.jpg|frameless|600px|Matrix-SPI_TFT_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-SPI_TFT || NanoPi<br />
|-<br />
| || <br />
|-<br />
|}<br />
<br />
===Load Driver===<br />
Power on the NanoPi and run the following command in Debian's terminal to load drivers:<br />
<syntaxhighlight lang="bash"><br />
$ modprobe fbtft_device name=matrix-spi_tft gpios=dc:161,reset:162,cs:163<br />
$ modprobe matrix_ads7846<br />
</syntaxhighlight><br />
The "fbtft_device" module is the driver for the ili9341 chip and the "matrix_ads7846" module is the driver for the xpt2046 chip.<br />
<br />
===Install Package===<br />
Please run the following commands in Debian's terminal to install "qtembedded" and "matrix-tslib"<br />
<syntaxhighlight lang="bash"><br />
$ apt-get update<br />
$ apt-get install qtembedded<br />
$ apt-get install matrix-tslib <br />
</syntaxhighlight><br />
The "qtembedded" library is what qt applications rely on and the "matrix-tslib" library is what screen calibration relies on.<br />
<br />
===Run Test Program===<br />
Start Qt applications<br />
<syntaxhighlight lang="bash"><br />
$ . /usr/bin/matrix-setqt4env<br />
$ /usr/local/Trolltech/QtEmbedded-4.8.5-arm/examples/tetrix -qws<br />
</syntaxhighlight><br />
The matrix-setqt4env script sets the environmental variables which Qt and tslib rely on. If it is run on a platform for the first time a screen calibration GUI will be launched. Users need to go through a five-point calibration process to calibrate the screen.<br />
The tetrix application is a game developed in Qt4.<br />
<br />
==Connect to Tiny4412==<br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_2%278_SPI_Key_TFT&diff=1133Matrix - 2'8 SPI Key TFT2016-02-10T04:41:03Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Matrix-2'8 SPI_TFT.png|thumb|]]<br />
*<br />
==Features==<br />
* PCB dimension(mm):<br />
[[File:Matrix-2'8 SPI_TFT_PCB.png|frameless|400px|]]<br />
<br />
* Pin Description:<br />
{| class="wikitable"<br />
|-<br />
|Pin || Description<br />
|-<br />
|GND || Ground<br />
|-<br />
|5V || Supply Voltage 5V<br />
|- <br />
|LED_EN || Backlight<br />
|-<br />
|LCD_RESET || Reset<br />
|-<br />
|LCD_D/C || LCD Data/Command Selection<br />
|- <br />
|LCD_CS || LCD Chip Selection<br />
|-<br />
|SPICLK || SPI Clock<br />
|-<br />
|SPIMOSI || SPI MOSI<br />
|- <br />
|SPIMISO || SPI MISO<br />
|-<br />
|T_CS || Touch Chip Selection<br />
|-<br />
|T_IRQ || Touch Interrupt<br />
|- <br />
|}<br />
<br />
==Basic Device Operation==<br />
<br />
==Download Matrix Source Code==<br />
All the matrix modules' code samples are open source. They are maintained on GitHub - https://github.com/friendlyarm/matrix.git <br><br />
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br><br />
* The nanopi branch contains the matrix modules' code samples for the NanoPi<br />
* The nanopi2 branch contains the matrix modules' code samples for the NanoPi 2<br />
* the tiny4412 branch contains the matrix modules' code samples for the Tiny4412<br />
* the raspberrypi branch contains the matrix modules' code samples for the RaspberryPi<br />
<br />
Please follow the steps below to get the source code: <br><br />
Install the git utility on a PC running Ubuntu14.04<br />
<syntaxhighlight lang="bash"><br />
$ sudo apt-get install git<br />
</syntaxhighlight><br />
<br />
Clone the matrix code from GitHub<br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/matrix.git<br />
</syntaxhighlight><br />
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.<br />
<br />
==Connect to NanoPi 2==<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-2'8 SPI_Key_TFT to the NanoPi 2:<br><br />
[[File:Matrix-2'8_SPI_Key_TFT_nanopi2.jpg|frameless|600px|Matrix-2'8_SPI_Key_TFT_nanopi2]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-2'8_SPI_Key_TFT || NanoPi 2<br />
|-<br />
|GND || Pin6<br />
|-<br />
|5V || Pin2<br />
|- <br />
|LED_EN || Pin11<br />
|-<br />
|LCD_RESET || Pin7<br />
|-<br />
|LCD_D/C || Pin22<br />
|- <br />
|LCD_CS || Pin24<br />
|-<br />
|SPICLK || Pin23<br />
|-<br />
|SPIMOSI || Pin19<br />
|- <br />
|SPIMISO || Pin21<br />
|-<br />
|T_CS || Pin26<br />
|-<br />
|T_IRQ || Pin18<br />
|- <br />
|}<br />
<br />
===Compile Test Program===<br />
Please login the matrix hub and enter the nanopi2 branch<br />
<syntaxhighlight lang="bash"><br />
$ cd matrix<br />
$ git checkout nanopi2<br />
</syntaxhighlight><br />
<br />
Compile the Matrix code<br />
<syntaxhighlight lang="bash"><br />
$ make CROSS_COMPILE=arm-linux- clean<br />
$ make CROSS_COMPILE=arm-linux-<br />
$ make CROSS_COMPILE=arm-linux- install<br />
</syntaxhighlight><br />
Note: please make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br><br />
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory. The modules are under the "modules" directory.<br><br />
<br />
===Load Driver===<br />
Please insert a TF card which is flashed with Debian to a Linux host and mount its boot and rootfs sections.<br><br />
We assume the rootfs is mounted to /media/rootfs then please run the following commands to copy the driver, library and test program to the card.<br><br />
<syntaxhighlight lang="bash"><br />
$ cp modules /media/rootfs/ -r<br />
$ cp install/lib/* /media/rootfs/lib/ -d<br />
$ cp install/usr/bin/* /media/rootfs/usr/bin/<br />
</syntaxhighlight><br />
<br />
Insert this TF card to your NanoPi 2, power on and run the following commands to load the driver.<br><br />
<syntaxhighlight lang="bash"><br />
$ cd /modules<br />
$ insmod fbtft_device.ko name=matrix-st7789s gpios=dc:97,reset:60,cs:94<br />
$ insmod matrix_ads7846.ko<br />
</syntaxhighlight><br />
"fbtft_device" is the LCD's driver. "matrix_ads7846" is the touch driver. If they are successfully loaded the LCD will be cleared and reset.<br><br />
<br />
===Test LCD Display===<br />
Please run the following commands to set the display device to the Matrix-2'8_SPI_Key_TFT:<br />
<syntaxhighlight lang="bash"><br />
$ sudo FRAMEBUFFER=/dev/fb-st7789s startx &<br />
</syntaxhighlight><br />
"&" schedules the program to run background and you will see the following messages:<br><br />
<syntaxhighlight lang="bash"><br />
Log file: "/var/log/Xorg.2.log"<br />
</syntaxhighlight><br />
Here the message shows that the X window's DISPLAY value is 2<br><br />
<br />
===Calibrate Touch===<br />
Please run the following commands to calibrate touch:<br />
<syntaxhighlight lang="bash"><br />
$ DISPLAY=:2.0 xinput_calibrator<br />
</syntaxhighlight><br />
After you click on the four points highlighted on the LCD you will get calibration done and observe the following messages:<br />
<syntaxhighlight lang="bash"><br />
Section "InputClass" <br />
Identifier "calibration" <br />
MatchProduct "ADS7846 Touchscreen" <br />
Option "Calibration" "196 3825 3887 358" <br />
Option "SwapAxes" "0" <br />
EndSection <br />
</syntaxhighlight><br />
Save these calibration data to the "/usr/share/X11/xorg.conf.d/99-calibration.conf" file and reboot the system your touch will be ready to go.<br />
<br />
==Connect to NanoPi==<br />
===Preparations===<br />
Please install a Debian on a NanoPi and an appropriate cross compiler on a PC. Please refer to wiki:[[NanoPi/zh|NanoPi]] <br><br />
Compile a NanoPi kernel. Note: please use the kernel's source code from the nanopi-v4.1.y-matrix branch. <br><br />
<syntaxhighlight lang="bash"><br />
$ git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
$ cd linux-4.x.y<br />
$ git checkout nanopi-v4.1.y-matrix<br />
$ make nanopi_defconfig<br />
$ touch .scmversion<br />
$ make<br />
</syntaxhighlight><br />
<br />
===Hardware Connection===<br />
Please refer to the following connection diagram to connect the Matrix-2'8 SPI_TFT to the NanoPi <br><br />
[[File:Matrix-2'8 SPI_TFT_nanopi.jpg|frameless|600px|Matrix-2'8 SPI_TFT_nanopi]]<br />
<br />
Connection Details:<br />
{| class="wikitable"<br />
|-<br />
|Matrix-2'8 SPI_TFT || NanoPi<br />
|-<br />
| || <br />
|-<br />
|}<br />
<br />
===Load Driver===<br />
Power on the NanoPi and run the following command in Debian's terminal to load drivers:<br />
<syntaxhighlight lang="bash"><br />
$ modprobe fbtft_device name=matrix-spi_tft gpios=dc:161,reset:162,cs:163<br />
$ modprobe matrix_ads7846<br />
</syntaxhighlight><br />
The "fbtft_device" module is the driver for the st7789s chip and the "matrix_ads7846" module is the driver for the xpt2046 chip.<br />
<br />
===Install Package===<br />
Please run the following commands in Debian's terminal to install "qtembedded" and "matrix-tslib"<br />
<syntaxhighlight lang="bash"><br />
$ apt-get update<br />
$ apt-get install qtembedded<br />
$ apt-get install matrix-tslib <br />
</syntaxhighlight><br />
The "qtembedded" library is what qt applications rely on and the "matrix-tslib" library is what screen calibration relies on.<br />
<br />
===Run Test Program===<br />
Start Qt applications<br />
<syntaxhighlight lang="bash"><br />
$ . /usr/bin/matrix-setqt4env<br />
$ /usr/local/Trolltech/QtEmbedded-4.8.5-arm/examples/tetrix -qws<br />
</syntaxhighlight><br />
The matrix-setqt4env script sets the environmental variables which Qt and tslib rely on. If it is run on a platform for the first time a screen calibration GUI will be launched. Users need to go through a five-point calibration process to calibrate the screen.<br />
The tetrix application is a game developed in Qt4.<br />
<br />
==Connect to Tiny4412==<br />
<br />
==Connect to RaspberryPi==<br />
<br />
==Connect to Arduino==<br />
<br />
==Resources==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Matrix_-_0.96%27_128x64_OLED&diff=1132Matrix - 0.96' 128x64 OLED2016-02-10T04:40:30Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Oled.png|thumb|0.96inch 128x64 OLED]]<br />
This is a tiny single color OLED. Its dimension is 0.96". Its resolution is 128 x 64. It can display text and graphics.It is high contrast and low power consumption. This module is powered by 5V which is then converted to 3.3V to OLED. It communicates via SPI or I2C. Its signal level is 3.3V. By default it communicates via SPI. If you want to set it to I2C you can change the module's resistor configuration.<br />
<br />
==Features==<br />
* Tiny <br />
* High contrast, low power consumption<br />
* SPI/I2C<br />
* 2.54mm spacing pin header<br />
<br />
==How To==<br />
===Connection===<br />
*Connect to Tiny4412 SDK (1506)<br />
::GND: Gound<br />
::VCC: 5V<br />
::CLK: SPI CLK<br />
::MOSI: SPI MOSI<br />
::RES: GPIO PIN1<br />
::DC: GPIO PIN2<br />
::CS: SPI CS<br />
<br />
===Code Sample in C under Linux===<br />
<syntaxhighlight lang="c"><br />
#include <stdio.h><br />
#include "libfahw.h"<br />
<br />
int display(int x, int y, char* str)<br />
{<br />
int devFD;<br />
if ((devFD = OLEDInit(TINY4412_GPIO_PIN1, TINY4412_GPIO_PIN2)) == -1) {<br />
printf("Fail to init OLED\n");<br />
return -1;<br />
}<br />
// Char bitmap: 8x16<br />
OLEDDisp8x16Str(devFD, x, y, str);<br />
OLEDDeInit(devFD);<br />
return 0;<br />
}<br />
<br />
int main(int argc, char *argv[]) {<br />
display(0, 0, "1234567890");<br />
display(0, 16, "ABCDEFGHIJK");<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
<br />
===Compile and Run===<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/fa-hardware.git<br />
cd fa-hardware<br />
cd demo<br />
cd matrix-0.96inch_128x64_oled<br />
make<br />
</syntaxhighlight><br />
Copy your compiled bin to your board and you are ready to go.<br />
<br />
==Resources==</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=NanoPi_2_Fire&diff=1131NanoPi 2 Fire2016-02-10T04:39:36Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:NanoPi 2 Fire-01B.jpg|thumb|Overview]]<br />
[[File:NanoPi 2 Fire-A01.jpg|thumb|Front]]<br />
[[File:NanoPi 2 Fire-B01.jpg|thumb|Back]]<br />
* The NanoPi 2 Fire is a high performance ARM Board developed by FriendlyARM for Hobbysts, Makers and Hackers for IOT projects. It features Samsung's Cortex-A9 Quad Core S5P4418@1.4GHz SoC and 1G 32bit DDR3 RAM. It has a Gbps Ethernet port. It boots Android and Debian from a TF card. It integrates an HDMI and LCD interface. Its adoption of the Raspberry Pi's GPIO pin header makes it compatible with both Raspberry Pi's external GPIO modules and Arduino's shield boards. Its PCB dimension is 75 x 40 mm.<br />
<br />
==Features==<br />
* CPU: S5P4418, 1.4GHz<br />
* RAM: 1GB DDR3<br />
* Connectivity: Gbps Ethernet port<br />
* PMU Power Management: AXP228, support software power-off, sleep and wakeup functions<br />
* USB 2.0 Type A x 1<br />
* Debug Serial Port/UART0 x 1<br />
* microSD Slot x 1<br />
* microUSB x 1: for data transmission and power input<br />
* LCD Interface: 0.5 mm pitch SMT FPC seat, for full-color LCD (RGB: 8-8-8)<br />
* HDMI: HDMI 1.4A, Type-A, 1080P60<br />
* DVP Camera Interface: 0.5mm spacing FPC socket. It includes ITU-R BT 601/656 8-bit, I2C and IO<br />
* GPIO: 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, PWM, IO etc<br />
* Button: Power Button x 1, Reset Button x 1<br />
* LED: LED for Power Indication x 1, System LED x 1<br />
* PCB Dimension: 75 x 40mm<br />
* Power: DC 5V/2A<br />
* OS: Android, Debian<br />
<br />
==Diagram, Layout and Dimension==<br />
===Layout===<br />
[[File:NanoPi-2-Fire-1512B-IF.png |thumb|300px|NanoPi 2 Fire Layout]]<br />
<br />
* '''GPIO Pin Spec'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name ||Pin# || Name <br />
|-<br />
|1 || SYS_3.3V ||2 || VDD_5V<br />
|-<br />
|3 || I2C0_SDA ||4 || VDD_5V<br />
|- <br />
|5 || I2C0_SCL ||6 || DGND<br />
|-<br />
|7 || GPIOD8/PPM ||8 || UART3_TXD/GPIOD21<br />
|-<br />
|9 || DGND ||10 || UART3_RXD/GPIOD17 <br />
|-<br />
|11 || UART4_TX/GPIOB29 ||12 || GPIOD1/PWM0<br />
|-<br />
|13 || GPIOB30 ||14 || DGND<br />
|-<br />
|15 || GPIOB31 ||16 || GPIOC14/PWM2<br />
|-<br />
|17 || SYS_3.3V ||18 || GPIOB27<br />
|-<br />
|19 || SPI0_MOSI/GPIOC31 ||20 || DGND<br />
|-<br />
|21 || SPI0_MISO/GPIOD0 ||22 || UART4_RX/GPIOB28<br />
|-<br />
|23 || SPI0_CLK/GPIOC29 ||24 || SPI0_CS/GPIOC30<br />
|-<br />
|25 || DGND ||26 || GPIOB26<br />
|-<br />
|27 || I2C1_SDA ||28 || I2C1_SCL<br />
|-<br />
|29 || GPIOC8 ||30 || DGND<br />
|-<br />
|31 || GPIOC8 ||32 || GPIOC28<br />
|-<br />
|33 || GPIOC13/PWM1 ||34 || DGND<br />
|-<br />
|35 || SPI2_MISO/GPIOC11 ||36 || SPI2_CS/GPIOC10<br />
|-<br />
|37 || AliveGPIO3 ||38 || SPI2_MOSI/GPIOC12<br />
|-<br />
|39 || DGND ||40 || SPI2_CLK/GPIOC9<br />
|}<br />
<br />
<br />
* '''Debug Port(UART0)'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1 || DGND <br />
|-<br />
|2 || VDD_5V <br />
|- <br />
|3 || UART_TXD0 <br />
|-<br />
|4 || UART_RXD0 <br />
|}<br />
<br />
*''' DVP Camera Interface Pin Spec'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1, 2 || SYS_3.3V<br />
|-<br />
|7,9,13,15,24 || DGND<br />
|-<br />
|3 || I2C0_SCL <br />
|- <br />
|4 || I2C0_SDA <br />
|-<br />
|5 || GPIOB14 <br />
|-<br />
|6 || GPIOB16<br />
|-<br />
|8,10 || NC<br />
|-<br />
|11 || VSYNC<br />
|-<br />
|12 || HREF<br />
|-<br />
|14 || PCLK<br />
|-<br />
|16-23 || Data bit7-0<br />
|}<br />
<br />
* '''RGB LCD Interface Pin Spec'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name || Description <br />
|-<br />
|1, 2 || VDD_5V || 5V output, LCD power<br />
|-<br />
|11,20,29, 37,38,39,40, 45|| DGND || ground<br />
|-<br />
|3-10 || Blue LSB to MSB || RGB Blue<br />
|- <br />
|12-19 || Green LSB to MSB || RGB Green<br />
|-<br />
|21-28 || Red LSB to MSB || RGB Red<br />
|-<br />
|30 || GPIOB25 || available for users<br />
|-<br />
|31 || GPIOC15 || occupied by FriendlyARM one wire technology to recognize LCD models and control backlight and implement resistive touch, not applicable for users<br />
|- <br />
|32 || XnRSTOUT Form CPU || low when system is reset<br />
|-<br />
|33 || VDEN || signal the external LCD that data is valid on the data bus<br />
|-<br />
|34 || VSYNC || vertical synchronization <br />
|-<br />
|35 || HSYNC || horizontal synchronization<br />
|-<br />
|36 || LCDCLK || LCD clock, Pixel frequency<br />
|-<br />
|41 || I2C2_SCL || I2C2 clock signal, for capacitive touch's data transmission <br />
|-<br />
|42 || I2C2_SDA || I2C2 data signal, for capacitive touch's data transmission<br />
|-<br />
|43 || GPIOC16 || interrupt pin for capacitive touch, used with I2C2<br />
|-<br />
|44 || NC || not connected<br />
|}<br />
:'''Note'''<br />
::#SYS_3.3V: 3.3V power output<br />
::#VDD_5V: 5V power input/output. When the external device’s power is greater than the MicroUSB’s the external device is charging the board otherwise the board powers the external device. The input range is 4.7V ~ 5.6V<br />
::#For more details please refer to the document:[http://wiki.friendlyarm.com/wiki/images/9/97/NanoPi2_Fire_1512B_Schematic.pdf NanoPi2_Fire_1512B_Schematic.pdf]<br />
<br />
===Board Dimension===<br />
[[File:NanoPi2_Fire_1512B_Dimensions.png|frameless|500px|NanoPi 2 Fire Dimensions]]<br />
<br />
::For more details please refer to the document:[http://wiki.friendlyarm.com/wiki/images/b/b4/NanoPi2_Fire_1512B_Dimensions%28dxf%29.zip NanoPi2_Fire_1512B_Dimensions(dxf).zip]<br />
<br />
==Get Started==<br />
===Essentials You Need===<br />
Before play with your NanoPi 2 Fire please get the following items ready<br />
* NanoPi 2 Fire<br />
* microSD Card/TFCard: Class 10 or Above, minimum 8GB SDHC<br />
* microUSB power. A 5V/2A power is a must<br />
* HDMI monitor or LCD <br />
* USB keyboard and mouse<br />
* A Host running Ubuntu 14.04 64 bit system<br />
<br />
===TF Card We Tested===<br />
To make your NanoPi 2 Fire boot and run fast we highly recommand you use a Class10 8GB SDHC TF card or a better one. The following cards are what we used in all our test cases presented here:<br />
*SanDisk TF 8G Class10 Micro/SD TF card:<br />
[[File:SanDisk MicroSD.png|frameless|100px|SanDisk MicroSD 8G]]<br />
*SanDisk TF128G MicroSDXC TF 128G Class10 48MB/S:<br />
[[File:SanDisk MicroSD-01.png|frameless|100px|SanDisk MicroSD 128G]]<br />
*川宇 8G C10 High Speed class10 micro SD card:<br />
[[File:SanDisk MicroSD-02.png|frameless|100px|chuanyu MicroSD 8G]]<br />
<br />
===Make an Installation MicroSD Card===<br />
====Under Windows====<br />
Please get the following files from here:[http://wiki.friendlyarm.com/wiki/nanopi2/download/ download link] to download image files: <br /><br />
<br />
::{| class="wikitable"<br />
|-<br />
|colspan=2|For LCD or HDMI output please use the following files:<br />
|-<br />
|nanopi2-debian-sd4g.img.zip || Debian image files <br />
|-<br />
|nanopi2-android-sd4g.img.zip || Android image files <br />
|-<br />
|colspan=2|Flash Utility: <br />
|-<br />
|win32diskimager.rar || Windows utility. Under Linux users can use "dd"<br />
|- <br />
|}<br />
<br />
* Please uncompress these files. Insert an SD card(at least 4G) to a Windows PC, run the win32diskimager utility as administrator,On the utility's main window select your SD card's drive and the image files and click on "write" to start flashing the SD card.<br />
* Please insert this card to your NanoPi 2 Fire and power on (with a 5V/2A power source). If the blue LED and green LED are blinking this indicates your NanoPi 2 Fire is successfully booted.<br /><br />
<br />
====Under Linux Desktop====<br />
*1) Insert your microSD card to your host running Ubuntu and check your SD card's device name<br />
<syntaxhighlight lang="bash"><br />
dmesg | tail<br />
</syntaxhighlight><br />
Search the messages output by "dmesg" for similar words like "sdc: sdc1 sdc2". If you can find them it means your SD card is recognized as "/dev/sdc". Or you can check that by commanding "cat /proc/partitions".<br />
<br />
*2) Download Firmware Package<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/sd-fuse_nanopi2.git<br />
cd sd-fuse_nanopi2<br />
</syntaxhighlight><br />
<br />
*3) Flash Android Firmware to MicroSD Card<br />
<syntaxhighlight lang="bash"><br />
su<br />
./fusing.sh /dev/sdx<br />
</syntaxhighlight><br />
(Note: you need to replace "/dev/sdx" with the device name in your system) <br />
When you do “git clone” you have to hit “Y” within 10 seconds after it prompts you to download image files otherwise you will miss the download.<br />
<br />
*4) Flash Debian Firmware to MicroSD Card<br />
<syntaxhighlight lang="bash"><br />
./fusing.sh /dev/sdx debian<br />
</syntaxhighlight><br />
<br />
====LCD/HDMI Resolution====<br />
When system boots our uboot will check whether it is connected to an LCD. If it recognizes an LCD it will configure its resolution. By default our uboot configures the display to HDMI 720P.<br/><br />
If you want to reset the LCD resolution you can modify file "arch/arm/plat-s5p4418/nanopi2/lcds.c" in the kernel and recompile it.<br/><br />
If your NanoPi 2 connects an HDMI monitor and it runs Android it will automatically set the resolution to an appropriate HDMI mode by checking "EDID". If your NanoPi 2 connects an HDMI monitor and it runs Debian by default it will set the resolution to HDMI 720P and in this case you can set it to 1080P by modifying your kernel's configuration.<br/><br />
<br />
===Update Image Files in MicroSD Card From PC Host===<br />
If you want to make some changes to the image files in your MicroSD card please follow steps below otherwise you can skip this section.<br/><br />
Please insert your MicroSD card to a PC host running LINUX, mount the boot and rootfs sections of the SD card and follow the steps below:<br/><br />
<br />
1) If you want to change your kernel command line parameters you can do it via the fw_setevn utility under "sd-fuse_nanopi2/tools"<br /><br />
Check the current Command Line:<br />
<syntaxhighlight lang="bash"><br />
cd sd-fuse_nanopi2/tools<br />
./fw_printenv /dev/sdc | grep bootargs<br />
</syntaxhighlight><br />
Android 5.1.1_r6 starts SELinux. By default it is enforcing. You can change it this way:<br />
<syntaxhighlight lang="bash"><br />
./fw_setenv /dev/sdc bootargs XXX androidboot.selinux=permissive<br />
</syntaxhighlight><br />
This will set it to "permissive". The "XXX" stands for the original bootargs' value.<br /><br />
<br />
2) Update Kernel <br /><br />
Our customized uboot will check the LCD type when it boots.For a non-Android OS If it recognizes an LCD connected to the NanoPi 2 Fire it will load "uImage" from "boot" otherwise it will load "uImage.hdmi"<br /><br />
However for Android these two files don't make any differences for whatever display device it detects. You can use your generated uImage to replace the existing one under "boot".<br /><br />
For Debian if your generated kernel is for LCD you need to replace the existing uImage or if your kernel is for HDMI you need to replace the existing uImage.hdmi .<br /><br />
<br />
===Run Android or Debian===<br />
Insert a MicroSD card with Android image files to your NanoPi 2 Fire, connect the NanoPi 2 Fire to an HDMI monitor and a 5V/2A power source the NanoPi 2 Fire will be automatically powered on. If you can see the blue LED flashing it means your board is working and you will see Android loading on the HDMI monitor. If at the same time you connect your NanoPi 2 Fire to a PC running Ubuntu and Minicom via a serial cable you will see system messages output to the PC’s minicom terminal.<br />
Under Debian the password for "root" is "fa".<br />
<br />
===Login Debian via VNC or SSH===<br />
If your NanoPi 2 Fire is not connected to a display device you can download and install a "VNC Viewer" on your PC or mobile phone and login the NanoPi 2 Fire via VNC. Its default password is "fa123456". Here is a screenshot which shows how it looks like when users login the NanoPi 2 Fire from an iPhone via VNC:<br /><br />
[[File:iphone6-vnc-nanopi2.png|frameless|400px|VNC to NanoPi2]]<br />
<br /><br />
You can login via "SSH -l root 192.168.8.1" too and the default password for "root" is "fa".<br />
<br /><br />
<br />
==Play with Debian==<br />
===Ethernet Connection===<br />
If the NanoPi 2 Fire is connected to a network via Ethernet before it is powered on it will automatically obtain an IP after it is powered on. If it is not connected via Ethernet or its DHCP is not activated obtaining an IP will fail and system will hang on for about 15 to 60 seconds.<br />
* 1) Setup MAC Address<br />
The NanoPi 2 Fire by default doesn't have a valid MAC address. If the board connects a network successfully it will automatically generates a random MAC in "/etc/network/interfaces.d/eth0". Users can change it to a self-defined valid one:<br />
<syntaxhighlight lang="bash"><br />
vi /etc/network/interfaces.d/eth0<br />
</syntaxhighlight><br />
Here is the content of a sample configuration file:<br />
<syntaxhighlight lang="bash"><br />
auto eth0<br />
allow-hotplug eth0<br />
iface eth0 inet dhcp<br />
hwaddress 76:92:d4:85:f3:0f<br />
</syntaxhighlight><br />
The "hwaddress" specifies the MAC address. Here the "76:92:d4:85:f3:0f" is a random MAC. We suggest users change it to a valid one<br /><br />
Note: when you reset the MAC please make sure your MAC meets IEEE's definition otherwise it will cause unexpected issues.<br/><br />
After you make your change, save, exit and reboot your board or run the following commands to restart the network:<br />
<syntaxhighlight lang="bash"><br />
systemctl restart networking<br />
</syntaxhighlight><br />
<br />
===Install Debian Packages===<br />
We provide a Debian jessie image. You can install Jessie's packages by commanding "apt-get". If this is your first installation you need to update the package list by running the following command:<br />
<syntaxhighlight lang="bash"><br />
apt-get update<br />
</syntaxhighlight><br />
You can install your preferred packages. For example if you want to install an FTP server you can do this:<br />
<syntaxhighlight lang="bash"><br />
apt-get install vsftpd<br />
</syntaxhighlight><br />
Note: you can change your download server by editting "/etc/apt/sources.list". You can get a complete server list from [http://www.debian.org/mirror/list]. You need to select the one with "armhf".<br />
<br />
==Make Your Own OS Image==<br />
<br />
===Setup Development Environment===<br />
<br />
===Install Cross Compiler===<br />
Please download the compiler package:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/prebuilts.git<br />
sudo mkdir -p /opt/FriendlyARM/toolchain<br />
sudo tar xf prebuilts/gcc-x64/arm-cortexa9-linux-gnueabihf-4.9.3.tar.xz -C /opt/FriendlyARM/toolchain/<br />
</syntaxhighlight><br />
<br />
Then add the compiler's directory to "PATH" by appending the following lines in "~/.bashrc":<br />
<syntaxhighlight lang="bash"><br />
export PATH=/opt/FriendlyARM/toolchain/4.9.3/bin:$PATH<br />
export GCC_COLORS=auto<br />
</syntaxhighlight><br />
<br />
Execute "~/.bashrc" to make the changes into effect. Please note that there is a space after ".":<br />
<syntaxhighlight lang="bash"><br />
. ~/.bashrc<br />
</syntaxhighlight><br />
<br />
This compiler is a 64-bit one therefore it cannot be run on a 32-bit LINUX. After the compiler is installed you can verify it by running the following commands:<br />
<syntaxhighlight lang="bash"><br />
arm-linux-gcc -v<br />
Using built-in specs.<br />
COLLECT_GCC=arm-linux-gcc<br />
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/4.9.3/libexec/gcc/arm-cortexa9-linux-gnueabihf/4.9.3/lto-wrapper<br />
Target: arm-cortexa9-linux-gnueabihf<br />
Configured with: /work/toolchain/build/src/gcc-4.9.3/configure --build=x86_64-build_pc-linux-gnu<br />
--host=x86_64-build_pc-linux-gnu --target=arm-cortexa9-linux-gnueabihf --prefix=/opt/FriendlyARM/toolchain/4.9.3<br />
--with-sysroot=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-languages=c,c++<br />
--with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3 --with-float=hard<br />
...<br />
Thread model: posix<br />
gcc version 4.9.3 (ctng-1.21.0-229g-FA)<br />
</syntaxhighlight><br />
<br />
===Compile U-Boot===<br />
Download the U-Boot source code and compile it. Please note the github's branch is nanopi2-lollipop-mr1:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/uboot_nanopi2.git<br />
cd uboot_nanopi2<br />
git checkout nanopi2-lollipop-mr1<br />
make s5p4418_nanopi2_config<br />
make CROSS_COMPILE=arm-linux-<br />
</syntaxhighlight><br />
<br />
After your compilation succeeds a u-boot.bin will be generated. If you want to test it please flash it to your installation MicroSD card via fastboot. Here is how you can do it:<br /><br />
1) On your PC host please run "sudo apt-get install android-tools-fastboot" to install the fastboot utility<br /><br />
2) Connect your NanoPi 2 Fire to your PC host via a serial cable (e.g. PSU-ONECOME). Press the enter key within two seconds right after you power on your NanoPi 2 Fire and you will enter uboot's command line mode:<br /><br />
3) After type "fastboot" and press "enter" you will enter the fastboot mode:<br /><br />
4) Connect your NanoPi 2 Fire to this PC host via a microUSB cable and type the following command to flash the u-boot.bin:<br /><br />
<syntaxhighlight lang="bash"><br />
fastboot flash bootloader u-boot.bin<br />
</syntaxhighlight><br />
<br /><br />
Warning: you cannot update this MicroSD card by commanding "dd". This command which will cause trouble when booting the NanoPi 2 Fire.<br /><br />
<br />
===Prepare mkimage===<br />
You need the mkimage utility to compile a U-Boot source code package. Please make sure this utility works well on your host before you start compiling a uImage.<br /><br />
You can install this utility by either commanding "sudo apt-get install u-boot-tools" or following the commands below:<br />
<syntaxhighlight lang="bash"><br />
cd uboot_nanopi2<br />
make CROSS_COMPILE=arm-linux- tools<br />
sudo mkdir -p /usr/local/sbin && sudo cp -v tools/mkimage /usr/local/sbin<br />
</syntaxhighlight><br />
<br />
===Compile Linux kernel===<br />
====Compile Kernel====<br />
* Download Kernel Source Code<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/linux-3.4.y.git<br />
cd linux-3.4.y<br />
git checkout nanopi2-lollipop-mr1<br />
</syntaxhighlight><br />
The NanoPi 2 Fire's kernel source code lies in the "nanopi2-lollipop-mr1" branch. <br />
* Compile Android Kernel<br />
<syntaxhighlight lang="bash"><br />
make nanopi2_android_defconfig<br />
touch .scmversion<br />
make uImage<br />
</syntaxhighlight><br />
* Compile Debian Kernel<br />
<syntaxhighlight lang="bash"><br />
make nanopi2_linux_defconfig<br />
touch .scmversion<br />
make uImage<br />
</syntaxhighlight><br />
After your compilation succeeds a uImage will be generated in the "arch/arm/boot/uImage" directory. This kernel is for HDMI. You can use it to replace the existing uImage.hdmi<br/><br />
If you want to generate a kernel for LCD you can do it this way:<br />
<syntaxhighlight lang="bash"><br />
touch .scmversion<br />
make nanopi2_linux_defconfig<br />
make menuconfig<br />
Device Drivers --><br />
Graphics support --><br />
Nexell Graphics --><br />
[*] LCD<br />
[ ] HDMI<br />
make uImage<br />
</syntaxhighlight><br />
After your compilation succeeds a uImage will be generated for HDMI. You can use it to replace the existing uImage.<br />
<br />
====Compile Kernel Modules====<br />
Android contains kernel modules which are in the "/lib/modules" directory in the system section. If you want to add your own modules to the kernel or you changed your kernel configurations you need to recompile these new modules.<br /><br />
Compile Original Kernel Modules:<br />
<syntaxhighlight lang="bash"><br />
cd linux-3.4.y<br />
make CROSS_COMPILE=arm-eabi- modules<br />
</syntaxhighlight><br />
Here we have two new modules and we can compile them by following the commands below:<br />
<syntaxhighlight lang="bash"><br />
cd /opt/FriendlyARM/s5p4418/android<br />
./vendor/friendly-arm/build/common/build-modules.sh<br />
</syntaxhighlight><br />
The "/opt/FriendlyARM/s5p4418/android" directory points to the top directory of Android source code. You can get more details by specifying option "-h".<br /><br />
After your compilation succeeds new modules will be generated<br />
<br />
===Compile Android===<br />
<br />
* Install Cross Compiler<br />
We recommend installing 64 bit Ubuntu 14.04 on your PC host.<br />
<syntaxhighlight lang="bash"><br />
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip<br />
sudo apt-get install flex libncurses5-dev zlib1g-dev gawk minicom<br />
</syntaxhighlight><br />
For more details please refer to https://source.android.com/source/initializing.html 。<br />
<br />
* Download Source Code<br />
You need to use repo to get the Android source code. Please refer to https://source.android.com/source/downloading.html 。<br />
<syntaxhighlight lang="bash"><br />
mkdir android && cd android<br />
repo init -u https://github.com/friendlyarm/android_manifest.git -b nanopi2-lollipop-mr1<br />
repo sync<br />
</syntaxhighlight><br />
The "android" directory is the working directory. <br />
<br />
* Compile System Package<br />
<syntaxhighlight lang="bash"><br />
source build/envsetup.sh<br />
lunch aosp_nanopi2-userdebug<br />
make -j8<br />
</syntaxhighlight><br />
After your compilation succeeds an image will be generated in the "out/target/product/nanopi2/" directory.<br />
<br />
==Connect NanoPi 2 Fire to External Modules==<br />
===Connect NanoPi 2 Fire to USB Camera(FA-CAM202)===<br />
*In this usecase the NanoPi 2 Fire runs Debian. If you connect your NanoPi 2 Fire to our LCD after Debain is fully loaded please click on "other"-->"xawtv9" on the left bottom of the GUI and the USB Camera application will be started. After enter "welcome to xawtv!" please click on "OK" to start exploring.<br />
[[File:USB-camera-nanopi2.png|frameless|500px|USB camera]]<br />
[[File:USB-camera-nanopi2-01.png|frameless|500px|USB camera-01]]<br />
===Connect NanoPi 2 Fire to CMOS 5M-Pixel Camera===<br />
*In this usecase the NanoPi 2 Fire runs Android5.1. If you connect your NanoPi 2 Fire to our LCD after Debain is fully loaded please click on the "Camera" icon the application will be started. <br />
[[File:CMOS-camera-nanopi2.png|frameless|500px|CMOS camera]]<br />
===Use OpenCV to Access USB Camera===<br />
* The full name of "OpenCV" is Open Source Computer Vision Library and it is a cross platform vision library.<br />
* When the NanoPi 2 runs Debian users can use OpenCV APIs to access a USB Camera device<br><br />
Here is a guideline on how to use OpenCV with C++ on the NanoPi 2 Fire<br> <br />
1. Preparations<br />
<syntaxhighlight lang="bash"><br />
---Firstly you need to make sure your NanoPi 2 Fire is connected to the internet. <br />
Login your NanoPi 2 Fire via a serial terminal or SSH. After login please type your username(root) and password(fa):<br />
---Run the following commands:<br />
</syntaxhighlight><br />
<br><br />
<syntaxhighlight lang="bash"><br />
#apt-get update<br />
(The OS images we provide for the NanoPi 2 Fire by default have the vi utility. However we suggest you install the vim utility)<br />
#apt-get install vim<br />
#apt-get install libcv-dev libopencv-dev<br />
</syntaxhighlight><br />
<br />
2. Make sure your USB camera works with the NanoPi 2 Fire. You can test your camera with NanoPi 2 Fire's camera utility.<br><br />
<br />
3. Check your camera device:<br />
<syntaxhighlight lang="bash"><br />
#ls /dev/video + "Tab" key (This lists available USB camera devices. In our test case video9 was available and video0 to video8 were occupied)<br />
</syntaxhighlight><br />
<br />
4. OpenCV's code sample:<br />
<syntaxhighlight lang="bash"><br />
#cd /home/fa<br />
#vim test.cpp<br />
</syntaxhighlight><br />
<br><br />
<syntaxhighlight lang="bash"><br />
#include "opencv2/opencv.hpp"<br />
<br />
using namespace cv;<br />
<br />
int main(int, char**)<br />
{<br />
VideoCapture cap(0); // open the default camera<br />
if(!cap.isOpened()) // check if we succeeded<br />
return -1;<br />
<br />
Mat edges;<br />
namedWindow("edges",1);<br />
for(;;)<br />
{<br />
Mat frame;<br />
cap >> frame; // get a new frame from camera<br />
cvtColor(frame, edges, CV_BGR2GRAY);<br />
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);<br />
Canny(edges, edges, 0, 30, 3);<br />
imshow("edges", edges);<br />
if(waitKey(30) >= 0) break;<br />
}<br />
// the camera will be deinitialized automatically in VideoCapture destructor<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
Compile the code sample:<br />
<syntaxhighlight lang="bash"><br />
#g++ test.cpp -o test -lopencv_core -lopencv_highgui -lopencv_imgproc<br />
</syntaxhighlight><br />
<br />
If it is compiled successfully a "test" executable will be generated:<br><br />
5. Note: the NanoPi 2 Fire has nine video devices. However this OpenCV's code sample defines a maximum of 8 cameras can be accessed therefore one video needs to be removed. Here we removed video0<br />
<syntaxhighlight lang="bash"><br />
#rm /dev/video0<br />
#mv /dev/video9 /dev/video0<br />
</syntaxhighlight><br />
<br />
6. Connect NanoPi 2 Fire to USB Keyboard & Run the Following Command:<br />
<syntaxhighlight lang="bash"><br />
#./test<br />
</syntaxhighlight><br />
<br />
This is what you expect to observe:<br><br />
[[File:OpenCV-Fire.png|frameless|600px|OpenCV-Fire]]<br />
<br />
==Extend NanoPi 2 Fire's TF Card Section==<br />
===For Debian===<br />
* Please run the following commands on a PC host's terminal:<br />
<syntaxhighlight lang="bash"><br />
sudo umount /dev/sdx? <br />
sudo parted /dev/sdx unit % resizepart 2 100 unit MB print<br />
sudo resize2fs -f /dev/sdx2<br />
</syntaxhighlight><br />
<br />
===For Android===<br />
* Please run the following commands on a PC host's terminal:<br />
<syntaxhighlight lang="bash"><br />
sudo umount /dev/sdx?<br />
sudo parted /dev/sdx unit % resizepart 4 100 resizepart 7 100 unit MB print<br />
sudo resize2fs -f /dev/sdx7<br />
</syntaxhighlight><br />
(Note: you need to replace "/dev/sdx" with the device name in your system)<br />
<br />
==More OS Support==<br />
===Ubuntu-Mate===<br />
* Please go to this link [http://pan.baidu.com/s/1boiCWWJ] to download the image files<br />
* Please uncompress it and flash the image file to a TF card with win32diskimager under Windows<br />
* After it is done you can boot your NanoPi 2 with this card<br />
* Login name: "root" or "fa", Password: fa<br />
Note: this UbuntuMate works with both NanoPi 2 and NanoPi 2 Fire<br />
<br />
===Ubuntu-Core===<br />
* Please go to this link [http://pan.baidu.com/s/1hrbFm0s] to download the image files<br />
* Please uncompress it and flash the image file to a TF card with win32diskimager under Windows<br />
* After it is done you can boot your NanoPi 2 Fire with this card<br />
* Login name: "root" or "fa", Password: fa<br />
Note: this Ubuntu-Core is a basic verson which has support for Ethernet and SSH. If you need other functions and modules you can add what you need by apt.<br />
<br />
===Kali===<br />
* Please go to this link [http://pan.baidu.com/s/1qXf2JVm] to download the image files<br />
* Please prepare an 8G High Speed MicroSD card, insert it to a Linux host and do "sudo fdisk -l" to check its device name, i.e. "/dev/sd*"<br />
* Please copy the image files to the card by running the following commands as root:<br />
<syntaxhighlight lang="bash"><br />
xzcat kali-2.0-nanopi2.img.xz | dd of=<YOURDEVICE> bs=1m<br />
</syntaxhighlight><br />
* After it is done you can boot your NanoPi 2 Fire with this card.<br />
Note: this is offered by Kali and FriendlyARM doesn't provide technical support for it.<br />
<br />
===Deepin15 ARM===<br />
* Please go to this link [http://cdimage.deepin.com/armhf/15/beta1.0/] to download the image files<br />
* Please uncompress the file and you will get a 16g.img file which is the image file for MicroSD card.<br />
<syntaxhighlight lang="bash"><br />
tar -xf deepin15_nanopi2_armhf_16g.tar.gz<br />
</syntaxhighlight><br />
* Please prepare an 16G High Speed MicroSD card, insert it to a Linux host and do "sudo fdisk -l" to check its device name, i.e. "/dev/sd*"<br />
* Please flash the image files to the card by running the following command as root(in our case our card was recognized as "/dev/sdc"):<br />
<syntaxhighlight lang="bash"><br />
sudo dd if=16g.img of=/dev/sdc <br />
</syntaxhighlight><br />
<br />
(This process takes a while which can be up to one hour)<br />
<br />
* After it is done you can boot your NanoPi 2 Fire with this card<br />
<br />
<br />
Notes:<br><br />
1. The password for login name "deepin" is "deepin". The password for login name "root" is "admin".<br><br />
2. The initial booting of Deepin15 takes a relative long time for it generates some configuration files.<br><br />
3. If WIFI is activated in your system booting might take longer. In this case please wait for the sound and wifi icons on the right bottom of the GUI to appear before you start any action.<br><br />
<syntaxhighlight lang="bash"><br />
ARM code: http://packages.deepin.com/armhf/<br><br />
<br />
NanoPi 2 Image: http://cdimage.deepin.com/armhf/15/beta1.0/<br><br />
<br />
NanoPi 2 Image Installation Instruction; http://bbs.deepin.org/forum.php?mod=viewthread&tid=36670<br><br />
<br />
Forum for Migrating Deepin15 to ARM: http://bbs.deepin.org/<br><br />
<br />
</syntaxhighlight><br />
Note: this is offered by the Deepin15 team and FriendlyARM doesn't provide technical support for it.<br />
<br />
==Resources==<br />
* SEC_Users_Manual_S5P4418_Users_Manual_Preliminary([http://wiki.friendlyarm.com/wiki/index.php/File:SEC_Users_Manual_S5P4418_Users_Manual_Preliminary_Ver.0.10.pdf])<br />
* Schematic ([http://wiki.friendlyarm.com/wiki/images/9/97/NanoPi2_Fire_1512B_Schematic.pdf NanoPi2_Fire_1512B_Schematic.pdf])<br />
* Dimensions ([http://wiki.friendlyarm.com/wiki/images/b/b4/NanoPi2_Fire_1512B_Dimensions%28dxf%29.zip NanoPi2_Fire_1512B_Dimensions(dxf).zip])<br />
* SOC Datasheet ([http://wiki.friendlyarm.com/wiki/images/a/a7/Pi2_SOC_DS_0.1.pdf Pi2_SOC_DS_0.1.pdf])<br />
<br />
==External Links==<br />
* [http://www.friendlyarm.com/Forum/viewtopic.php?f=17&t=73 How to setup Qt development environment for NanoPi 2 & NanoPi 2 Fire]<br />
<br />
==Update Log==<br />
===Jan-29-2016===<br />
* Add 9 More OS Support<br />
<br />
===Feb-02-2016===<br />
* Add 9.1 Ubuntu-Mate<br />
* Add 9.2 Ubuntu-Core<br />
* Add 11 External Links</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=NanoPi_2&diff=1130NanoPi 22016-02-10T04:38:54Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:NanoPi 2-01B.jpg|thumb|Overview]]<br />
[[File:NanoPi 2-A01.png|thumb|Front]]<br />
[[File:NanoPi 2-B01.png|thumb|Back]]<br />
* The NanoPi2 is a high performance ARM Board developed by FriendlyARM for Hobbysts, Makers and Hackers for IOT projects. It features Samsung’s Cortex-A9 Quad Core S5P4418@1.4GHz SoC and 1G 32bit DDR3 RAM. It has built-in WiFi and Bluetooth which supports 802.11 b/g/n and Bluetooth 4.0. It boots Android and Debian from a TF card. It integrates an HDMI and LCD interface. Its adoption of the Raspberry Pi’s GPIO pin header makes it compatible with both Raspberry Pi’s external GPIO modules and Arduino’s shield boards. Its PCB dimension is 75 x 40 mm.<br />
<br />
==Features==<br />
* CPU: S5P4418, 1.4GHz<br />
* RAM: 1GB DDR3<br />
* Built in SDIO WiFi and Bluetooth module<br />
* USB 2.0 Type A x 1<br />
* Debug Serial Port/UART0 x 1<br />
* microSD Slot x 2<br />
* microUSB x 1: for data transmission and power input<br />
* LCD Interface: 0.5 mm pitch SMT FPC seat, for full-color LCD (RGB: 8-8-8)<br />
* HDMI: HDMI 1.4A, Type-A, 1080P60<br />
* DVP Camera Interface: 0.5mm spacing FPC socket. It includes ITU-R BT 601/656 8-bit, I2C and IO<br />
* GPIO: 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, IO etc<br />
* Button: User Button x 1, Reset Button x 1<br />
* LED: LED for Power Indication x 1, User LED x 1<br />
* PCB Dimension: 75 x 40mm<br />
* Power: DC 5V/2A<br />
* OS: Android, Debian<br />
[[File:NanoPi 2-B09.png|frameless|500px|compact]]<br><br />
[[File:NanoPi 2-B10.png|frameless|500px|compact with raspberry pi and beagleboard]]<br />
<br />
==Diagram, Layout and Dimension==<br />
===Layout===<br />
[[File:NanoPi-2-1507-IF.png |thumb|300px|NanoPi 2接口布局]]<br />
[[File:NanoPi-2-MicroSD.png |thumb|300px|NanoPi 2 MicroSD]]<br />
<br />
* '''GPIO Pin Spec'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name ||Pin# || Name <br />
|-<br />
|1 || VDD_SYS_3.3V ||2 || VDD_5V<br />
|-<br />
|3 || I2C0_SDA ||4 || VDD_5V<br />
|- <br />
|5 || I2C0_SCL ||6 || DGND<br />
|-<br />
|7 || UART4_RX/GPIOB28 ||8 || UART3_TXD/GPIOD21<br />
|-<br />
|9 || DGND ||10 || UART3_RXD/GPIOD17 <br />
|-<br />
|11 || UART4_TX/GPIOB29 ||12 || GPIOB26<br />
|-<br />
|13 || GPIOB30 ||14 || DGND<br />
|-<br />
|15 || GPIOB31 ||16 || PWM2/GPIOC14<br />
|-<br />
|17 || VDD_SYS_3.3V ||18 || GPIOB27<br />
|-<br />
|19 || SPI0_MOSI/GPIOC31 ||20 || DGND<br />
|-<br />
|21 || SPI0_MISO/GPIOD0 ||22 || PWM0/GPIOD1<br />
|-<br />
|23 || SPI0_CLK/GPIOC29 ||24 || SPI0_CS/GPIOC30<br />
|-<br />
|25 || DGND ||26 || PWM1/GPIOC13<br />
|-<br />
|27 || I2C1_SDA ||28 || I2C1_SCL<br />
|-<br />
|29 || GPIOC8 ||30 || DGND<br />
|-<br />
|31 || SPI2_CLK/GPIOC9 ||32 || GPIOC28<br />
|-<br />
|33 || SPI2_CS/GPIOC10 ||34 || DGND<br />
|-<br />
|35 || SPI2_MOSI/GPIOC12 ||36 || GPIOC7<br />
|-<br />
|37 || SPI2_MISO/GPIOC11 ||38 || ALIVEGPIO2<br />
|-<br />
|39 || DGND ||40 || ALIVEGPIO3<br />
|}<br />
<br />
* '''Debug Port CON1(UART0)'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1 || DGND <br />
|-<br />
|2 || VDD_5V <br />
|- <br />
|3 || TXD0 <br />
|-<br />
|4 || RXD0 <br />
|}<br />
*''' DVP Camera Interface Pin Spec'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1, 2 || VDD_SYS_3.3V<br />
|-<br />
|7,9,13,15,24 || DGND<br />
|-<br />
|3 || SCL0 <br />
|- <br />
|4 || SDA0 <br />
|-<br />
|5 || GPIOB14 <br />
|-<br />
|6 || GPIOB16<br />
|-<br />
|8,10 || NC<br />
|-<br />
|11 || VSYNC<br />
|-<br />
|12 || HREF<br />
|-<br />
|14 || PCLK<br />
|-<br />
|16-23 || Data bit7-0<br />
|}<br />
* '''RGB LCD Interface Pin Spec'''<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name || Description <br />
|-<br />
|1, 2 || VDD_5V || 5V output, LCD power<br />
|-<br />
|11,20,29, 37,38,39,40, 45|| DGND || ground<br />
|-<br />
|3-10 || Blue LSB to MSB || RGB Blue<br />
|- <br />
|12-19 || Green LSB to MSB || RGB Green<br />
|-<br />
|21-28 || Red LSB to MSB || RGB Red<br />
|-<br />
|30 || GPIOB25 || available for users<br />
|-<br />
|31 || GPIOC15 || occupied by FriendlyARM one wire technology to recognize LCD models and control backlight and implement resistive touch, not applicable for users<br />
|- <br />
|32 || XnRSTOUT Form CPU || low when system is reset<br />
|-<br />
|33 || VDEN || signal the external LCD that data is valid on the data bus<br />
|-<br />
|34 || VSYNC || vertical synchronization <br />
|-<br />
|35 || HSYNC || horizontal synchronization<br />
|-<br />
|36 || LCDCLK || LCD clock, Pixel frequency<br />
|-<br />
|41 || SCL2 || I2C2 clock signal, for capacitive touch's data transmission <br />
|-<br />
|42 || SDA2 || I2C2 data signal, for capacitive touch's data transmission<br />
|-<br />
|43 || GPIOC16 || interrupt pin for capacitive touch, used with I2C2<br />
|-<br />
|44 || NC || not connected<br />
|}<br />
:'''Note'''<br />
::#VDD_SYS_3.3V: 3.3V power output<br />
::#VDD_5V: 5V power input/output. When the external device’s power is greater than the MicroUSB’s the external device is charging the board otherwise the board powers the external device. The input range is 4.7V ~ 5.6V<br />
::#For more details please refer to the document:[http://wiki.friendlyarm.com/wiki/images/e/ec/NanoPi-2-1507-Schematic.pdf NanoPi-2-1507-Schematic.pdf]<br />
<br />
===Board Dimension===<br />
[[File:NanoPi-2-1507-Dimesion.png|frameless|500px|NanoPi 2 Dimension]]<br />
<br />
::For more details please refer to the document:[http://wiki.friendlyarm.com/wiki/images/4/45/NanoPi-2-1507-Dimesions%28dxf%29.zip NanoPi-2-1507-Dimesions(dxf).zip ]<br />
<br />
==Get Started==<br />
===Essentials You Need===<br />
Before play with your NanoPi2 please get the following items ready<br />
* NanoPi 2 <br />
* microSD Card/TFCard: Class 10 or Above, minimum 8GB SDHC<br />
* microUSB power. A 5V/2A power is a must<br />
* HDMI monitor or LCD <br />
* USB keyboard and mouse<br />
* A Host running Ubuntu 14.04 64 bit system<br />
<br />
===TF Card We Tested===<br />
To make your NanoPi 2 boot and run fast we highly recommand you use a Class10 8GB SDHC TF card or a better one. The following cards are what we used in all our test cases presented here:<br />
*SanDisk TF 8G Class10 Micro/SD TF card:<br />
[[File:SanDisk MicroSD.png|frameless|100px|SanDisk MicroSD 8G]]<br />
*SanDisk TF128G MicroSDXC TF 128G Class10 48MB/S:<br />
[[File:SanDisk MicroSD-01.png|frameless|100px|SanDisk MicroSD 128G]]<br />
*川宇 8G C10 High Speed class10 micro SD card:<br />
[[File:SanDisk MicroSD-02.png|frameless|100px|chuanyu MicroSD 8G]]<br />
<br />
===Make an Installation MicroSD Card===<br />
====Under Windows====<br />
Please get the following files from here:[http://wiki.friendlyarm.com/wiki/nanopi2/download/ download link] to download image files: <br /><br />
<br />
::{| class="wikitable"<br />
|-<br />
|colspan=2|For LCD or HDMI output please use the following files:<br />
|-<br />
|nanopi2-debian-sd4g.img.zip || Debian image files <br />
|-<br />
|nanopi2-android-sd4g.img.zip || Android image files <br />
|-<br />
|colspan=2|No display device connected, please use the following files: <br />
|-<br />
|nanopi2-debian-sd4g-wifiap.img.zip || Debian image file (By default WIFI AP is started and users can login via VNC or SSH) <br />
|- <br />
|colspan=2|Flash Utility: <br />
|-<br />
|win32diskimager.rar || Windows utility. Under Linux users can use "dd"<br />
|- <br />
|}<br />
<br />
* Please uncompress these files. Insert an SD card(at least 4G) to a Windows PC, run the win32diskimager utility as administrator,On the utility's main window select your SD card's drive and the image files and click on "write" to start flashing the SD card.<br />
* Please insert this card to your NanoPi2 and power on (with a 5V/2A power source). If the blue LED and green LED are blinking this indicates your NanoPi2 is successfully booted.<br /><br />
<br />
====Under Linux Desktop====<br />
*1) Insert your microSD card to your host running Ubuntu and check your SD card's device name<br />
<syntaxhighlight lang="bash"><br />
dmesg | tail<br />
</syntaxhighlight><br />
Search the messages output by "dmesg" for similar words like "sdc: sdc1 sdc2". If you can find them it means your SD card is recognized as "/dev/sdc". Or you can check that by commanding "cat /proc/partitions".<br />
<br />
*2) Download Firmware Package<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/sd-fuse_nanopi2.git<br />
cd sd-fuse_nanopi2<br />
</syntaxhighlight><br />
<br />
*3) Flash Android Firmware to MicroSD Card<br />
<syntaxhighlight lang="bash"><br />
su<br />
./fusing.sh /dev/sdx<br />
</syntaxhighlight><br />
(Note: you need to replace "/dev/sdx" with the device name in your system) <br />
When you do “git clone” you have to hit “Y” within 10 seconds after it prompts you to download image files otherwise you will miss the download.<br />
<br />
*4) Flash Debian Firmware to MicroSD Card<br />
<syntaxhighlight lang="bash"><br />
./fusing.sh /dev/sdx debian<br />
</syntaxhighlight><br />
<br />
====LCD/HDMI Resolution====<br />
When system boots our uboot will check whether it is connected to an LCD. If it recognizes an LCD it will configure its resolution. By default our uboot configures the display to HDMI 720P.<br/><br />
If you want to reset the LCD resolution you can modify file "arch/arm/plat-s5p4418/nanopi2/lcds.c" in the kernel and recompile it.<br/><br />
If your NanoPi 2 connects an HDMI monitor and it runs Android it will automatically set the resolution to an appropriate HDMI mode by checking "EDID". If your NanoPi 2 connects an HDMI monitor and it runs Debian by default it will set the resolution to HDMI 720P and in this case you can set it to 1080P by modifying your kernel's configuration.<br/><br />
<br />
===Update Image Files in MicroSD Card From PC Host===<br />
If you want to make some changes to the image files in your MicroSD card please follow steps below otherwise you can skip this section.<br/><br />
Please insert your MicroSD card to a PC host running LINUX, mount the boot and rootfs sections of the SD card and follow the steps below:<br/><br />
<br />
1) If you want to change your kernel command line parameters you can do it via the fw_setevn utility under "sd-fuse_nanopi2/tools"<br /><br />
Check the current Command Line:<br />
<syntaxhighlight lang="bash"><br />
cd sd-fuse_nanopi2/tools<br />
./fw_printenv /dev/sdc | grep bootargs<br />
</syntaxhighlight><br />
Android 5.1.1_r6 starts SELinux. By default it is enforcing. You can change it this way:<br />
<syntaxhighlight lang="bash"><br />
./fw_setenv /dev/sdc bootargs XXX androidboot.selinux=permissive<br />
</syntaxhighlight><br />
This will set it to "permissive". The "XXX" stands for the original bootargs' value.<br /><br />
<br />
2) Update Kernel <br /><br />
Our customized uboot will check the LCD type when it boots.For a non-Android OS If it recognizes an LCD connected to the NanoPi2 it will load "uImage" from "boot" otherwise it will load "uImage.hdmi"<br /><br />
However for Android these two files don't make any differences for whatever display device it detects. You can use your generated uImage to replace the existing one under "boot".<br /><br />
For Debian if your generated kernel is for LCD you need to replace the existing uImage or if your kernel is for HDMI you need to replace the existing uImage.hdmi .<br /><br />
<br />
===Run Android or Debian===<br />
Insert a MicroSD card with Android image files to your NanoPi2, connect the NanoPi2 to an HDMI monitor and a 5V/2A power source the NanoPi2 will be automatically powered on. If you can see the blue LED flashing it means your board is working and you will see Android loading on the HDMI monitor. If at the same time you connect your NanoPi2 to a PC running Ubuntu and Minicom via a serial cable you will see system messages output to the PC’s minicom terminal.<br />
Under Debian the password for "root" is "fa".<br />
<br />
===Login Debian via VNC or SSH===<br />
If your NanoPi 2 is not connected to a display device and it runs the "-wifiap.img" image file you can login your NanoPi2 at "nanopi2-wifiap" from another device via WIFI. The password for that AP is "123456789". After you successfully connect to your NanoPi2 you can go to this link [http://www.realvnc.com/download/ here] to download and install a "VNC Viewer". To login the NanoPi2 via VNC you need to set the IP address and port to 192.168.8.1:5901 and its default password is "fa123456". Here is a screenshot which shows how it looks like when users login the NanoPi2 from an iPhone via VNC:<br /><br />
[[File:iphone6-vnc-nanopi2.png|frameless|400px|VNC to NanoPi2]]<br />
<br /><br />
You can login via "SSH -l root 192.168.8.1" too and the default password for "root" is "fa".<br />
<br /><br />
To make SSH login fluent and fast please turn off the WiFi's power saving mode by running the following command:<br />
<syntaxhighlight lang="bash"><br />
iwconfig wlan0 power off<br />
</syntaxhighlight><br />
<br />
==Play with Debian==<br />
===Wireless Connection===<br />
After Debian is fully loaded please click on the network icon on top right of the GUI it will automatically search for nearby WiFi sources. Select one source from the list, click on its "Properties", type its password, save, close and then "Connect". If everything is fine your NanoPi2 will be able to connect to a WiFi source.<br/><br/><br />
<br />
The following section only applies to the NanoPi2 which runs the "-wifiap.img" file:<br/>By default the system's WIFI AP mode is on therefore it cannot search and connect to a wireless router. You need to turn off the WiFi AP mode by following the instructions below:<br />
First please set up the WIFI rounter you expect to connect to:<br /><br />
Log in the NanoPi2 via SSH. Check the WIFI device by running the following commands. Those starting with "wlan" are WiFi devices:<br />
<syntaxhighlight lang="bash"><br />
ifconfig -a<br />
</syntaxhighlight><br />
By default "wlan0" is the Wifi device. You need to create a configuration file with the same name under "/etc/network/interfaces.d/". For instance you can create a "wlan0" file:<br />
<syntaxhighlight lang="bash"><br />
vi /etc/network/interfaces.d/wlan0<br />
</syntaxhighlight><br />
Here is the wlan0's content:<br />
<syntaxhighlight lang="bash"><br />
auto wlan0<br />
iface wlan0 inet dhcp<br />
wpa-driver nl80211<br />
wpa-ssid YourWiFiESSID<br />
wpa-ap-scan 1<br />
wpa-psk YourWiFiPassword<br />
</syntaxhighlight><br />
The "YourWiFiESSID" and "YourWiFiPassword" need to be replaced with your actual ESSID and password.<br /><br /><br />
If your WiFi password has special characters or you don't want your password saved as plain text you can use "wpa_passphrase" to generate a psk for your WiFi password. Here is how you can do it:<br /><br />
<syntaxhighlight lang="bash"><br />
wpa_passphrase YourWiFiESSID<br />
</syntaxhighlight><br />
Follow its prompt to type your password you will get some code in the following format. The string after "psk=" is your new password:<br />
<syntaxhighlight lang="bash"><br />
network={<br />
ssid="YourWiFiESSID"<br />
#psk="YourWiFiPassword"<br />
psk=1b66ca678d6f439f7360686ff5eeb7519cdc44b76a40d96515e4eb807a6d408b<br />
}<br />
</syntaxhighlight><br />
Now you can replace the existing password in the wlan0 file with the new one:<br />
<syntaxhighlight lang="bash"><br />
auto wlan0<br />
iface wlan0 inet dhcp<br />
wpa-driver nl80211<br />
wpa-ssid YourWiFiESSID<br />
wpa-ap-scan 1<br />
wpa-psk 1b66ca678d6f439f7360686ff5eeb7519cdc44b76a40d96515e4eb807a6d408b<br />
</syntaxhighlight><br />
Next turn off the AP mode. You need to do this as root. Please run the following commands and your system will be rebooted. After your system rebooted it will automatically connect to the WiFi router you set up in your first step:<br />
<syntaxhighlight lang="bash"><br />
su<br />
turn-wifi-into-apmode no<br />
</syntaxhighlight><br />
<br />
===Setup Wi-Fi AP===<br />
You can follow the steps below to setup Wi-Fi AP:<br /><br />
<syntaxhighlight lang="bash"><br />
turn-wifi-into-apmode yes<br />
</syntaxhighlight><br />
Please reboot the system as prompted. By default the AP's name is "nanopi2-wifiap" and the password is 123456789.<br /><br />
<br /><br />
Now you are able to find the "nanopi2-wifiap" from a PC host and connect to it. If a connection is a success you will be able to SSH to this NanoPi2 at "192.168.8.1":<br />
<syntaxhighlight lang="bash"><br />
ssh root@192.168.8.1<br />
</syntaxhighlight><br />
The password for it is "fa".<br /><br />
<br/><br />
To make SSH login fluent and fast please turn off the WiFi's power saving mode by running the following command:<br />
<syntaxhighlight lang="bash"><br />
iwconfig wlan0 power off<br />
</syntaxhighlight><br />
You can check the WiFi mode via the following command:<br /><br />
<syntaxhighlight lang="bash"><br />
cat /sys/module/bcmdhd/parameters/op_mode<br />
</syntaxhighlight><br />
If the result is "2" it means it is currently working as a WiFi AP.If you want to switch back to the Station mode you can do it this way:<br /><br />
<syntaxhighlight lang="bash"><br />
turn-wifi-into-apmode no<br />
</syntaxhighlight><br />
<br />
===Bluetooth===<br />
Click on the bluetooth icon on right bottom of the GUI a menu will pop up:<br /><br />
Make discoverable enables the NanoPi2 to be searched for by other bluetooth devices;<br /><br />
Devices... opens a search window and searches for nearby bluetooth devices(Note: the "Make discoverable" property needs to be enabled on those nearby devices):<br /><br />
Send Files to Device...enables the NanoPi2 to send files to another bluetooth device which is a pair of the NanoPi2.<br /><br />
<br />
===Install Debian Packages===<br />
We provide a Debian jessie image. You can install Jessie's packages by commanding "apt-get". If this is your first installation you need to update the package list by running the following command:<br />
<syntaxhighlight lang="bash"><br />
apt-get update<br />
</syntaxhighlight><br />
You can install your preferred packages. For example if you want to install an FTP server you can do this:<br />
<syntaxhighlight lang="bash"><br />
apt-get install vsftpd<br />
</syntaxhighlight><br />
Note: you can change your download server by editting "/etc/apt/sources.list". You can get a complete server list from [http://www.debian.org/mirror/list]. You need to select the one with "armhf".<br />
<br />
==Make Your Own OS Image==<br />
<br />
===Setup Development Environment===<br />
<br />
===Install Cross Compiler===<br />
Please download the compiler package:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/prebuilts.git<br />
sudo mkdir -p /opt/FriendlyARM/toolchain<br />
sudo tar xf prebuilts/gcc-x64/arm-cortexa9-linux-gnueabihf-4.9.3.tar.xz -C /opt/FriendlyARM/toolchain/<br />
</syntaxhighlight><br />
<br />
Then add the compiler's directory to "PATH" by appending the following lines in "~/.bashrc":<br />
<syntaxhighlight lang="bash"><br />
export PATH=/opt/FriendlyARM/toolchain/4.9.3/bin:$PATH<br />
export GCC_COLORS=auto<br />
</syntaxhighlight><br />
<br />
Execute "~/.bashrc" to make the changes into effect. Please note that there is a space after ".":<br />
<syntaxhighlight lang="bash"><br />
. ~/.bashrc<br />
</syntaxhighlight><br />
<br />
This compiler is a 64-bit one therefore it cannot be run on a 32-bit LINUX. After the compiler is installed you can verify it by running the following commands:<br />
<syntaxhighlight lang="bash"><br />
arm-linux-gcc -v<br />
Using built-in specs.<br />
COLLECT_GCC=arm-linux-gcc<br />
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/4.9.3/libexec/gcc/arm-cortexa9-linux-gnueabihf/4.9.3/lto-wrapper<br />
Target: arm-cortexa9-linux-gnueabihf<br />
Configured with: /work/toolchain/build/src/gcc-4.9.3/configure --build=x86_64-build_pc-linux-gnu<br />
--host=x86_64-build_pc-linux-gnu --target=arm-cortexa9-linux-gnueabihf --prefix=/opt/FriendlyARM/toolchain/4.9.3<br />
--with-sysroot=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-languages=c,c++<br />
--with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3 --with-float=hard<br />
...<br />
Thread model: posix<br />
gcc version 4.9.3 (ctng-1.21.0-229g-FA)<br />
</syntaxhighlight><br />
<br />
===Compile U-Boot===<br />
Download the U-Boot source code and compile it. Please note the github's branch is nanopi2-lollipop-mr1:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/uboot_nanopi2.git<br />
cd uboot_nanopi2<br />
git checkout nanopi2-lollipop-mr1<br />
make s5p4418_nanopi2_config<br />
make CROSS_COMPILE=arm-linux-<br />
</syntaxhighlight><br />
<br />
After your compilation succeeds a u-boot.bin will be generated. If you want to test it please flash it to your installation MicroSD card via fastboot. Here is how you can do it:<br /><br />
1) On your PC host please run "sudo apt-get install android-tools-fastboot" to install the fastboot utility<br /><br />
2) Connect your NanoPi2 to your PC host via a serial cable (e.g. PSU-ONECOME). Press the enter key within two seconds right after you power on your NanoPi 2 and you will enter uboot's command line mode:<br /><br />
3) After type "fastboot" and press "enter" you will enter the fastboot mode:<br /><br />
4) Connect your NanoPi2 to this PC host via a microUSB cable and type the following command to flash the u-boot.bin:<br /><br />
<syntaxhighlight lang="bash"><br />
fastboot flash bootloader u-boot.bin<br />
</syntaxhighlight><br />
<br /><br />
Warning: you cannot update this MicroSD card by commanding "dd". This command which will cause trouble when booting the NanoPi2.<br /><br />
<br />
===Prepare mkimage===<br />
You need the mkimage utility to compile a U-Boot source code package. Please make sure this utility works well on your host before you start compiling a uImage.<br /><br />
You can install this utility by either commanding "sudo apt-get install u-boot-tools" or following the commands below:<br />
<syntaxhighlight lang="bash"><br />
cd uboot_nanopi2<br />
make CROSS_COMPILE=arm-linux- tools<br />
sudo mkdir -p /usr/local/sbin && sudo cp -v tools/mkimage /usr/local/sbin<br />
</syntaxhighlight><br />
<br />
===Compile Linux kernel===<br />
====Compile Kernel====<br />
* Download Kernel Source Code<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/linux-3.4.y.git<br />
cd linux-3.4.y<br />
git checkout nanopi2-lollipop-mr1<br />
</syntaxhighlight><br />
The NanoPi2's kernel source code lies in the "nanopi2-lollipop-mr1" branch. <br />
* Compile Android Kernel<br />
<syntaxhighlight lang="bash"><br />
make nanopi2_android_defconfig<br />
touch .scmversion<br />
make uImage<br />
</syntaxhighlight><br />
* Compile Debian Kernel<br />
<syntaxhighlight lang="bash"><br />
make nanopi2_linux_defconfig<br />
touch .scmversion<br />
make uImage<br />
</syntaxhighlight><br />
After your compilation succeeds a uImage will be generated in the "arch/arm/boot/uImage" directory. This kernel is for HDMI. You can use it to replace the existing uImage.hdmi<br/><br />
If you want to generate a kernel for LCD you can do it this way:<br />
<syntaxhighlight lang="bash"><br />
touch .scmversion<br />
make nanopi2_linux_defconfig<br />
make menuconfig<br />
Device Drivers --><br />
Graphics support --><br />
Nexell Graphics --><br />
[*] LCD<br />
[ ] HDMI<br />
make uImage<br />
</syntaxhighlight><br />
After your compilation succeeds a uImage will be generated for HDMI. You can use it to replace the existing uImage.<br />
<br />
====Compile Kernel Modules====<br />
Android contains kernel modules which are in the "/lib/modules" directory in the system section. If you want to add your own modules to the kernel or you changed your kernel configurations you need to recompile these new modules.<br /><br />
Compile Original Kernel Modules:<br />
<syntaxhighlight lang="bash"><br />
cd linux-3.4.y<br />
make CROSS_COMPILE=arm-eabi- modules<br />
</syntaxhighlight><br />
Here we have two new modules and we can compile them by following the commands below:<br />
<syntaxhighlight lang="bash"><br />
cd /opt/FriendlyARM/s5p4418/android<br />
./vendor/friendly-arm/build/common/build-modules.sh<br />
</syntaxhighlight><br />
The "/opt/FriendlyARM/s5p4418/android" directory points to the top directory of Android source code. You can get more details by specifying option "-h".<br /><br />
After your compilation succeeds new modules will be generated<br />
<br />
===Compile Android===<br />
<br />
* Install Cross Compiler<br />
We recommend installing 64 bit Ubuntu 14.04 on your PC host.<br />
<syntaxhighlight lang="bash"><br />
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip<br />
sudo apt-get install flex libncurses5-dev zlib1g-dev gawk minicom<br />
</syntaxhighlight><br />
For more details please refer to https://source.android.com/source/initializing.html 。<br />
<br />
* Download Source Code<br />
You need to use repo to get the Android source code. Please refer to https://source.android.com/source/downloading.html 。<br />
<syntaxhighlight lang="bash"><br />
mkdir android && cd android<br />
repo init -u https://github.com/friendlyarm/android_manifest.git -b nanopi2-lollipop-mr1<br />
repo sync<br />
</syntaxhighlight><br />
The "android" directory is the working directory. <br />
<br />
* Compile System Package<br />
<syntaxhighlight lang="bash"><br />
source build/envsetup.sh<br />
lunch aosp_nanopi2-userdebug<br />
make -j8<br />
</syntaxhighlight><br />
After your compilation succeeds an image will be generated in the "out/target/product/nanopi2/" directory.<br />
<br />
==Connect NanoPi 2 to External Modules==<br />
===Connect NanoPi 2 to USB Camera(FA-CAM202)===<br />
*In this usecase the NanoPi 2 runs Debian. If you connect your NanoPi 2 to our LCD after Debain is fully loaded please click on "other"-->"xawtv9" on the left bottom of the GUI and the USB Camera application will be started. After enter "welcome to xawtv!" please click on "OK" to start exploring.<br />
[[File:USB-camera-nanopi2.png|frameless|500px|USB camera]]<br />
[[File:USB-camera-nanopi2-01.png|frameless|500px|USB camera-01]]<br />
===Connect NanoPi 2 to CMOS 5M-Pixel Camera===<br />
*In this usecase the NanoPi 2 runs Android5.1. If you connect your NanoPi 2 to our LCD after Debain is fully loaded please click on the "Camera" icon the application will be started. <br />
[[File:CMOS-camera-nanopi2.png|frameless|500px|CMOS camera]]<br />
===Use OpenCV to Access USB Camera===<br />
* The full name of "OpenCV" is Open Source Computer Vision Library and it is a cross platform vision library.<br />
* When the NanoPi 2 runs Debian users can use OpenCV APIs to access a USB Camera device<br><br />
Here is a guideline on how to use OpenCV with C++ on the NanoPi 2<br> <br />
1. Preparations<br />
<syntaxhighlight lang="bash"><br />
---Firstly you need to make sure your NanoPi 2 is connected to the internet. <br />
Login your NanoPi 2 via a serial terminal or SSH. After login please type your username(root) and password(fa):<br />
---Run the following commands:<br />
</syntaxhighlight><br />
<br><br />
<syntaxhighlight lang="bash"><br />
#apt-get update<br />
(The OS images we provide for the NanoPi 2 by default have the vi utility. However we suggest you install the vim utility)<br />
#apt-get install vim<br />
#apt-get install libcv-dev libopencv-dev<br />
</syntaxhighlight><br />
<br />
2. Make sure your USB camera works with the NanoPi 2. You can test your camera with NanoPi 2's camera utility.<br><br />
<br />
3. Check your camera device:<br />
<syntaxhighlight lang="bash"><br />
#ls /dev/video + "Tab" key (This lists available USB camera devices. In our test case video9 was available and video0 to video8 were occupied)<br />
</syntaxhighlight><br />
<br />
4. OpenCV's code sample:<br />
<syntaxhighlight lang="bash"><br />
#cd /home/fa<br />
#vim test.cpp<br />
</syntaxhighlight><br />
<br><br />
<syntaxhighlight lang="bash"><br />
#include "opencv2/opencv.hpp"<br />
<br />
using namespace cv;<br />
<br />
int main(int, char**)<br />
{<br />
VideoCapture cap(0); // open the default camera<br />
if(!cap.isOpened()) // check if we succeeded<br />
return -1;<br />
<br />
Mat edges;<br />
namedWindow("edges",1);<br />
for(;;)<br />
{<br />
Mat frame;<br />
cap >> frame; // get a new frame from camera<br />
cvtColor(frame, edges, CV_BGR2GRAY);<br />
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);<br />
Canny(edges, edges, 0, 30, 3);<br />
imshow("edges", edges);<br />
if(waitKey(30) >= 0) break;<br />
}<br />
// the camera will be deinitialized automatically in VideoCapture destructor<br />
return 0;<br />
}<br />
</syntaxhighlight><br />
Compile the code sample:<br />
<syntaxhighlight lang="bash"><br />
#g++ test.cpp -o test -lopencv_core -lopencv_highgui -lopencv_imgproc<br />
</syntaxhighlight><br />
<br />
If it is compiled successfully a "test" executable will be generated:<br><br />
5. Note: the NanoPi 2 has nine video devices. However this OpenCV's code sample defines a maximum of 8 cameras can be accessed therefore one video needs to be removed. Here we removed video0<br />
<syntaxhighlight lang="bash"><br />
#rm /dev/video0<br />
#mv /dev/video9 /dev/video0<br />
</syntaxhighlight><br />
<br />
6. Connect NanoPi 2 to USB Keyboard & Run the Following Command:<br />
<syntaxhighlight lang="bash"><br />
#./test<br />
</syntaxhighlight><br />
<br />
This is what you expect to observe:<br><br />
[[File:OpenCV-01.png|frameless|600px|OpenCV-01]]<br />
<br />
<br />
==Extend NanoPi 2's TF Card Section==<br />
===For Debian===<br />
* Please run the following commands on a PC host's terminal:<br />
<syntaxhighlight lang="bash"><br />
sudo umount /dev/sdx? <br />
sudo parted /dev/sdx unit % resizepart 2 100 unit MB print<br />
sudo resize2fs -f /dev/sdx2<br />
</syntaxhighlight><br />
<br />
===For Android===<br />
* Please run the following commands on a PC host's terminal:<br />
<syntaxhighlight lang="bash"><br />
sudo umount /dev/sdx?<br />
sudo parted /dev/sdx unit % resizepart 4 100 resizepart 7 100 unit MB print<br />
sudo resize2fs -f /dev/sdx7<br />
</syntaxhighlight><br />
(Note: you need to replace "/dev/sdx" with the device name in your system)<br />
<br />
==More OS Support==<br />
===Ubuntu-Mate===<br />
* Please go to this link [http://pan.baidu.com/s/1boiCWWJ] to download the image files<br />
* Please uncompress it and flash the image file to a TF card with win32diskimager under Windows<br />
* After it is done you can boot your NanoPi 2 with this card<br />
* Login name: "root" or "fa", Password: fa<br />
Note: this UbuntuMate works with both NanoPi 2 and NanoPi 2 Fire<br />
<br />
===Kali===<br />
* Please go to this link [http://pan.baidu.com/s/1qXf2JVm] to download the image files<br />
* Please prepare an 8G High Speed MicroSD card, insert it to a Linux host and do "sudo fdisk -l" to check its device name, i.e. "/dev/sd*"<br />
* Please copy the image files to the card by running the following commands as root:<br />
<syntaxhighlight lang="bash"><br />
xzcat kali-2.0-nanopi2.img.xz | dd of=<YOURDEVICE> bs=1m<br />
</syntaxhighlight><br />
* After it is done you can boot your NanoPi 2 with this card.<br />
Note: this is offered by Kali and FriendlyARM doesn't provide technical support for it.<br />
<br />
===Deepin15 ARM===<br />
* Please go to this link [http://cdimage.deepin.com/armhf/15/beta1.0/] to download the image files<br />
* Please uncompress the file and you will get a 16g.img file which is the image file for MicroSD card.<br />
<syntaxhighlight lang="bash"><br />
tar -xf deepin15_nanopi2_armhf_16g.tar.gz<br />
</syntaxhighlight><br />
* Please prepare an 16G High Speed MicroSD card, insert it to a Linux host and do "sudo fdisk -l" to check its device name, i.e. "/dev/sd*"<br />
* Please flash the image files to the card by running the following command as root(in our case our card was recognized as "/dev/sdc"):<br />
<syntaxhighlight lang="bash"><br />
sudo dd if=16g.img of=/dev/sdc <br />
</syntaxhighlight><br />
<br />
(This process takes a while which can be up to one hour)<br />
<br />
* After it is done you can boot your NanoPi 2 with this card<br />
<br />
<br />
Notes:<br><br />
1. The password for login name "deepin" is "deepin". The password for login name "root" is "admin".<br><br />
2. The initial booting of Deepin15 takes a relative long time for it generates some configuration files.<br><br />
3. If WIFI is activated in your system booting might take longer. In this case please wait for the sound and wifi icons on the right bottom of the GUI to appear before you start any action.<br><br />
<syntaxhighlight lang="bash"><br />
ARM code: http://packages.deepin.com/armhf/<br><br />
<br />
NanoPi 2 Image: http://cdimage.deepin.com/armhf/15/beta1.0/<br><br />
<br />
NanoPi 2 Image Installation Instruction; http://bbs.deepin.org/forum.php?mod=viewthread&tid=36670<br><br />
<br />
Forum for Migrating Deepin15 to ARM: http://bbs.deepin.org/<br><br />
<br />
</syntaxhighlight><br />
Note: this is offered by the Deepin15 team and FriendlyARM doesn't provide technical support for it.<br />
<br />
==Resources==<br />
* [http://wiki.friendlyarm.com/nanopi2/download/ image files]<br />
* SEC_Users_Manual_S5P4418_Users_Manual_Preliminary([http://wiki.friendlyarm.com/wiki/index.php/File:SEC_Users_Manual_S5P4418_Users_Manual_Preliminary_Ver.0.10.pdf])<br />
* Schematic ([http://wiki.friendlyarm.com/wiki/images/e/ec/NanoPi-2-1507-Schematic.pdf NanoPi-2-1507-Schematic.pdf])<br />
* Dimensions ([http://wiki.friendlyarm.com/wiki/images/4/45/NanoPi-2-1507-Dimesions%28dxf%29.zip NanoPi-2-1507-Dimesions(dxf).zip])<br />
* SOC Datasheet ([http://wiki.friendlyarm.com/wiki/images/a/a7/Pi2_SOC_DS_0.1.pdf Pi2_SOC_DS_0.1.pdf])<br />
* AP6212 Datasheet ([http://wiki.friendlyarm.com/wiki/images/5/57/AP6212_V1.1_09022014.pdf AP6212_V1.1_09022014.pdf])<br />
* NanoPi2-Component-bot ([http://wiki.friendlyarm.com/wiki/index.php/File:NanoPi2-Component-bot.pdf])<br />
* NanoPi2-Component-top ([http://wiki.friendlyarm.com/wiki/index.php/File:NanoPi2-Component-top.pdf])<br />
* External Modules and Development Documents:<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Button Button Module]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_LED LED Module]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Analog_to_Digital_Converter Analog to Digital Converter]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Relay Relay Module]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_3-Axis_Digital_Accelerometer 3 Axis Digital Accelerometer]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_3-Axis_Digital_Compass 3 Axis Digital Compass]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Temperature_Sensor Temperature Sensor]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Temperature_and_Humidity_Sensor Temperature and Humidity Sensor]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Buzzer Buzzer Module]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Joystick Joystick Module]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_I2C_LCD1602_Keypad I2C(PCF8574)+LCD1602]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Sound_Sensor Sound Sensor Module]<br />
** [http://wiki.friendlyarm.com/wiki/index.php/Matrix_-_Ultrasonic_Ranger Ultrasonic Ranger]<br />
<br />
==External Links==<br />
* [https://www.offensive-security.com/kali-linux-arm-images/ Kali Linux's Image for NanoPi 2]<br />
* [http://www.friendlyarm.com/Forum/viewtopic.php?f=17&t=73 How to setup Qt development environment for NanoPi 2 & NanoPi 2 Fire]<br />
<br />
==Update Log==<br />
===Dec-01-2015===<br />
* Released Android 5.1.1_r6. The source code has been pushed to https://github.com/friendlyarm <br />
* 4.2.1: Combined originally individual HDMI image and LCD image to one <br />
* 4.3: Updated steps on how to make changes in image files in SD card<br />
* 6: Updated code branch to "nanopi2-lollipop-mr1"<br />
* 6.4.2: Added Debian uImage that supports LCD<br />
<br />
===Jan-29-2016===<br />
* Add 9 More OS Support<br />
<br />
===Feb-02-2016===<br />
* Add 9.1 UbuntuMate<br />
* Add 11 External Links</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=NanoPi&diff=1129NanoPi2016-02-10T04:38:24Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:NanoPi-01B.jpg|thumb|Overview]]<br />
[[File:NanoPi-A01.png|thumb|Front]]<br />
[[File:NanoPi-B01.png|thumb|Back]]<br />
The NanoPi is a low power consumption, Samsung S3C2451 based ARM SOC that FriendlyARM developed for Linux hackers, makers and hobbyists. Its size is only half of the Raspberry Pi(RPi) and its GPIO pin is compatible with the RPi’s. The NanoPi integrates both the WiFi and Bluetooth 4.0. It has a DVP camera interface and full color LCD interface. It boots Linux/Debian quickly from a TF card. These features make it a good platform for applications in IOT, unmanned vehicles, robotics, image processing and human machine interaction.<br />
<br />
==Hardware Features==<br />
* CPU: Samsung S3C2451, 400Mhz<br />
* RAM: 64M DDR2<br />
* Integrated SDIO WiFi and Bluetooth<br />
* USB Type A x1<br />
* Debugging Serial Port x1<br />
* microSD Slot x1<br />
* microUSB x1: for power and data transmission. It can be configured as a serial port or Ethernet<br />
* LCD Interface: 0.5 mm pitch SMT FPC seat, for full-color LCD (RGB: 8-8-8)<br />
* DVP Camera interface:0.5mm spacing FPC socket. It includes ITU-R BT 601/656 8-bit, I2C and IO<br />
* GPIO1: 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, IO etc<br />
* GPIO2: 2.54mm spacing 12pin. It includes I2S, I2C, UART etc.<br />
* PCB dimension: 75 x 30 mm<br />
* Power: DC 5V<br />
* Bootloader and OS: u-boot, Linux-4.1, Debian8 jessie, Rabbit linux<br />
<br />
==Diagram, Layout and Dimension==<br />
===Layout===<br />
[[File:NanoPi-1506-IF.png |thumb|300px|NanoPi Layout]]<br />
* GPIO1 Pin Spec<br />
::[[File:NanoPiGPIOHeader.png | frameless|400px|NanoPi GPIO Header ]]<br />
<br />
* GPIO2 Pin Spec<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name || Pin# || Name <br />
|-<br />
|1 || VDD_5V || 2 || VDD_SYS_3.3V <br />
|-<br />
|3 || TXD2 || 4 || RXD2 <br />
|- <br />
|5 || SDA0 || 6 || SCL0<br />
|-<br />
|7 || IISSDO0 || 8 || IISSDI0<br />
|-<br />
|9 || IISSCLK0 || 10 || IISLRCK0<br />
|-<br />
|11 || IISCDCLK0 || 12 || DGND<br />
|}<br />
* Debug Port CON1(UART0)<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1 || DGND <br />
|-<br />
|2 || VDD_5V <br />
|- <br />
|3 || TXD0 <br />
|-<br />
|4 || RXD0 <br />
|}<br />
* DVP Camera IF Pin Spec<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1, 2 || VDD_SYS_3.3V<br />
|-<br />
|7,9,13,15,24 || DGND<br />
|-<br />
|3 || SCL0 <br />
|- <br />
|4 || SDA0 <br />
|-<br />
|5 || GPH13 <br />
|-<br />
|6 || GPJ12<br />
|-<br />
|8 || XCLK<br />
|- <br />
|10 || NC<br />
|-<br />
|11 || VSYNC<br />
|-<br />
|12 || HREF<br />
|-<br />
|14 || PCLK<br />
|-<br />
|16-23 || Data bit7-0<br />
|}<br />
* RGB LCD IF Pin Spec<br />
::{| class="wikitable"<br />
|-<br />
|Pin# || Name <br />
|-<br />
|1, 2 || VDD_5V<br />
|-<br />
|11,20,29 || DGND<br />
|-<br />
|3-10 || Blue LSB to MSB <br />
|- <br />
|12-19 || Green LSB to MSB <br />
|-<br />
|21-28 || Red LSB to MSB<br />
|-<br />
|30 || GPG12<br />
|-<br />
|31 || GPG2<br />
|- <br />
|32 || XnRSTOUT Form CPU<br />
|-<br />
|33 || VDEN<br />
|-<br />
|34 || VSYNC<br />
|-<br />
|35 || HSYNC<br />
|-<br />
|36 || LCDCLK<br />
|-<br />
|37,38,39,40 || XM,XP,YM,YP<br />
|}<br />
:Note:<br />
::#VDD_SYS_3.3V: 3.3V power output<br />
::#VDD_5V: 5V power input/output. When the external device’s power is greater than the MicroUSB’s the external device is charging the board otherwise the board powers the external device. The input range is 4.7V ~ 5.6V<br />
::#3. For more details please refer to the document:[http://wiki.friendlyarm.com/wiki/images/f/f0/NanoPi-1507-Schematic.pdf NanoPi-1507-Schematic.pdf]<br />
<br />
===Board Dimension===<br />
[[File:NanoPi-1507-dimensions.png|frameless|500px|NanoPi 机械尺寸]]<br />
<br />
:: For more details please refer to the document:[http://wiki.friendlyarm.com/wiki/images/3/37/NanoPi-1507-Dimesions%28dxf%29.zip NanoPi-1507-Dimesions(dxf).zip ]<br />
<br />
==Get Started==<br />
===Essentials You Need===<br />
Before play with your NanoPi please get the following items ready<br />
* NanoPi <br />
* Class 8, microSD card/TF card: >= 4GB<br />
* microUSB cable<br />
* a Host running Ubuntu and connected to the internet<br />
<br />
===Make an Installation MicroSD Card===<br />
* 1) Insert your microSD card to your host running Ubuntu and check your SD card's device name<br />
<syntaxhighlight lang="bash"><br />
dmesg | tail<br />
</syntaxhighlight><br />
Search the messages output by "dmesg" for similar words like "sdc: sdc1 sdc2". If you can find them it means your SD card is recognized as "/dev/sdc". Or you can check that by commanding "cat /proc/partitions".<br />
<br />
*2) Flash Firmware to MicroSD Card<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/sd-fuse_nanopi.git<br />
cd sd-fuse_nanopi<br />
su<br />
./fusing.sh /dev/sdx<br />
</syntaxhighlight><br />
(Note: you need to replace "/dev/sdx" with the device name in your system)<br />
<br/><br/><br />
If you cannot get these files from github you can get them from our source: [http://wiki.friendlyarm.com/NanoPi/download/sd-fuse_nanopi.tgz].<br/><br />
If you have problems with using the "fusing.sh" script you can download our "NanoPi-fuser-win32.zip" and use it to make your SD card in Windows. Here is the download:[http://wiki.friendlyarm.com/NanoPi/download/NanoPi-fuser-win32.zip].<br/><br />
<br />
===Run System===<br />
Insert this MicroSD card to your NanoPi, connect it to a PC via a MicroUSB cable the NanoPi will be automatically powered on. If you can see the blue LED flashing it means your board is running now. By default we install Debian. It would be better if you connect your NanoPi to an LCD since this helps you set up your NanoPi more easily and conveniently.<br />
<br />
[[File:DebianJessie.png|frameless|400px|Debian8 Jessie]]<br />
<br />
===Log on NanoPi via MicroUSB===<br />
After connecting your NanoPi to you PC host (running Ubuntu) please type "dmesg" in your PC's command line. If you can find the following messages it means your NanoPi is correctly connected to your host and runs well:<br />
<syntaxhighlight lang="bash"><br />
[12601.100339] usb 2-1.7: Product: FriendlyARM Gadget v2.4<br />
[12601.100343] usb 2-1.7: Manufacturer: Linux 4.1.2-FriendlyARM with s3c-hsudc<br />
[12601.103192] cdc_acm 2-1.7:2.0: This device cannot do calls on its own. It is not a modem.<br />
[12601.103368] cdc_acm 2-1.7:2.0: ttyACM0: USB ACM device<br />
[12601.105300] cdc_ether 2-1.7:2.2 usb0: register 'cdc_ether' at usb-0000:00:1d.0-1.7, CDC Ethernet Device, 46:a1:e7:6d:5c:32<br />
</syntaxhighlight><br />
<br />
If you command "ifconfig" and find a "usb0" device you can SSH to 192.168.100.1 to log on your NanoPi:<br />
<syntaxhighlight lang="bash"><br />
ssh root@192.168.100.1<br />
</syntaxhighlight><br />
After it prompts you to input your password you can try "fa"<br />
<br />
===Setup Wi-Fi===<br />
<br />
After SSH to your NanoPi please check the WiFi interface first. The "wlan" device is WiFi.<br />
<syntaxhighlight lang="bash"><br />
ifconfig -a<br />
</syntaxhighlight><br />
<br />
By default the WiFi device is "wlan0". You need to create a configuration file under "/etc/network/interfaces.d/" for WiFi: <br />
<syntaxhighlight lang="bash"><br />
vi /etc/network/interfaces.d/wlan0<br />
</syntaxhighlight><br />
Here is a sample wlan0 file:<br />
<syntaxhighlight lang="bash"><br />
auto lo<br />
iface lo inet loopback<br />
auto wlan0<br />
iface wlan0 inet dhcp<br />
wpa-driver wext<br />
wpa-ssid YourWiFiESSID<br />
wpa-ap-scan 1<br />
wpa-proto RSN<br />
wpa-pairwise CCMP<br />
wpa-group CCMP<br />
wpa-key-mgmt WPA-PSK<br />
wpa-psk YourWiFiPassword<br />
</syntaxhighlight><br />
Please replace "YourWiFiESSID" and "YourWiFiPassword" with your WiFiESSID and password. After save and close the file you can connect to your WiFi source by running the following command:<br />
<syntaxhighlight lang="bash"><br />
/etc/init.d/networking restart<br />
</syntaxhighlight><br />
After you power on your board it will automatically connect to your WiFi source.<br /> <br />
Please note that if you use one TF card to boot multiple boards the WiFi device name will likely be named to "wlan1", "wlan2" and etc. You can reset it to "wlan0" by deleting the contents of the following file and reboot your board: <br />
/etc/udev/rules.d/70-persistent-net.rules<br />
<br />
[[File:nanopi-ssh-via-wifi.png|frameless|400px|SSH connected to NanoPi over WiFi]]<br />
<br />
===Setup Wi-Fi AP===<br />
<br />
By default a NanoPi is set to a WiFi AP. The default AP name is "nanopi-wifiap" and the password is "123456789".<br /><br />
<br /><br />
The WiFi's working mode can be checked by running the following command:<br />
<syntaxhighlight lang="bash"><br />
cat /sys/module/bcmdhd/parameters/op_mode<br />
</syntaxhighlight><br />
If the result is "2" it means it is currently working as a WiFi AP.<br /><br />
<br /><br />
If the board is not working as a WiFi AP you can set it by running the following commands:<br /><br />
<syntaxhighlight lang="bash"><br />
turn-wifi-into-apmode yes<br />
</syntaxhighlight><br />
<br /><br />
The WiFi AP's name and password can be configured by editing the file "/etc/hostapd/hostapd.conf".<br />
<br />
<!-- comments<br />
The steps above are for Debian. For Rabbit you can run the following commands:<br />
<syntaxhighlight lang="bash"><br />
wpa_passphrase YourWiFiESSID 'YourWiFiPassword' >> /etc/wpa.conf<br />
wpa_cli -iwlan0 reconfigure<br />
</syntaxhighlight><br />
<br />
<br />
====Scan Wireless AP====<br />
You can scan your surrounding wireless APs by running the following commands:<br />
<syntaxhighlight lang="bash"><br />
wpa_cli -iwlan0 scan<br />
wpa_cli -iwlan0 scan_result<br />
</syntaxhighlight><br />
<br />
--><br />
<br />
<!-- comments<br />
===Setup Bluetooth===<br />
--><br />
<br />
===Bluetooth===<br />
In our Debian Jessie we include bluetooth packages: bluetooth, bluez, obexftp and etc<br /><br />
We will show how to transfer files between a NanoPi and a cellphone<br /><br /><br />
In this example we used an MX4 cellphone, enabled its bluetooth and made it searchable by other devices. Firstly we typed the following commands in the NanoPi to search its nearby bluetooth devices:<br /><br />
<syntaxhighlight lang="bash"><br />
hcitool scan<br />
</syntaxhighlight><br />
<br /><br />
Scanning ...<br /><br />
8C:BE:BE:C5:2C:C7 MX4<br /><br />
<br /><br />
The listed search result above indicated that our MX4 phone was found and its MAC was 8C:BE:BE:C5:2C:C7. We ran "sdptool" to list all the protocols it supported:<br /><br />
<syntaxhighlight lang="bash"><br />
sdptool browse 8C:BE:BE:C5:2C:C7<br />
</syntaxhighlight><br />
What we would like to test was its file transfer function therefore we must find out whether "OBEX File Transfer" was supported:<br /><br />
::Service Name: OBEX File Transfer<br /><br />
::Service RecHandle: 0x1000c<br /><br />
::Service Class ID List:<br /><br />
:: "OBEX File Transfer" (0x1106)<br /><br />
::Protocol Descriptor List:<br /><br />
:: "L2CAP" (0x0100)<br /><br />
:: "RFCOMM" (0x0003)<br /><br />
:: Channel: 11<br /><br />
:: "OBEX" (0x0008)<br /><br />
::Language Base Attr List:<br /><br />
:: code_ISO639: 0x454e<br /><br />
:: encoding: 0x6a<br /><br />
:: base_offset: 0x100<br /><br />
::Profile Descriptor List:<br /><br />
:: "OBEX File Transfer" (0x1106)<br /><br />
:: Version: 0x0100<br /><br />
Here we found out that "OBEX File Transfer" was supported and we could use "obexftp" to start our file transfers. The following commands listed all the files under the root directory of the phone:<br /><br />
<syntaxhighlight lang="bash"><br />
obexftp -b 8C:BE:BE:C5:2C:C7 -c / -l <br />
</syntaxhighlight><br />
The following commands downloaded "/Adnroid/djaof.dll" from the phone to the NanoPi:<br /><br />
<syntaxhighlight lang="bash"><br />
obexftp -b 8C:BE:BE:C5:2C:C7 -c /Android -g djaof.dll<br />
</syntaxhighlight><br />
The following commands uploaded "hello.txt" from the NanoPi to the "/Android" directory of the phone<br /><br />
<syntaxhighlight lang="bash"><br />
obexftp -b 8C:BE:BE:C5:2C:C7 -c /Android -p hello.txt<br />
</syntaxhighlight><br />
<br /><br />
<br />
===Setup iBeacon Transmitter===<br />
The iBeacon technology enables smartphones, tablets and other devices to perform actions when in close proximity to an iBeacon transmitter. Please run the following commands to setup a NanoPi to an iBeacon transmitter:<br />
<syntaxhighlight lang="bash"><br />
hciconfig hci0 up<br />
hciconfig hci0 leadv 3<br />
hciconfig hci0 noscan<br />
hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 63 6F 3F 8F 64 91 4B EE 95 F7 D8 CC 64 A8 63 B5 00 00 00 00 C8<br />
</syntaxhighlight><br />
If this is setup correctly on a NanoPi it will broadcast its presence to nearby portable electronic devices. If a nearby Android device or iPhone has the "locate Beacon" application installed it will be able to measure the distance between itself to the NanoPi. If you want enable the indoor positioning function you will need to setup multiple iBeacon transmitters.<br />
<br />
===Communicate with Cellphone via Bluetooth BLE===<br />
The function requires a BLE service be started on the NanoPi. <br /><br />
The BLE service's code is open source. Please follow the steps below to get it:<br /><br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/ble-peripheral-service-demo.git<br />
</syntaxhighlight><br />
Please run the following build.sh script which will generate a "nanopi_ble_server" executable if it is successful:<br />
<syntaxhighlight lang="bash"><br />
./build.sh<br />
</syntaxhighlight><br />
We assume your cross compiler is installed at "/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc". If it is not installed under this directory you need to make changes in the script accordingly.<br /><br />
After a "nanopi_ble_server" is generated please copy it to the NanoPi and execute the following commands:<br />
<syntaxhighlight lang="bash"><br />
hciconfig hci0 down<br />
service bluetooth stop<br />
chmod 755 nanopi_ble_server<br />
./nanopi_ble_server<br />
</syntaxhighlight><br />
Now please install a BLE Scanner application on an Android phone or a Lightblue application on an iPhone which will be used to test the function.<br /><br />
We have an open source Android Demo on GitHub too,It is under "android/BLETest". This demo shows how a cellphone communicates(transmits data to/receives data from) with the NanoPi via BLE.<br /><br />
[[File:NanoBLEAndroidDemo.jpg|frameless|250px|NanoBLEAndroidDemo]]<br /><br /><br />
NanoPi's output messages are as follows:<br /><br />
[[File:NanoPiBLEServer.png|frameless|500px|NanoPiBLEServer]]<br />
<br /><br />
<br /><br />
<br />
===Install Debian Packages===<br />
We provide a Debian Jessie image. You can install Jessie's packages by commanding "apt-get". If this is your first installation you need to update the package list by running the following command:<br />
<syntaxhighlight lang="bash"><br />
apt-get update<br />
</syntaxhighlight><br />
Or you can try a complete command set<br />
<syntaxhighlight lang="bash"><br />
apt-get update<br />
apt-get dist-upgrade<br />
apt-get autoremove<br />
</syntaxhighlight><br />
You can install your preferred packages. For example if you want to install an FTP server you can do this:<br />
<syntaxhighlight lang="bash"><br />
apt-get install vsftpd<br />
</syntaxhighlight><br />
Note: you can change your download server by editting "/etc/apt/sources.list". You can get a complete server list from [http://www.debian.org/mirror/list]. You need to select the one with "armel".<br />
<br />
==Make OS Image==<br />
<br />
===Install Cross Compiler===<br />
Download and untar cross compiler file:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/prebuilts.git<br />
tar xvzf prebuilts/gcc/arm-linux-gcc-4.4.3.tar.gz -C /<br />
</syntaxhighlight><br />
<br />
It will ease your future development work if you add compiler's path to "PATH". You can do it by first opening "~/.bashrc" and then appending the following lines:<br />
<syntaxhighlight lang="bash"><br />
export PATH=/opt/FriendlyARM/toolschain/4.4.3/bin/:$PATH<br />
</syntaxhighlight><br />
<br />
Run "~/.bashrc" to make your changes in effect right away:<br />
<syntaxhighlight lang="bash"><br />
. ~/.bashrc<br />
</syntaxhighlight><br />
<br />
We assume you would use a 32-bit compiler. However if your host runs a 64-bit Linux you need to install some extra packages. For example if your host runs a Debian 8 Jessie desktop 64 bit system you will need to install the following packages:<br />
<syntaxhighlight lang="bash"><br />
dpkg --add-architecture i386<br />
apt-get update<br />
apt-get install build-essential gcc-multilib rpm libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386<br />
</syntaxhighlight><br />
<br />
===Compile U-Boot===<br />
<br />
Download U-Boot source code and compile it. Please note it is in the branch "nanopi":<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/uboot_nanopi.git<br />
cd uboot_nanopi<br />
git checkout nanopi<br />
make nanopi_config<br />
make<br />
</syntaxhighlight><br />
<br />
After your compilation succeeds a u-boot.bin will be generated. If you want to test it please flash it to your MicroSD card by running the "fusing.sh" script.<br /><br />
If your SD card's device name is "/dev/sdd" please run the following command as "root":<br />
<syntaxhighlight lang="bash"><br />
su<br />
./fusing.sh /dev/sdd<br />
</syntaxhighlight><br />
Note: this operation will remove all the data in the SD card.<br />
<br />
===Compile Linux kernel===<br />
====Compile Kernel====<br />
Please download kernel source code and compile it<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/linux-4.x.y.git<br />
cd linux-4.x.y<br />
git checkout nanopi-v4.1.y<br />
make nanopi_defconfig<br />
touch .scmversion<br />
make<br />
</syntaxhighlight><br />
The kernel that the NanoPi uses is "nanopi-v4.1.y". Please make sure you get the correct branch. After your compilation succeeds a new file "arch/arm/boot/zImage" will be generated<br />
<br />
====Compile Kernel Modules====<br />
In general kernel compilation generates kernel modules such as ipv6, netfilter and etc. If you want to add your own modules to the kernel or you changed your kernel configurations you need to recompile these new modules and pack them as a new "kernel-modules.tgz" to replace the corresponding file "basefs/kernel-modules.tgz" in "Rootfs"<br /><br />
please run the following commands as root to install ".ko" to /tmp/nanopi-modules:<br />
<syntaxhighlight lang="bash"><br />
make INSTALL_MOD_PATH=/tmp/nanopi-modules modules_install<br />
</syntaxhighlight><br />
Please strip your kernel modules and create a new package<br />
<syntaxhighlight lang="bash"><br />
cd /tmp/nanopi-modules/lib/<br />
find . -name \*.ko | xargs arm-linux-strip --strip-unneeded<br />
tar czvf kernel-modules.tgz modules/<br />
</syntaxhighlight><br />
If you want to test your newly generated kernel modules you can copy them to your MicroSD card's "rootfs/lib":<br />
We assume your MicroSD card was already mounted to "/media/fa/NANOPI" please run the following commands as root:<br />
<syntaxhighlight lang="bash"><br />
rm -rf /media/fa/NANOPI/lib/modules/<br />
tar xzvf kernel-modules.tgz -C /media/fa/NANOPI/lib/<br />
</syntaxhighlight><br />
<br />
===Make File System===<br />
====File System for Debian====<br />
By default we install a Debian system to the NanoPi, which can be obtained from the following repository:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/sd-fuse_nanopi.git<br />
cd sd-fuse_nanopi/prebuilt/<br />
ls -l rootfs.tgz<br />
</syntaxhighlight><br />
If you want to customize it you can uncompress "rootfs.tgz", edit its components and tar it. Here is an example showing how you can do it:<br />
<syntaxhighlight lang="bash"><br />
tar xzf rootfs.tgz <br />
dpkg -i --force-all --root=./rootfs /tmp/qtembedded-4.8.5_armel.deb <br />
tar czf rootfs.tgz rootfs<br />
</syntaxhighlight><br />
<br />
====File System for Rabbit Linux====<br />
Another Linux system we provide is Rabbit Linux which is open source. You can work on it as "root" by following the steps below:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/rootfs_nanopi.git<br />
cd rootfs_nanopi<br />
git checkout nanopi<br />
su<br />
make && make install && make strip<br />
</syntaxhighlight><br />
<br />
If the compilation is successful you will observe the following messages:<br />
<syntaxhighlight lang="bash"><br />
RootFS (core) successfully installed to:<br />
/tmp/FriendlyARM/nanopi/rootfs<br />
<br />
Copyright 2015 FriendlyARM (http://www.arm9.net/)<br />
</syntaxhighlight><br />
<br />
The information above indicates that the generated file system is located under "/tmp/FriendlyARM/nanopi/rootfs". We will make it a package by running the following commands:<br />
<syntaxhighlight lang="bash"><br />
cd /tmp/FriendlyARM/nanopi<br />
tar czvf rootfs.tgz rootfs/<br />
</syntaxhighlight><br />
<br />
<div id="BuildMicroSDCard"></div><br />
<br />
===Make an Installation MicroSD Card with Your Own Files===<br />
====Make Your Own System====<br />
Please download the SD card fuse utility and switch to the correct "master" branch:<br />
<syntaxhighlight lang="bash"><br />
git clone https://github.com/friendlyarm/sd-fuse_nanopi.git<br />
cd sd-fuse_nanopi<br />
git checkout master<br />
</syntaxhighlight><br />
<br />
Under "sd-fuse_nanopi" there is a "prebuilt" which contains the files that a system needs: <br /><br />
Bootloader: u-boot.bin <br /><br />
Kernel Command Parameters: sdenv.raw <br /><br />
Linux Kernel: zImage <br /><br />
File System Package: rootfs.tgz <br /><br />
<br />
You can replace one or multiple of these files with the ones you generated on your own in the previous steps and then run the following command to flash them to your MicroSD card. Please note that you need to run these commands under the "sd-fuse_nanopi" directory.<br />
<syntaxhighlight lang="bash"><br />
su<br />
./fusing.sh /dev/sdx<br />
</syntaxhighlight><br />
(Note: please replace /dev/sdx with your SD card's device name)<br />
<br />
After it is done you can play with your new OS with this card.<br />
<br />
====Change U-Boot Environment Variables====<br />
After you boot your NanoPi you can check the U-Boot environment variables by running the following command:<br />
<syntaxhighlight lang="bash"><br />
fw_printenv bootargs<br />
</syntaxhighlight><br />
If you want to change variables (e.g. adding an LCD variable) you can do it this way:<br />
<syntaxhighlight lang="bash"><br />
fw_setenv bootargs root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init console=ttySAC0,115200 lcd=S70<br />
</syntaxhighlight><br />
<br />
If you want to port an existing SD card's all environment variables you can to insert it to a host and export its environment variables to a new sdenv.raw by running the following commands and then replace the "prebuilt/sdenv.raw" with this new file: <br />
<syntaxhighlight lang="bash"><br />
cd sd-fuse_nanopi<br />
./readenv.sh /dev/sdd<br />
cp sdenv.raw prebuilt/<br />
</syntaxhighlight><br />
<br />
====Comments on SD Card's "RAW" File====<br />
There is a known issue with the S3C2451: when iROM boots with SDHC card, calculated card size is smaller than original card size, exactly 1024 blocks so SDHC card has additional reserved blocks(512Kbyte). The S3C2451's iROM reads a bootloader from the end of an SD card. The results in an issue that when the iROM reads a regular SD card and an SDHC card of the same size it will get different positions. In addition different SD cards have different sizes. Therefore it is impossible to create a universal RAW file for all SD cards.<br /><br />
If you have multiple SD cards of the same size and one of them is flashed with a complete system you can use "dd" under Linux to read its data and save it as a RAW file and then dump it to all the other SD cards.<br /><br />
For an SD card whose size is greater than 8 GB it takes much longer time to write a RAW file to it. On general our rootfs is only about 23 MB it will be much faster to run a script file making an SD card.<br />
<br />
==Related Links==<br />
===Connect Camera===<br />
===Connect TFT LCD===<br />
[[File:NanoWithP43.png|frameless|400px|P43 LCD]]<br /><br />
The NanoPi can work with FriendlyARM's LCDs: H43,S70,A70,W50,A97,L80,G10,A56,W101,W35,P43,P35,TD35.<br /><br />
<br /><br />
Please follow the steps below:<br /><br />
1) If you connect your NanoPi to a PC host via a mini USB cable its power may not be enough and you will need to connect an additional 5V 2A power to the board's GPIO's VDD_5V and DGND;<br /><br />
2) You need to add an LCD variable in U-boot. For example if you want to connect your NanoPi to an S70 LCD you can do it this way:<br /><br />
<br /><br />
Firstly list the current environment variables:<br />
<syntaxhighlight lang="bash"><br />
fw_printenv bootargs<br />
</syntaxhighlight><br />
<br /><br />
Here is the list<br /><br />
bootargs=root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init console=ttySAC0,115200<br /><br /><br />
Append "lcd=S70" to "bootargs=" and reset the list with "fw_setenv"<br />
<syntaxhighlight lang="bash"><br />
fw_setenv bootargs root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init console=ttySAC0,115200 lcd=S70<br />
</syntaxhighlight><br />
<br /><br />
Reboot your board you will see Debian on the LCD.<br> <br><br />
<br />
Download Qt and tslib Packages:<br />
<syntaxhighlight lang="bash"><br />
apt-get update<br />
apt-get install qtembedded<br />
apt-get install friendlyarm-tslib <br />
</syntaxhighlight><br />
The qtemebdded is the library Qt4 relies on. The friendlyarm-tslib is the library touch functions and screen calibration rely on. <br> <br><br />
<br />
Run Qt Sample Application:<br />
<syntaxhighlight lang="bash"><br />
. /usr/bin/setqt4env<br />
/usr/local/Trolltech/QtEmbedded-4.8.5-arm/examples/tetrix -qws<br />
</syntaxhighlight><br />
The setqt4env script sets the environmental variables which Qt and tslib rely on. If it is run on a platform for the first time a screen calibration GUI will be launched. Users need to go through a five-point calibration process to calibrate the screen.<br><br />
The tetrix application is a game developed in Qt4 and it runs as follows.<br><br />
[[File:nanopi_with_s70.jpg|frameless|400px|]]<br />
<br />
===Connect Matrix DIY Modules===<br />
[[Matrix - Buzzer#NanoPi|Matrix - Buzzer]]<br />
<br />
<br />
==NanoPi Applications==<br />
===4.3" Mini Computer===<br />
===Wireless Intelligent Vehicle===<br />
<br />
==Resources==<br />
* [Schematic]( [http://wiki.friendlyarm.com/wiki/images/f/f0/NanoPi-1507-Schematic.pdf NanoPi-1507-Schematic.pdf])<br />
* [Dimensions]( [http://wiki.friendlyarm.com/wiki/images/3/37/NanoPi-1507-Dimesions%28dxf%29.zip NanoPi-1507-Dimesions(dxf).zip ])<br />
* [S3C2451 Datasheet]([http://wiki.friendlyarm.com/wiki/images/b/b9/S3C2451_UM_REV1.1.pdf S3C2451_UM_REV1.1.pdf])<br />
* [RT8059 Datasheet]( [http://www.richtek.com/assets/product_file/RT8059/DS8059-05.pdf RT8059.pdf])<br />
* [XC6209 Datasheet]( [http://www.torex.co.jp/english/products/discon/item/53-XC6209_12.pdf XC6209.pdf])<br />
* [DDR2 RAM Datasheet]( [http://www.samsung.com/global/business/semiconductor/file/2011/product/2011/7/18/148752ds_k4t51xx3qi_rev11.pdf K4T51163QI_rev1.1.pdf])<br />
* [AP6210 Datasheet]( [http://wiki.friendlyarm.com/wiki/images/7/77/AP6210_V1.2_12262012.pdf AP6210_V1.2_12262012.pdf])</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Micro2451&diff=1128Micro24512016-02-10T04:36:56Z<p>Adminhammer: </p>
<hr />
<div>==Introduction==<br />
[[File:Micro2451-C01.png|thumb|Overview]]<br />
[[File:Micro2451-A01.png|thumb|Front]]<br />
[[File:Micro2451-B01.png|thumb|Back]]<br />
The Micro2451 CPU board is an ARM9 embedded system that uses the Samsung's ARM926EJ S3C2451 System On Chip (SOC). Its clock is 400M Hz and can be up to 533MHz. As an ideal successor of the Mico2440 it has better performance and lower power consumption.<br />
<br />
The Micro2451 CPU board's pin specifications are identical to the Micro2440 CPU board's and therefore they work with the same carrier board.<br />
<br />
==Features==<br />
* CPU: Samsung S3C2451,Running at 400Mhz<br />
* RAM: 64M DDR2<br />
* Flash: 256MB SLC NandFlash Default , 1GB Optional<br />
* MicroSD x1:Boot and Storage<br />
* MicroUSB x1:Power Supply Only<br />
* LEDs x5:Power LED x1,User LEDs x4<br />
* Reset Button<br />
* 2.0mm Breakout Headers x3,Include:<br />
** UARTs x3<br />
** I2C x1<br />
** PWMs x4<br />
** USB 1.1 HOST x1<br />
** USB 2.0 Device x1<br />
** MMC/SDIO x1<br />
** IIS x1<br />
** ADCs x7<br />
** SROM Bus 25-bit Address, 16-bit Data and 5 Chip Select<br />
** RGB LCD 24-bit Interface x1<br />
** DVP Camera Interface x1<br />
** Configurable GPIOs or External Interrupts x22<br />
<br />
==Interfaces==<br />
===Breakout Header Definitions===<br />
[[File:Micro2451-1506-if.png |thumb|400px|Micro2451-1506 Breakout]]<br />
* P1<br />
::{| class="wikitable"<br />
|-<br />
|P1 Pin# || PCB Pin# || Name || P1 Pin# || PCB Pin# || Name <br />
|-<br />
|1 || 1 || VDD_5V || 2 || 2 || DGND<br />
|-<br />
|3 || 3 || EINT19/GPG11 || 4 || 4 || EINT18/GPG10<br />
|-<br />
|5 || 5 || EINT17/GPG9 || 6 || 6 || EINT16/GPG8<br />
|-<br />
|7 || 7 || EINT15/GPG7 || 8 || 8 || EINT14/GPG6<br />
|-<br />
|9 || 9 || EINT13/GPG5 || 10 || 10 || EINT11/GPG3<br />
|-<br />
|11 || 11 || EINT12/GPG4 || 12 || 12 || EINT6/GPF6<br />
|-<br />
|13 || 13 || EINT5/GPF5 || 14 || 14 || EINT4/GPF4<br />
|-<br />
|15 || 15 || EINT3/GPF3 || 16 || 16 || EINT2/GPF2<br />
|-<br />
|17 || 17 || EINT1/GPF1 || 18 || 18 || EINT0/GPF0<br />
|-<br />
|19 || 19 || GPL5 || 20 || 20 || MMC0CLK<br />
|-<br />
|21 || 21 || MMC0CMD || 22 || 22 || MMC0DATA2<br />
|-<br />
|23 || 23 || MMC0DATA3 || 24 || 24 || MMC0DATA0<br />
|-<br />
|25 || 25 || MMC0DATA1 || 26 || 26 || BOOT_CS<br />
|-<br />
|27 || 27 || NC || 28 || 28 || M_nRESET<br />
|-<br />
|29 || 29 || DM_UDEV || 30 || 30 || DP_UDEV<br />
|-<br />
|31 || 31 || DM_UHOST || 32 || 32 || DP_UHOST<br />
|-<br />
|33 || 33 || AIN2 || 34 || 34 || RTC_BATT<br />
|-<br />
|35 || 35 || AIN0 || 36 || 36 || AIN1<br />
|-<br />
|37 || 37 || TOUT2/GPB2 || 38 || 38 || TOUT3/GPB3<br />
|-<br />
|39 || 39 || TCLK/GPB4 || 40 || 40 || IIS0LRCK<br />
|-<br />
|41 || 41 || IIS0SCLK || 42 || 42 || IIS0CDCLK<br />
|-<br />
|43 || 43 || IIS0SDI || 44 || 44 || IIS0SDO<br />
|-<br />
|45 || 45 || TOUT0/GPB0 || 46 || 46 || EINT10/GPG2<br />
|-<br />
|47 || 47 || UART2_TX || 48 || 48 || UART2_RX<br />
|-<br />
|49 || 49 || UART1_TX || 50 || 50 || UART1_RX<br />
|- <br />
|51 || 51 || UART0_TX || 52 || 52 || UART0_RX<br />
|-<br />
|53 || 53 || UART0_CTS || 54 || 54 || USRT0_RTS<br />
|-<br />
|55 || 55 || I2C0SDA || 56 || 56 || I2C0SCL<br />
|}<br />
* P2<br />
::{| class="wikitable"<br />
|-<br />
|P2 Pin# || PCB Pin# || Name || P2 Pin# || PCB Pin# || Name <br />
|-<br />
|1 || 57 || AIN6/YM || 2 || 58 || AIN7/YP<br />
|-<br />
|3 || 59 || AIN8/XM || 4 || 60 || AIN9/XP<br />
|-<br />
|5 || 61 || LCD R-bit6 || 6 || 62 || LCD R-bit7<br />
|-<br />
|7 || 63 || LCD R-bit4 || 8 || 64 || LCD R-bit5<br />
|-<br />
|9 || 65 || LCD R-bit2 || 10 || 66 || LCD R-bit3<br />
|-<br />
|11 || 67 || LCD R-bit0 || 12 || 68 || LCD R-bit1<br />
|-<br />
|13 || 69 || LCD G-bit6 || 14 || 70 || LCD G-bit7<br />
|-<br />
|15 || 71 || LCD G-bit4 || 16 || 72 || LCD G-bit5<br />
|-<br />
|17 || 73 || LCD G-bit2 || 18 || 74 || LCD G-bit3<br />
|-<br />
|19 || 75 || LCD G-bit0 || 20 || 76 || LCD G-bit1<br />
|-<br />
|21 || 77 || LCD B-bit6 || 22 || 78 || LCD B-bit7<br />
|-<br />
|23 || 79 || LCD B-bit4 || 24 || 80 || LCD B-bit5<br />
|-<br />
|25 || 81 || LCD B-bit2 || 26 || 82 || LCD B-bit3<br />
|-<br />
|27 || 83 || LCD B-bit0 || 28 || 84 || LCD B-bit1<br />
|-<br />
|29 || 85 || TOUT1/GPB1 || 30 || 86 || LCD DEN<br />
|-<br />
|31 || 87 || LCD VSYNC || 32 || 88 || LCD HSYNC <br />
|-<br />
|33 || 89 || LCD CLK || 34 || 90 || GPC0<br />
|-<br />
|35 || 91 || Camera DATA7 || 36 || 92 || Camera DATA6<br />
|-<br />
|37 || 93 || Camera DATA5 || 38 || 94 || Camera DATA4<br />
|-<br />
|39 || 95 || Camera DATA3 || 40 || 96 || Camera DATA2<br />
|-<br />
|41 || 97 || Camera DATA1 || 42 || 98 || Camera DATA0<br />
|-<br />
|43 || 99 || Camera XCLK || 44 || 100 || Camera PCLK<br />
|-<br />
|45 || 101 || Camera VSYNC || 46 || 102 || Camera HREF<br />
|-<br />
|47 || 103 || EINT20/GPG12 || 48 || 104 || GPJ12<br />
|-<br />
|49 || 105 || VDD_5V || 50 || 106 || DGND<br />
|}<br />
* P3<br />
::{| class="wikitable"<br />
|-<br />
|P3 Pin# || PCB Pin# || Name || P3 Pin# || PCB Pin# || Name <br />
|-<br />
|1 || 107 || EINT7/GPF7 || 2 || 108 || EINT9/GPG1<br />
|-<br />
|3 || 109 || nRCS1/GPA12 || 4 || 110 || nRCS3/GPA14<br />
|-<br />
|5 || 111 || nRCS2/GPA13 || 6 || 112 || nRCS5/GPA16<br />
|-<br />
|7 || 113 || nRCS4/GPA15 || 8 || 114 || nRWE<br />
|-<br />
|9 || 115 || nROE || 10 || 116 || nRSTOUT<br />
|-<br />
|11 || 117 || nWAIT || 12 || 118 || nXDACK0/GPB9<br />
|-<br />
|13 || 119 || SROM ADDR0 || 14 || 120 || nDREQ0/GPB10<br />
|-<br />
|15-38 || 121-144 || SROM ADDR1-24 || || ||<br />
|-<br />
|39-54 || 145-160 || SROM DATA0-15 || || ||<br />
|-<br />
|55 || 161 || VDD_5V || 56 || 162 || DGND<br />
|}<br />
:Some Pin Descriptions:<br />
::#VDD_5V: 4.7-5.6V power supply input. 5V/500mA is recommended.<br />
::#BOOT_CS: Boot mode select signal input. When BOOT_CS is floating or high level, Micro2451 will boot from MicroSD card, otherwise boot from NandFlash. BOOT_CS is also connected to the boot mode switch. So, if you used BOOT_CS in your project, the boot mode switch should on SD side (BOOT_CS flaoting).<br />
::#M_nRESET:Manual reset input, active low.<br />
::#DM_UDEV&DP_UDEV:USB 2.0 Device<br />
::#DM_UHOST&DP_UHOST: USB 1.1 Host. 15K pull-down resistors is necessary.<br />
::#RTC_BATT:3V RTC backup battery input.<br />
::#AIN0-AIN2,AIN6-AIN9:Input channels of S3C2451 SOC 12-Bit ADC. Channel 0-2,and channel 6-9, voltage input rang: 0-3.3V<br />
<br />
===Boot Mode Switch, MicroSD and MicroUSB===<br />
* Boot Mode Switch:On SD side, boot from MicroSD card. On NAND side, boot from NandFlash<br />
* MicroSD:Boot and Storage. <br />
* MicroUSB:Power supply only<br />
<br />
==Dimensions==<br />
[[File:Micro2451-1506-Dimensions.png |frameless|400px| Micro2451-1506 机械尺寸]]<br />
:More detail: [http://wiki.friendlyarm.com/wiki/images/9/9a/Micro2451-1506-Dimensions%28dxf%29.zip Micro2451-1506-Dimensions(dxf).zip]<br />
<br />
==Resources==<br />
* Schematic ( [http://wiki.friendlyarm.com/wiki/images/f/fc/Micro2451-1506-Schematic.pdf Micro2451-1506-Schematic.pdf] )<br />
* Dimensions ( [http://wiki.friendlyarm.com/wiki/images/9/9a/Micro2451-1506-Dimensions%28dxf%29.zip Micro2451-1506-Dimensions(dxf).zip] )<br />
* S3C2451 Datasheet ( [http://www.mediafire.com/view/i79d7v49hp0jca2/S3C2451_UM_REV1%5B1%5D.pdf S3C2451_UM_REV1.10.pdf] )</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=File:%E9%9F%B3%E4%B9%90%E7%9B%92.png&diff=843File:音乐盒.png2016-02-05T22:00:48Z<p>Adminhammer: 1 revision imported</p>
<hr />
<div></div>Adminhammerhttp://wiki.andahammer.com/index.php?title=MediaWiki:Sidebar&diff=845MediaWiki:Sidebar2016-02-05T22:00:48Z<p>Adminhammer: 1 revision imported</p>
<hr />
<div>* Navigation<br />
** Main Page#GettingStarted|Getting Started<br />
** Main Page#Learning|Learning<br />
* Products<br />
** Main Page#CPUBoards|CPU Boards<br />
** Main Page#CarrierBoards|Carrier Boards<br />
** Main Page#NanoPCSeries|NanoPC Series<br />
** Main Page#MiniBoards|Mini Boards<br />
** Main Page#Matrix|Matrix<br />
** Main Page#LCDModules|LCD Modules<br />
** Main Page#3DModels|3D Models<br />
** Main Page#Accessories|Accessories<br />
* FAQ<br />
** Linux FAQ|Linux<br />
** Ubuntu FAQ|Ubuntu<br />
** Android FAQ|Android<br />
** WindowsCE FAQ| WindowsCE<br />
** Qt FAQ|Qt<br />
** Non-OS FAQ|Non-OS<br />
* Support<br />
** http://www.friendlyarm.com|English WebSite<br />
** http://www.friendlyarm.net|English Forum<br />
** http://www.arm9.net|中文官方网站<br />
** http://www.arm9home.net|中文论坛<br />
** https://github.com/friendlyarm|FriendlyARM Github<br />
* SEARCH<br />
* TOOLBOX<br />
* LANGUAGES</div>Adminhammerhttp://wiki.andahammer.com/index.php?title=Template:LCD_Modules&diff=847Template:LCD Modules2016-02-05T22:00:48Z<p>Adminhammer: 1 revision imported</p>
<hr />
<div>===LCD Modules===<br />
{| border="0" cellpadding="10" width="100%"<br />
|-<br />
|width="32%" valign="top" align="left"|<br />
*[[LCD-S700]]<br />
*[[LCD-S70]]<br />
*[[LCD-S70D]]<br />
*[[LCD-S702]]<br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[LCD-HD700]]<br />
*[[LCD-W101]]<br />
*[[LCD-HD101]] <br />
<br />
|width="32%" valign="top" align="left"|<br />
*[[ LCD-P43]]<br />
*[[LCD-TD35]] <br />
*[[LCD-P35]]<br />
<br />
|}</div>Adminhammer