Linxu conj2016 96boards

46
Programming IoT Sensors with IoTDK on 96Boards Akira Tsukamoto, Linaro July 13, 2016

Transcript of Linxu conj2016 96boards

Page 1: Linxu conj2016 96boards

Programming IoT Sensors with IoTDK on 96Boards

Akira Tsukamoto, LinaroJuly 13, 2016

Page 2: Linxu conj2016 96boards

What is Linaro?

▣ Founded June 2010

▣ Unites the Industry and Open Source community

▣ Work together on key projects

▣ Deliver great tools

▣ Reduce industry wide fragmentation and redundant effort

▣ Provide common software foundations

▣ http://www.linaro.org/about/

▣ https://en.wikipedia.org/wiki/Linaro

Page 3: Linxu conj2016 96boards

➢ARM 向けソフトウェアの共同開発により➢ARMのエコシステムの充実をすすめ ➢メンバー企業の競争力を高めることを目的とする

Linaro’s Mission

ARM SoC

Open SourceFuture ARM tech porting

KernelOptimizing gcc

Optimizing graphics, etc.

Internal patchesSoC specific code

Closed SourceApplications

Proprietary code

各社共通課題

各社差異化ポイント

イノベーションの高速化が著しい

ROIの向上共同開発

~ Leading Collaboration in ARM Eco System

Page 4: Linxu conj2016 96boards

Linaro のメリット

Linaroは、ARM を利用したいセットベンダーが商品化するうえで、必須である Android/RDK/Yocto/BSP などプラットフォーム部分の最新技術をメンバー企業で共同開発する組織です。

具体的なメリット最近はソフトの開発コストの増大が問題となっておりますが、すべて自前で自社で開発するコストをメンバー企業で分担できる。ARM のプラットフォーム開発に内部で参加していることで、顧客に対して他社より最新の技術とプラットフォームの提供につながる。グローバルノウハウを製品開発に活用することで、製品の魅力の向上につながる。マーケットイン(Time to Market)の早期化

Page 5: Linxu conj2016 96boards

Important Strategic Projects for the ARM Ecosystem● Open Source ARM tools● Power Management● Kernel Consolidation across ARM SoCs● Open Source Security (including OP-TEE)● Reference Software Platform● Software Defined Architecture - Openstack (LEG)● Big Data on ARM (LEG)● OpenDataPlane (LNG)● Reference Digital Media Platform (LHG)● Android Optimization on ARM (LMG)● Project Ara (LMG)

Lead Projects

Page 6: Linxu conj2016 96boards

● Linux Kernels 3.5 - 4.5 May 2012 - March 2016● Over ¼ million total changesets

in these releases● Linaro contributed >4.4%

(11.2k)● Linaro consistently in top five

company contributors

Linaro Influence in the Linux Kernel

Sources: http://www.remword.com/kps_result/index.php & https://lwn.net/Articles/679289/

Top Linux Contributors by Company: Kernel 4.5

1 Intel 1,734 (14.4%)

2 (Unknown) 975 (8.1%)

3 Red Hat 732 (6.1%)

4 Linaro 723 (6.0%)

5 (None) 628 (5.2%)

6 Samsung 513 (4.3%)

7 SUSE 382 (3.2%)

8 Atmel 380 (3.2%)

9 Renesas 360 (3.0%)

10 IBM 346 (2.9%)

Page 7: Linxu conj2016 96boards

Linaro Influence - Maintainerships

● ARM SOC● CPUIdle drivers● CPUFreq drivers● Common clock framework● Clocksource core● Clocksource / Clockevent drivers● Timekeeping / NTP● Char and Misc drivers● Generic include / asm headers● KVMfor ARM/ARM64● Open Firmware / Flattened Device Tree● Mailbox API● AVS drivers● Backlight class / subsystem● MFD framework● GPIO subsystem● Pinctrl subsystem● SPI subsystem● Regulator framework● RapidIO subsystem

● Linux Kernel ● Linux Kernel (Continued)● Register map abstraction● Sound / ASoC● DMA buffer sharing framework

● MMC/SD/SDIO framework

● Non-kernel projects● ODP● LAVA● Debian● DejaGNU● LLVM● GDB● Gentoo● KDE● Xdg-utils● OpenJDK● OpenEmbedded● OpenMandriva

Page 8: Linxu conj2016 96boards

What’s 96Boards?▣ Recognised low cost ARMV7/8 open specifications

▣ SoC independant

▣ Tailored for different segment requirements

▣ A single developer community, sharing solutions

▣ Open to all developers

▣ Hardware modules are portable across all 96Boards

▣ Fully upstream path available for 96Boards hardware

Page 9: Linxu conj2016 96boards

▣ Generic hardware platform enabling SoC differentiation

▣ Key enabler for reference software platform

▣ Mezzanine ecosystem for peripherals & sensors

IoT EditionCortex-A & R/M

Consumer Edition

Cortex-A

Enterprise Edition

Cortex-A

LinaroGroups

96BoardsEditions

Cross vendor community hardware

Page 10: Linxu conj2016 96boards

Target for 96Boards

Sources: *IDC 2013, **ITRS 2007, **IBS 2009

▣ Commercial & higher education

software development

▣ OEM/ODMs - for IoT, mobile,

compute, enterprise

▣ Maker market - Robotics, UAV, HPC,

etc

20 million

SW

developers globally*

Software >60%

of cost of SoC

development**

HWPro

HobbyistSW

Page 11: Linxu conj2016 96boards

96Boards Specifications

▣96Boards CE - Published

○Camera Interface Addendum

▣96Boards EE - Published

○MicroATX Addendum

Page 12: Linxu conj2016 96boards

96Boards Use Cases

▣ Out of the box Single Board Computer for software developers

▣ Expansion and customization options for the maker community

▣ Low-cost Single Board Computer for embedded OEM products

Page 13: Linxu conj2016 96boards

*#5 in top 10 best Hacker Boards of 2015* linux.com June 2015

*QualcommDragonBoard 410C

LeMaker CelloAMD Opteron A1120 96Boards EE

LeMaker HiKey

uCRoboticsBubblegum-96

MediaTek Helio X20 dev board with deca-core CPU

OSAWG:Open SoC Android Working Group

Qualcomm SD 600evalTV

Page 14: Linxu conj2016 96boards

DragonBoard 410c

Supported OSes

Supported IoT Platforms

Page 15: Linxu conj2016 96boards

▣ Minimum 0.5GB DRAM (1GB+ for Android)▣ Optional eMMC Flash Storage▣ 802.11a/b/g/n + Bluetooth 4.0 LE▣ 3 USB ports (1 OTG), minimum USB2.0▣ HDMI video output with audio▣ microSD v3.0 socket▣ Standardized Maker IO, DSI display & CSI camera interfaces▣ Extended version for additional functionality▣ 8-18V DC @ 2A power

CE Boards Additional Specs

Page 16: Linxu conj2016 96boards

96Boards EE - Product Introduction

LeMaker Cello

AMD Opteron A1120, Quad-core A57

GBit Ethernet, USB 3.0, PCIe and SATA

UEFI/ACPI firmware

Supported by Linaro Reference Software

Preorder today for July delivery $299

http://www.lenovator.com/product/103.html

Page 17: Linxu conj2016 96boards

96Boards EE - Product SpecificationITEM SPECIFICATION

SoC AMD Opteron A1100 Series

CPU Quad-core ARM Cortex-A57 64 bit

DRAM Two DDR3 SO-DIMM sockets

SATA Two SATA ports

USB Two USB 3.0 ports

Console USB-micro port for console support

Ethernet 1 GBe Ethernet

PCIe x16 PCIe G3 slot

JTAG 10-Pin JTAG headers

Expansion Interface Linaro 96Boards Expansion slot

Dimension Standard 160×120 mm 96Boards Enterprise Edition form factor

Weight 500g

Page 18: Linxu conj2016 96boards

Google AOSP

Support for HiKey 64 bit Octa Cortex-A53 96Boardsis now available in AOSP public treehttp://source.android.com/

A community board with ongoing support in AOSP will help developers and peripheral vendors to accelerate adoption in new Android versions

Page 19: Linxu conj2016 96boards

▣96Boards platforms offer standardised hardware platforms and reference software

▣Generic hardware platform supporting implementations at

◆ Device - IoT specification

◆ Gateway - CE/EE specification

◆ Server - EE specification, running server infrastructure and cloud IaaS

▣Reference software solutions

◆ End-to-end reference implementation for IoT use cases, tailored to implementation

◆ Device - SDK together with Mezzanine kits

◆ Gateway - SDK, middleware, application gateway

◆ Server - PaaS reference solution

Platform Deployment Example

Page 20: Linxu conj2016 96boards

▣Enable product design and application development

▣Build once and run on any 96Boards Compliant hardware

▣Developer support infrastructure

▣Enables a developer community around peripheral devices

for SoCs (Communications, Sensors, Displays & Cameras)

Mezzanine Boards and Modules

Page 21: Linxu conj2016 96boards

STMicro and SeeedMezzanines

LeMaker 7” LCD touchscreen display

Aerocore-2 drones & Quadcopters

Eureka Automotive

Dual-camera module with Display

Camera MezzanineMarvell Andromeda Box

Robomezzi

Page 22: Linxu conj2016 96boards

All the others...

Page 23: Linxu conj2016 96boards

How IoT Sensors are connected?

Page 24: Linxu conj2016 96boards

GPIO pins are especially good to use when programming simple sensors or actuators which only require single data line.

For example:• LEDs, Relays, Buzzers, Buttons, Passive Infrared sensor (PIR)• Many more!

GPIO

SoCSensor CSensor BSensor A

GPIO_AGPIO_BGPIO_C

Separate line for each Sensor

Page 25: Linxu conj2016 96boards

I2C

SoCSensor CSensor BSensor A

SDA (data)SCL (clock)

Shared line for all Sensors

I2C pins are especially good to use when programming more complex sensors or actuators which require multiple data lines.

For example:• Ultrasonic sensors, Stepper motors and servos, LCD screen, LED

matrices• Many more!

Page 26: Linxu conj2016 96boards

Why IoTDK is good?

Page 27: Linxu conj2016 96boards

Requires implementing same code for every boards.

All different codes of Sensors on GPIO, I2C

Raspberry Pi 96Boards X 96Boards Y

API of GPIO, I2CKernel and SoC

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

API of GPIO, I2CKernel and SoC

API of GPIO, I2CKernel and SoC

Sensor programs Y Sensor programs Z

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Page 28: Linxu conj2016 96boards

Requires implementing same code for every boards.

All different codes of Sensors on GPIO, I2C (2/2)

Raspberry Pi 96Boards X 96Boards Y

API of GPIO, I2CKernel and SoC

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

API of GPIO, I2CKernel and SoC

API of GPIO, I2CKernel and SoC

Sensor programs Y Sensor programs Z

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

APIs are all different

Page 29: Linxu conj2016 96boards

Unifying codes of Sensors on GPIO, I2C

Common API Common API Common API

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

Raspberry Pi

Able to use same code

API of GPIO, I2CKernel and SoC

API of GPIO, I2CKernel and SoC

API of GPIO, I2CKernel and SoC

96Boards X 96Boards Y

Page 30: Linxu conj2016 96boards

Good isn’t it? ☺

Which part is libmraa and libupm?

Common API Common API Common API

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

Sens

or A

GPI

OSe

nsor

B I

2CSe

nsor

C I

2C

Sensor programs X

Raspberry Pi

libupm

libmraaAPI of GPIO, I2CKernel and SoC

API of GPIO, I2CKernel and SoC

API of GPIO, I2CKernel and SoC

96Boards X 96Boards Y

Page 31: Linxu conj2016 96boards

Many Drivers of Sensors are already implemented

http://iotdk.intel.com/docs/master/upm/modules.html

Page 32: Linxu conj2016 96boards

How to program Sensors on Linux?

Page 33: Linxu conj2016 96boards

Internet Connection

WIFI $ nmtui orUSB-Ethernet adaptor

Page 34: Linxu conj2016 96boards

Installing libmraa and libupm (IoTDK)Commands:$ sudo apt-get install libmraa-dev libupm-dev

The command above will install the following four packages:• libmraa0: contains only libraa run-time library• libmraa-dev: includes header files to compile program using

libmraa• libupm0: contains only libupm run-time library• libupm-de: includes header files to compile program using

libupm

Page 35: Linxu conj2016 96boards

Connecting Grove RGB backlight LCD, I2C

Page 36: Linxu conj2016 96boards

Download, build and run sample program

Commands:

$ git clone https://github.com/96boards/Starter_Kit_for_96Boards$ cd Starter_Kit_for_96Boards$ cd rgb_lcd_demo$ make$ sudo ./rgb_lcd_demo

Page 37: Linxu conj2016 96boards

Inside the sample program #1, I2C (1/2)

upm::Jhd1313m1* lcd;

string str1 = "96Boards!"; string red = "fantastic :)";

lcd = new upm::Jhd1313m1(I2C_BUS, 0x3e, 0x62);

display(lcd, str1, red, RGB_RED);

delete lcd;

Page 38: Linxu conj2016 96boards

Inside the sample program #1, I2C (2/2)

void display(upm::Jhd1313m1* lcd, string str1, string str2, int red, int green, int blue) {

lcd->clear(); lcd->setColor(red, green, blue); lcd->setCursor(0,0); /* first row */ lcd->write(str1); lcd->setCursor(1,0); /* second row */ lcd->write(str2);

}

Page 39: Linxu conj2016 96boards

Build and run sample program #1, I2C

BuildCommands:$ g++ rgb-lcd-demo.cpp -o rgb-lcd-demo -g -Wall -lupm-i2clcd

RunningCommands:$ sudo ./rgb-lcd-demo

Page 41: Linxu conj2016 96boards

Connecting Grove LED module, GPIO

Page 42: Linxu conj2016 96boards

Inside the sample program #2, GPIO

mraa::Gpio* gpio; gpio = new mraa::Gpio(GPIO_E); gpio->dir(mraa::DIR_OUT); /* DIR_IN exist too*/while (true) {

gpio->write(0); sleep(SLEEP_TIME); gpio->write(1); sleep(SLEEP_TIME);

} delete gpio;

Page 43: Linxu conj2016 96boards

Build and run sample program #2, GPIO

BuildCommands:$ g++ led-gpio-demo.cpp -o led-gpio-demo -g -Wall -lmraa

RunningCommands:$ sudo ./led-gpio-demo

Page 44: Linxu conj2016 96boards

Linaro のホームページhttp://www.linaro.org/

Linaro の技術情報ページhttps://wiki.linaro.org/FrontPage

Linaro のダウンロードページhttp://www.linaro.org/downloads/https://wiki.linaro.org/Cycles/1509/Release

96boards のホームページhttps://www.96boards.org/

96boards の技術情報ページhttps://github.com/96boards/documentation/wiki

96boards の開発ページhttps://github.com/96boards

96boards の規格書https://www.96boards.org/ce-specificationhttps://www.96boards.org/ee-specification

Collaborate in Linaro for IoT Success

Page 45: Linxu conj2016 96boards

96Boards.org

Questions?

Page 46: Linxu conj2016 96boards

Linaro Confidential 2015

CORElevel

CLUBlevel

GROUPLevel

96BOARDS

COMMUNITY