cellular technology with embedded linux - coscup 2016

64
打造自己的IoT Cellular Technology with Embedded Linux SZ LIN [email protected] 1 Date: 2016/8/21

Upload: sz-lin

Post on 07-Jan-2017

1.831 views

Category:

Technology


17 download

TRANSCRIPT

Page 1: Cellular technology with Embedded Linux - COSCUP 2016

打造自己的IoTCellular Technology with Embedded Linux

SZ [email protected]

1

Date: 2016/8/21

Page 2: Cellular technology with Embedded Linux - COSCUP 2016

2

SZLIN➔ Taiwan Industrial Grade Linux Distribution➔ Debian Maintainer➔ Blog: https://szlin.me

About Me

Page 3: Cellular technology with Embedded Linux - COSCUP 2016

3

Page 4: Cellular technology with Embedded Linux - COSCUP 2016

4

Page 5: Cellular technology with Embedded Linux - COSCUP 2016

5

Page 6: Cellular technology with Embedded Linux - COSCUP 2016

6

Page 7: Cellular technology with Embedded Linux - COSCUP 2016

7

Page 8: Cellular technology with Embedded Linux - COSCUP 2016

8

Prepare Cellular Interface

Enable device driver and cellular utility

Get proper Cellular Module

and SIM card

4321

Steps to Build Your Own IoT

Hands-on Experience

Page 9: Cellular technology with Embedded Linux - COSCUP 2016

9

Analog Cellular

- AMPS

-TACS

- NMT

* 14.4 kbps

Digital

NarrowBand

Circuit Data

- GSM

- D-AMPS

- PHS

* 9.6/ 14.4 kbps

Packet Data

- GPRS

- CDMA2000 1xRTT

- EDGE

* 171.2 kbps

Digital

Broadband

Packet Data

- UMTS

- CDMA2000 1xEV-DO

* 3.1 Mbps

Digital

Broadband

Packet Data

- HSPA+

- LTE

- WiMAX

(IEEE 802.16e)

* 14.4 Mbps

Digital

Broadband

Packet Data

* All IP network

- LTE Advanced

- WiMAX

(IEEE 802.16m)

* Cat. 6: 300/50 Mbps

1G2G

3G

4 G

Cellular Network Generation

2.5/2.75G

3.5/ 3.75/ 3.9 G

Page 10: Cellular technology with Embedded Linux - COSCUP 2016

10

Analog Cellular

- AMPS

-TACS

- NMT

* 14.4 kbps

Digital

NarrowBand

Circuit Data

- GSM

- D-AMPS

- PHS

* 9.6/ 14.4 kbps

Packet Data

- GPRS

- CDMA2000 1xRTT

- EDGE

* 171.2 kbps

Digital

Broadband

Packet Data

- UMTS

- CDMA2000 1xEV-DO

* 3.1 Mbps

Digital

Broadband

Packet Data

- HSPA+

- LTE

- WiMAX

(IEEE 802.16e)

* 14.4 Mbps

Digital

Broadband

Packet Data

All IP network

- LTE Advanced

- WiMAX

(IEEE 802.16m)

* Cat. 6: 300/50 Mbps

1G

2G

3G

4 G

Cellular Network Generation

2.5/2.75G

3.5/ 3.75/ 3.9 G

Taiwan is phasing out 2G cellular on 2017-6-30 to make way for more 4G bandwidth

ref: http://www.ncc.gov.tw/chinese/print.aspx?table_name=news&site_content_sn=8&sn_f=33421

Page 11: Cellular technology with Embedded Linux - COSCUP 2016

11

Prepare Cellular Interface

Get proper Cellular Module

and SIM card

4321

Steps to Build Your Own IoT

Enable device driver and cellular utility

FAQ

Page 12: Cellular technology with Embedded Linux - COSCUP 2016

12

BANANA

Page 13: Cellular technology with Embedded Linux - COSCUP 2016

13

BANANA

SoC Built-in cellular function

Board buit-in Mini-PCIe slot

Mini-PCIe to USBConnector

Page 14: Cellular technology with Embedded Linux - COSCUP 2016

14

SoC Built-in Cellular Function

Page 15: Cellular technology with Embedded Linux - COSCUP 2016

15

Board Built-in Mini-PCIe Slot

USB signal

Page 16: Cellular technology with Embedded Linux - COSCUP 2016

16

Mini PCI-E to USB Adapter With SIM Card and Case Slot

USB signal

Page 17: Cellular technology with Embedded Linux - COSCUP 2016

17

Prepare Cellular Interface

Get proper Cellular Module

and SIM card

4321

Enable device driver and cellular utility

Hands-on Experience

Page 18: Cellular technology with Embedded Linux - COSCUP 2016

18

LTE frequency bands

➢ 3GPP Release 8 defines 5 LTE user equipment categories depending on maximum peak data rate and MIMO capabilities support [1] ➢ CAT 3, CAT 4 modules took up a dominant

share of cellular market so far

➢ Some new modules start to support CAT6

LTE Category

➢ The definition is in 3GPP TS 36.101

➢ The available band might be different in different country

Get Proper Cellular Module

Module PIN definition

➢ Make sure the PIN definition between slot and module are the same

Page 19: Cellular technology with Embedded Linux - COSCUP 2016

19

LTE frequency bands [11][15]

Page 20: Cellular technology with Embedded Linux - COSCUP 2016

20

LTE category [9]

Aggregating up to 40 MHz of bandwidth

Page 21: Cellular technology with Embedded Linux - COSCUP 2016

21

Prepare Cellular Interface

Get proper Cellular Module

and SIM card

4321

Enable device driver and cellular utility

Hands-on Experience

Page 22: Cellular technology with Embedded Linux - COSCUP 2016

22

Data Path Interface

Control Path ProtocolBANANA

Page 23: Cellular technology with Embedded Linux - COSCUP 2016

23

Control Path Protocol Data Path Interface

1. AT commands

2. QMI (after kernel v3.4 )

3. MBIM (after kernel v3.8)

1. ppp (ttyUSB or cdc-acm)

2. RNDIS (cdc-ecm)

3. QMI (cdc-wdm)

4. MBIM (cdc-mbim)

* This table only lists information which I have handled

Page 24: Cellular technology with Embedded Linux - COSCUP 2016

24

Control Path Protocol Data Path Interface

1. AT commands

2. QMI (after kernel v3.4 )

3. MBIM (after kernel v3.8)

1. ppp (ttyUSB or cdc-acm)

2. RNDIS (cdc-ecm)

3. QMI (cdc-wdm)

4. MBIM (cdc-mbim)

Page 25: Cellular technology with Embedded Linux - COSCUP 2016

25

AT commands - Hayes command set [2][3]

❏ Developed by Dennis Hayes❏ A series of short text strings which can be combined to produce commands for operations

• dialing• hanging up• changing the parameters

❏ “AT” meaning 'attention’

Page 26: Cellular technology with Embedded Linux - COSCUP 2016

26

AT commands - Hayes command set [2][3]

Standard format of AT commandsAT+

Proprietary format of AT commandsAT!, AT^ or AT$ etc..

Page 27: Cellular technology with Embedded Linux - COSCUP 2016

27

AT commands - Utility

Page 28: Cellular technology with Embedded Linux - COSCUP 2016

28

Control Path Protocol Data Path Interface

1. AT commands

2. QMI (after kernel v3.4 )

3. MBIM (after kernel v3.8)

1. ppp (ttyUSB or cdc-acm)

2. RNDIS (cdc-ecm)

3. QMI (cdc-wdm)

4. MBIM (cdc-mbim)

Page 29: Cellular technology with Embedded Linux - COSCUP 2016

29

Dial-up by using PPP [5]Not a Recommended way

6+ steps to dial up with ppp

1. Install the packages in Debian/ Ubuntu ➢ apt-get install netbase ifupdown ppp

2. Create a file /etc/ppp/peers/gprs with this content

3. Edit /etc/ppp/chap-secrets4. Edit /etc/ppp/pap-secrets 5. Edit /etc/network/interfaces6. ifup gprs

7. !@#$%^&*()_

ref: https://c1.staticflickr.com/5/4150/5067471752_1fa8a4ab15.jpg

Page 30: Cellular technology with Embedded Linux - COSCUP 2016

30

Dial-up by using wvdial [6]

Page 31: Cellular technology with Embedded Linux - COSCUP 2016

31

1. apt-get install wvdial2. edit /etc/wvdial.conf3. wvdial

Dial-up by using wvdial [6]

Page 32: Cellular technology with Embedded Linux - COSCUP 2016

32

Get IP by using DHCP

Page 33: Cellular technology with Embedded Linux - COSCUP 2016

33

Control Path Protocol Data Path Interface

1. AT commands

2. QMI (after kernel v3.4 )

3. MBIM (after kernel v3.8)

1. ppp (ttyUSB or cdc-acm)

2. RNDIS (cdc-ecm)

3. QMI (cdc-wdm)

4. MBIM (cdc-mbim)

serial interface

Non serial interface

Page 34: Cellular technology with Embedded Linux - COSCUP 2016

34

Ethernet Networking Control ModelCDC_ECM + RNDIS - Ethernet over USB [16]

Vir

tual

In

terf

ace

RNDIS

Vir

tual

In

terf

ace

Cellular Module – Router mode

IPTABLES - NATIP Stack

DHCPDNS➢ RNDIS - Proprietary protocol developed by Microsoft

➢ “virtual Ethernet” functionality

➢ Support USB high speed○ Not suitable for the module which

are for more than CAT 6

Page 35: Cellular technology with Embedded Linux - COSCUP 2016

35

Ethernet Networking Control ModelCDC_ECM + RNDIS - Ethernet over USB

Vir

tual

In

terf

ace

RNDIS

Vir

tual

In

terf

ace

Cellular Module – Router mode

IPTABLES - NATIP Stack

DHCPDNS

Vir

tual

In

terf

ace

RNDIS

Vir

tual

In

terf

ace

Cellular Module – Bridge mode

IPTABLES - NATIP Stack

DHCPDNS

Page 36: Cellular technology with Embedded Linux - COSCUP 2016

36

Ethernet Networking Control ModelDriver option in Linux kernel

Page 37: Cellular technology with Embedded Linux - COSCUP 2016

37

Ethernet Networking Control ModelCDC_ECM + RNDIS

Page 38: Cellular technology with Embedded Linux - COSCUP 2016

38

Control Path Protocol Data Path Interface

1. AT commands

2. QMI (after kernel v3.4 )

3. MBIM (after kernel v3.8)

1. ppp (ttyUSB or cdc-acm)

2. RNDIS (cdc-ecm)

3. QMI (cdc-wdm)

4. MBIM (cdc-mbim)

Page 39: Cellular technology with Embedded Linux - COSCUP 2016

39

➔ LTE baseband market with 65% [17]

➔ Obsolete AT command and serial interface• Compatibility• Logical Bandwidth

➔ Propose unique value proposition

Page 40: Cellular technology with Embedded Linux - COSCUP 2016

40

QMI (Qualcomm MSM Interface)

◆ Linux Kernel 3.4• qmi_wwan

◆ Define network services• NAS (network access)• PDS (gps location)• UIM (user identity module)• WDS (wireless data)• DMS (device management)• …

◆ Binary protocol

Page 41: Cellular technology with Embedded Linux - COSCUP 2016

41

QMI (Qualcomm MSM Interface)

Device Driver Owner User-space

GobiSerial

GobiNet

qcserial

option

qmi_wwan

Qualcomm

Open Source Community

GobiAPI

•Sierra Wireless SDK

•…

libqmi (freedesktop.org)

uqmi (openWRT)

ofono (INTEL)

Page 42: Cellular technology with Embedded Linux - COSCUP 2016

42

QMI (Qualcomm MSM Interface)drivers/net/usb/qmi_wwan.c

➢ Net Driver dependence

➢ Related information

Page 43: Cellular technology with Embedded Linux - COSCUP 2016

43

QMI (Qualcomm MSM Interface)drivers/usb/serial/qcserial.c & drivers/usb/serial/option.c

➢ Serial Driver dependence

qcserial option

Page 44: Cellular technology with Embedded Linux - COSCUP 2016

44

QMI (Qualcomm MSM Interface)When to use option instead of qcserial

Page 45: Cellular technology with Embedded Linux - COSCUP 2016

45

QMI (Qualcomm MSM Interface)Move qcserial to option

Page 46: Cellular technology with Embedded Linux - COSCUP 2016

46

QMI (Qualcomm MSM Interface)LIBQMI

Mailing [email protected]

Page 47: Cellular technology with Embedded Linux - COSCUP 2016

47

Control Path Protocol Data Path Interface

1. AT commands

2. QMI (after kernel v3.4 )

3. MBIM (after kernel v3.8)

1. ppp (ttyUSB or cdc-acm)

2. RNDIS (cdc-ecm)

3. QMI (cdc-wdm)

4. MBIM (cdc-mbim)

➔ extends cdc-ncm (Network Control Model)

Page 48: Cellular technology with Embedded Linux - COSCUP 2016

48

Mobile Broadband Interface Model (MBIM)

◆USB-IF Standard (Extends NCM)• Microsoft• Intel• HP• …

◆Linux Kernel 3.8• cdc_mbim

◆Binary protocol◆Raw IP◆MBIM could embedded different protocols

• QMI• …

Page 49: Cellular technology with Embedded Linux - COSCUP 2016

49

Mobile Broadband Interface Model (MBIM)

➢ MBIM extends the NCM as a protocol with the difference that devices transfer raw IP packets instead of packets with 802.3 headers

➢ NCM○ 802.3 headers

➢ NCM/ MBIM○ Raw IP○ Control path

Page 50: Cellular technology with Embedded Linux - COSCUP 2016

50

Mobile Broadband Interface Model (MBIM)

Device Driver Owner User-space

cdc_mbim Open Source Community libmbim (freedesktop.org)

umbim (openWRT)

Page 51: Cellular technology with Embedded Linux - COSCUP 2016

51

Mobile Broadband Interface Model (MBIM) LIBMBIM

Mailing [email protected]

Page 52: Cellular technology with Embedded Linux - COSCUP 2016

52

Prepare Cellular Interface

Get proper Cellular Module

and SIM card

4321

Enable device driver and cellular utility

Hands-on Experience

Page 53: Cellular technology with Embedded Linux - COSCUP 2016

53

ref: http://www.safetysign.com/products/p3249/warning-read-manual-label

Page 54: Cellular technology with Embedded Linux - COSCUP 2016

54

ref: http://www.safetysign.com/products/p3249/warning-read-manual-label

Page 55: Cellular technology with Embedded Linux - COSCUP 2016

55

Use command “dmesg” to find out the idVendor and idProduct of cellular module.

Use command “grep -r "1199" drivers/net/usb/” to find out which driver does it use.

Lazy is the greatest motivation behind progress

Page 56: Cellular technology with Embedded Linux - COSCUP 2016

56

Hands-on Experience – FAQDial-up failed !

Check steps one by one• Check the band of SIM card is matched with cellular module

• Check SIM card is ready or not (Make sure PIN code is correct)

• Check cellular signal is good enough

• Make sure SIM card's supporting band is the same with the cellular module

• Make sure the firmware of cellular module is the same with the ISP

• Make sure cellular module is connected properly to your antenna (MAIN/ AUX)

• Make sure the mode of module firmware is configured properly

• Make sure wireless disable function is OFF

Page 57: Cellular technology with Embedded Linux - COSCUP 2016

57

Hands-on Experience – FAQMy connection is disconnected !

Check steps one by one• Check cellular signal from base station

• Make sure cellular module is not in idle mode

• Make sure MTU is configured properly

Page 58: Cellular technology with Embedded Linux - COSCUP 2016

58

Internet

Ping

eth0

Page 59: Cellular technology with Embedded Linux - COSCUP 2016

59

Internet

Open browsereth0

Page 60: Cellular technology with Embedded Linux - COSCUP 2016

60

Hands-on Experience – FAQMake sure MTU is configured properly

This forces the packet to be fragmented, and the fragmented packets are not be re-assembled.

M2M IoT Network Usage Guidelines [25]

Page 61: Cellular technology with Embedded Linux - COSCUP 2016

61

Conclusion

Enable LTE-A module require more fundamental knowledge➢ Band, carrier, firmware, antenna, etc…

1

2

3Future Prospects➢ MBIM➢ 3GPP Rel. 12

○ LTE-U ➢ 3GPP Rel. 13

○ LTE-LAA

Fault tolerance mechanism➢ We cannot control status of base station and carrier

Page 62: Cellular technology with Embedded Linux - COSCUP 2016

62

Thank you

Page 63: Cellular technology with Embedded Linux - COSCUP 2016

63

References1. E-UTRAhttps://en.wikipedia.org/wiki/E-UTRA2.海斯命令集https://zh.wikipedia.org/wiki/%E6%B5%B7%E6%96%AF%E5%91%BD%E4%BB%A4%E9%9B

%863. Hayes_command_sethttps://en.wikipedia.org/wiki/Hayes_command_set4. Wvdialhttps://en.wikipedia.org/wiki/WvDial5. Modem3G https://wiki.debian.org/Modem/3G6. Wvdial - githubhttps://github.com/wlach/wvdial7. modem-cmdhttps://github.com/imZack/modem-cmd8. E-UTRAhttps://en.wikipedia.org/wiki/E-UTRA9. LTE UE Category & Class Definitions http://www.radio-electronics.com/info/cellulartelecomms/lte-long-term-evolution/ue-cat

egory-categories-classes.php10. Qualcomm Gobi devices in Linux based systemshttp://www.lanedo.com/documents/Qualcomm%20Gobi%20devices%20on%20Linux.pdf

11. LTE band

http://niviuk.free.fr/lte_band.php

12. Cellular network

https://en.wikipedia.org/wiki/Cellular_network

13. 1g 2g 2.5g 3g 3.5g 4g comparisons, peak speed, real speed, carriers

https://www.youtube.com/watch?v=_3k5Iic4pWI

14. Project mangOH

http://source.sierrawireless.com/blog/2016/3/next-on-mangoh/

15.長期演進技術

https://zh.wikipedia.org/wiki/%E9%95%B7%E6%9C%9F%E6%BC%94%E9%80%B2%E6%8A%80%E8%A1%93

16. RNDIS

https://en.wikipedia.org/wiki/RNDIS

17. Qualcomm news

http://www.prnewswire.com/news-releases/abi-research-reports-qualcomm-maintains-clear-leadership-in-the-lte-baseband-market-with-65-share-but-faces-mounting-captive-market-competition-300222968.html

18. Mobile broadband modem control protocols

http://www.lanedo.com/users/amorgado/talks/FOSDEM2013%20-%20Mobile%20broadband%20modem%20control%20protocols.pdf

19. Qualcomm Gobi devices in Linux based systems

http://www.lanedo.com/documents/Qualcomm%20Gobi%20devices%20on%20Linux.pdf

Page 64: Cellular technology with Embedded Linux - COSCUP 2016

64

References20. libqmi

https://www.freedesktop.org/wiki/Software/libqmi/

21. uqmi

http://git.openwrt.org/?p=project/uqmi.git;a=summary

22. ofono

https://01.org/zh/ofono?langredirect=1

23. Linux Kernel

https://www.kernel.org

24. USB: qcserial/option: make AT URCs work for Sierra Wireless MC73xx

https://patchwork.ozlabs.org/patch/433374/

25. M2M_IoTNetworkUsageGuidelines

https://m2mdeveloper.verizon.com/portals/M2M_Management_Center_Help/images/a/a2/M2M_IoTNetworkUsageGuidelines.pdf

26. libmbim

https://www.freedesktop.org/wiki/Software/libmbim/

27. umbim

http://lxr.mein.io/source/umbim/

28. LTE-U與LAA發展趨勢介紹http://www.ttc.org.tw/userfiles/file/20151104/20151104090423_

39805.pdf29. Special thanks to Glen Chiang