An open source platform for IoT Bogdan Marinescu mbed What is

advertisement
mbed
An open source platform for IoT
Bogdan Marinescu
What is mbed?
 mbed is an open source platform for developing embedded
systems based on ARM Cortex®-M microprocessor
Microcontroller and Toolchain Portability
Hardware Abstraction Layer
Starting at £8.24
C Libraries and project exports
Components Libraries
 Write a component library once and get supported on multiple

mbed platforms.
Implement the mbed HAL once and immediately support thousands
of components.
Example Application
LIS302 Accelerometer
 Simple user friendly C++ for the user
 Component-based approach
 The implementation does not reference
any MCU register, but only the mbed API
Open Source Project
Open sourced Feb. 2013, already getting momentum
 41 Contributors (github stats track only its users)
 149 Pull Requests
 112 Followers
 108 mailing list members
Developer Community
 50,023 users
 6,358 public code repositories
 75% of questions receive an answer
CMSIS-DAP
 Standardized access to the Coresight Debug Access Port (DAP)
of an ARM Cortex microcontroller via USB HID (no drivers).
>>> from pyOCD.board import MbedBoard
>>> target = MbedBoard.chooseBoard().target
0 => MBED MBED CMSIS-DAP (0xd28, 0x204) [lpc1768]
>>> target.halt()
>>> target.readCoreRegister("pc")
1392
>>> target.step()
>>> target.readCoreRegister("pc")
1394
https://github.com/mbedmicro/pyOCD
SDK Architecture
C++ in the SDK
 Lightweight, runs on small targets
 No exceptions/RTTI
 Put OOP to good use
 Minimal impact on speed
C++ in the SDK
 Lightweight wrapper
 Concise
 Stable API
 14.2k flash / 0.5k RAM
 Verbose
 Harder to understand
 API may change
 11.1k flash / 0.4k RAM
Using the Compiler - Online
Using the Compiler – Offline
 Export from online IDE
 Use offline IDE/command line tools (make)
 Supported: uVision, IAR, make (various), CodeRed …
c:\work\temp> unzip ~/Downloads/blinky_gccarm_lpc1768.zip
inflating: blinky/main.cpp
inflating: blinky/.hgignore
inflating: blinky/Makefile
………
c:\work\temp> cd blinky\
[hg:default] c:\work\temp\blinky> make
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -c -Os -fno-common -fmessage-length=0 -Wall fno-exceptions -ffunction-sections -fdata-sections -DTARGET_LPC1768 -DTARGET_M3 ………
………
arm-none-eabi-objcopy -O binary blinky.elf blinky.bin
[hg:default] c:\work\temp\blinky> move blinky.bin e:
What makes the IoT tick
 Specific protocols
 Low overhead
 Interoperability
 Security
 Low power
 Different transports
 Radio (2.4Ghz)
 Radio (sub GHz)
 WiFi
 Cellular
 Wired
mbed network stack
Example network application - eth
#include "mbed.h"
#include "EthernetInterface.h"
int main() {
EthernetInterface eth;
eth.init(); //Use DHCP
eth.connect();
printf("IP Address is %s\n", eth.getIPAddress());
TCPSocketConnection sock;
sock.connect("mbed.org", 80);
char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";
sock.send_all(http_cmd, sizeof(http_cmd)-1);
char buffer[300];
int ret;
while (true) {
ret = sock.receive(buffer, sizeof(buffer)-1);
if (ret <= 0)
break;
buffer[ret] = '\0';
printf("Received %d chars from server:\n%s\n", ret, buffer);
}
sock.close();
eth.disconnect();
}
Example network application - WiFi
#include "mbed.h"
#include “WiflyInterface.h"
int main() {
WiflyInterface wifly(p28, p27, p26, p25, "myssid", "mypassword", WPA);
wifly.init(); //Use DHCP
while (!wifly.connect()); // join the network
printf("IP Address is %s\n", wifly.getIPAddress());
TCPSocketConnection sock;
sock.connect("mbed.org", 80);
char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";
sock.send_all(http_cmd, sizeof(http_cmd)-1);
char buffer[300];
int ret;
while (true) {
ret = sock.receive(buffer, sizeof(buffer)-1);
if (ret <= 0)
break;
buffer[ret] = '\0';
printf("Received %d chars from server:\n%s\n", ret, buffer);
}
sock.close();
wifly.disconnect();
}
mbed IoT components
mbed IoT protocols
Source: https://mbed.org/handbook/TCP-IP-protocols-and-APIs
• NanoService: https://mbed.org/components/Nanoservice/
• mqtt: https://mbed.org/cookbook/mbed_Client_for_MQTT
• BTLE: https://mbed.org/teams/Bluetooth-Low-Energy/
MBED Cloud API Integrations
AT&T
Sprint
Telenor
Roadmap: IoT
Roadmap: 6LoWPAN / 802.15.4
 Support for 6LoWPAN and 802.15.4 stacks on the mbed SDK.
 Addition of reference hardware platforms for quickly experimenting
with Wireless Sensor Networks.
Roadmap: security
Roadmap: Test Infrastructure
 Provide Test Infrastructure as a service to mbed.org users
 Make TDD/UT/CI a standard part of embedded community
Roadmap: the rest
 Powerful command line tools
 Better debugging
 Grow list of platforms
 Integrated IoT solution
 Low power
 Built in security
 More protocols
Q&A
Thank you!
http://mbed.org
support@mbed.org
Download