Video in TIB AV-Portal: PicoTCP

Formal Metadata

The reference TCP/IP stack for IoT
Title of Series
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date

Content Metadata

Subject Area
PicoTCP is a fully featured TCP/IP stack designed for embedded devices and released under the terms of GNU GPL. Our purpose is to propose it as the reference TCP/IP stack for IoT, especially due to its high portability and modularity. This talk will explain the architecture of the stack, the way we have been developing it and the many features we support. Moreover, we will briefly show how easy it is to port the stack to a complete new architecture in no time. After the presentation, as a test scenario, we would like to show a demo illustrating how it is possible to transport MIDI flows over WiFi with a PIC24 based board using ZMTP protocol.
State of matter Inverse element Internet der Dinge Stack (abstract data type)
Computer animation Projective plane Right angle Client (computing) Food energy Information technology consulting Task (computing) Product (business) Wave packet
Point (geometry) Computer animation Multiplication sign Portable communications device Product (business) Personal area network
Area Focus (optics) Computer animation Software developer Modul <Datentyp> Microcontroller Internet der Dinge Portable communications device Physical system
Revision control Computer animation Software Duality (mathematics)
Point (geometry) Arm Computer animation State of matter Term (mathematics) Computer configuration Personal digital assistant Flash memory Order (biology) Core dump Modul <Datentyp> Complete metric space
Computer animation Multiplication sign Flash memory Exception handling Asynchronous Transfer Mode
Revision control Computer animation Computer file Flash memory Modul <Datentyp> Lipschitz-Stetigkeit Endliche Modelltheorie Library (computing)
Real number Moment (mathematics) Independence (probability theory) Bit Real-time operating system Complete metric space Portable communications device Computer animation Causality Freeware Operating system Computing platform Computer architecture Physical system
Computer architecture Computer animation Meeting/Interview Operator (mathematics) Whiteboard Abstraction Operating system Physical system
Computer animation Bit rate Meeting/Interview Telecommunication Virtual machine Bit Microcontroller Software testing Power (physics)
Computer animation Finite difference Telecommunication Software developer Moment (mathematics) Device driver Software testing Virtualization Physical system
State of matter Multiplication sign Device driver Stack (abstract data type) Frequency Fluid statics Synchronization Average Semiconductor memory Network socket Software testing Interface (computing) Memory management Maxima and minima Bit System call Process (computing) Befehlsprozessor Loop (music) Computer animation Order (biology) Buffer solution Figurate number Operating system Abstraction
Standard deviation Greatest element Touchscreen Code INTEGRAL Multiplication sign Electronic mailing list Planning Control flow Unit testing Streaming media Test-driven development Computer animation Software testing Right angle Writing
Implementation Computer animation Open source Meeting/Interview State of matter Software developer Projective plane Mathematical analysis
User interface Functional (mathematics) Computer animation Bit rate Meeting/Interview Semiconductor memory Memory management Device driver Freeware Computing platform Library (computing)
Functional (mathematics) Implementation Information Wrapper (data mining) Block (periodic table) Multiplication sign Software developer Memory management Device driver Bit Mass Graph coloring 2 (number) Computer animation Semiconductor memory Statement (computer science) Integer Buffer overflow Operating system Library (computing)
User interface Functional (mathematics) Greatest element Email Computer animation Quicksort Data structure
Functional (mathematics) Pointer (computer programming) Computer animation Personal digital assistant Internetworking Semiconductor memory Weight Device driver Data structure Computing platform Address space
Functional (mathematics) Implementation Computer animation Demo (music) Internetworking Wrapper (data mining) Device driver Right angle Storage area network Physical system
MIDI Computer animation Hypermedia Keyboard shortcut Energy level Translation (relic) Whiteboard Communications protocol
Scripting language Laptop Revision control Game controller Message passing Serial port Computer animation Hypermedia Keyboard shortcut Virtualization Streaming media Communications protocol
Scripting language Functional (mathematics) Computer animation Telecommunication Line (geometry)
Scripting language Message passing Computer animation Software Demo (music) Meeting/Interview Hypermedia Whiteboard Mereology
MIDI Computer animation
Demo (music) Meeting/Interview Network topology Multiplication sign Projective plane Expert system Control flow Online help Bit Connected space
OK hello everyone i'm much inverse or I'm presenting to you that the could TCP stack and which want to presented here as the OK as the reference set dispute the state for the Internet of Things go to try to fix the 1st good
I that should be better a right would be to go so 1st let me do some shameless
publicity for the company in working for a skull tasks that we are living in better technology companies were located in lieu of energy and and what we're doing is we're providing consultancy training and we're doing projects together with our customers and uh doing outsourced services the who want to do is ensured a across our clients and co-creation with us that can launch all if and better quality product
products in a shorter time to market and but another important point is that we believe that that connected devices are going to improve the quality of our lives in and all the way so it that is why we have made this and speaker
TCP it so for the features and highly portable TCP IP
stack and it's designed really fourfold those small small-footprint embedded system so we're targeting the lower and microcontrollers here um up until the until bigger targets so um why should we be the reference TCP IP stay for the Internet of Things and that is because we have 4 areas which we focused on during the development of the could TCP and that its modularity and portability performance and quality and going to tell you about all these 4 focus areas that little more in detail the 1st
important for this I think is that we are the
or software is free as in free speech and so we have a dual licensing policy in place of firstly really
release their pick a TCP stagger under the GNU GPL version 2 and but then for the cursed customers who are not really very happy with this kind of licensing we also have the appropriate very licensing as possible because we a full copyright owner of we could this be yes and at it is the 2 only and the question was is that the 2 only or the 2 and later nowhere sticking to GPL the 2 so what does
this take look like and this is the 1st point modularity uh we've built up the state from the beginning as a that very modular stag because that's important for small embedded targets but there's 1 big bubble in the middle which is the grape egotistic core uh that 1 of course is mandatory but all the order of uh modules molecules around that are optional and you can choose whether you want to compile them in or not and of course this so some dependencies between them and but that's logical think and then just to give you an idea of the whole big status in terms of flash memory and we
try to compile the complete Stankiewicz in foreign arm targets which is there and that bought and in this case and we compiled all the options and then we get somewhere around those 68 kilobytes for a for all the modules you can see here uh we think it's pretty small then let's see how we can build this up in a modular
way so we removed everything except TCP UDP and then we want to use already IPV for because we're
also uh implementing I P V 6 and both can be used at the same time and when we when we build this full host mode goldfish re we're somewhere around 30 kilobytes of flash it so
what is it work that you select the bubbles the modules and and you can do this and some just with a simple may commands that to see all the all the available modules just have a look inside a file uh naked they have been there the Command I used here for auditory 30 kilobytes version of the steak which I have just show you the IAF explicitly mentioned all the modules if he if you going many a mention any of them you would just get all the modules and and then for a for a small lip size have also strips the model year to see what
it will look finally date in Europe In Europe flash but said you shouldn't do that if you still want to link Library exploit is
portability and we we thought of portability since the beginning so we're really
CPU architecture independent and we run on a bit cause on 16 and 32 bits 64 bit a little or big endian and we have also fault of the small systems which have no operating system and also bare-metal small operating systems or sketches things like free articles um real operating systems or more complete operating system up until the real-time operating systems uh right now at this moment we have about 10 or more different platforms which we already support and what we believe is
very easy to port begin to speak to a new 2 new board and I will show you this in a minute how it's done the new operating
system should also be easy to support because we rode around an operating system abstraction layer so you know you should just implement this layer and all the rest stays the same to show you a few of the architectures we
support a 64 bit is not mentioned because we only test this on a pose it's uh blind so on our basically a Linux machine and because we don't have any 64 bit embedded targets that place but then entered 32 bit there's really of farm varience and uh I think almost every month there's a new 1 being introduced it's really easy to port so we have a few LPC chips cortex and 0 and tree and for a lot of STM 32 varience also on the 16 bits uh side we have the the MSP low low power microcontroller from TI also depict 24 uh as with which I will demo here and later on and this is a target rate would really and really small resources it has only 16 kilobytes of RAM and we're running out a complete steak inside of that and then we have even have 1
8 bit targets so that's 18 mega 128 switches doing painless TCP IP communication more portability even so in there and
communication ships we we support this set of of the communication channels we have Wi-Fi chips running we have eaten another we have uh you was CDC drivers and and then a bunch of a bunch of virtual drivers which we use a lot during development or testing and on and on the next for example so we have done top drivers the and that the depth of which will uh why is also using then and they're all different operating systems with
which we can run on at at this moment so we we use a lot of bare metal
targets and sodas certain there's no operating system running so all the calls non-blocking then free Otto's as a as an operating system which is popping up at a local on on the small devices and of course you have there and that are which is Siences odels compliance so order Siences frying should should work painlessly as well and and then we do a lot of testing on Linux and an order pose 6 targets as well so what does ROO was abstraction layer to exactly in we have abstraction from the new Texas in the signals which are used for synchronization between the threats then the trans sell processes are abstracted and we have a and B is the blocking socket interface now
let's talk about the performance the status of been a run on their on and that's LPC 16 . 7 1768 I think uh that's a target running at 2 100 megahertz so we get true puts a for transmission of about 10 megabits and downstream by 20 megabits which is not bad for a and better-targeted thing said then the CPU time here is is state it's in among the firm microseconds per loop because a stake in has a steak bake and you can really choose yourself uh how many how many steak takes or of the the period of 1 take so an idle state we we have only 45 microseconds and then at the maximum throughput which was here to 10 megabits a 20 megabits something like 800 microseconds per day then the ram something and we're proud of also the dynamic memory uh during the status was make some 8 kilobytes of memory and on average around 4 kilobytes and static memory here is the biggest 1 it's 16 kilobytes and that's actually just because we're allocating but a lot of buffer the statically allocating lot of buffer for the for a driver so that we can buffer more and going back is it's once you could also reduce that but then you troop with goes down a little bit so it's a trade-off you should make uh but you can get these figures even lower and the states it to kilobytes and on this big target we even below 1 kilobyte of stack Quality something we're
constantly focusing on so and the way we develop the stack is in an agile way and using Scrum and uh we we don't test-driven development so we
make that does beforehand and then we implement the code which should make the stairs screen uh were also having continues and integration uh and automated testing so whenever something breaks you get a big red streams and everyone should jump on the problem to get this up and running as quickly as possible at the right you can see a kind of the to label but then for code quality and this is tool using its goal deal with takes gives you an idea uh if you're writing decent Kyoto or not at the 1st time we run this tool I think we were something somewhere around the year and so well this gives you a constant reminder of a right good go at and that you meant that don't make it too complex uh write unit tests and things like that so well we're planning on getting at even higher hopefully so uh at the bottom you see a big list of RFC standards that's not a that to be readable but just to show you how many standards so we comply to and we tend to take
the stand as pretty literal so were we don't make any use implementations of these like some other states do uh we are also community
driven so we're on get up Lisa visitors there you're free to to file any
any but you can find uh as as I said before we're GPL the to license so a user stake for kids do whatever you want with it as long as you stick to the GPL were also on the on on all at which the which does analysis of open source projects and their data saying about the could the that we uh have a young but this established good base and we started and 1st time and get 1st that was arrived at October 2012 and and now we have a large development team is stable and the yearbook year-over-year commits so which were constantly working on this
thing and we're trying to to make it then there every day so no more more
concrete or more and interesting it's hard to port
this actually to a new platform that's easy you need just 3 things that's memory management which often is in the big problem so you just grab the malloc and free functions from the UCI library and you need a few dining functions just to actually and then a driver for your heart rate to get the bank is really on your physical physical interface so how do we do this memory
nationals also is already said that you can use a mulligan free functions from your C library and if they're decent enough if there
if available so if you're using an operating system then you could use the memory allocation from the operating system and and were also right now implementing our own memory manager because we believe that we can allocate and free memory uh more efficient than most most C libraries doing and also and coping with fragmentation what when transmitting small bakers and and things like that so it doesn't that's a new development that's on its way uh I think it almost made its way in an intuitive the stable stable and there is an aspect of food bureaucrats great so the next thing you need a stunning functions and the way we set this up is a dimer that interrupt which will every millisecond increments and 64 bit an integer this so that we get a big enough time based and then you need to functions because diner because time which will return the elapsed time in ms for in seconds it so how do we do this at the Synote example from from from them that's our implementation I think again so do because all oak is actually the the wrapper around a Molech function which will you so you can see that it's simply a uses the mullet from C library and requirements for because TCP is that you really um uh 0 all the memory explicitly so if your C library doesn't do it or you could have a color pair available for example next thing is the the dimer mass of we're doing a trick here with the 32 bit integer which is being incremented because it's a little bit and then we're detecting when it's overflows and that's because time is just returning the same value divided by 1 thousand and the last statement here is optional and you could use that as a block information would just wait until another uh millisecond has elapsed but it's not mandatory no we get down to the device driver this API we tend to make it very generic and very simple
also sort is only a few things needed that's the because death creates which
will return a structure to be good device and then you have its opposite at the bottom which is which is because they're destroy which will do all the cleanup and then you have a son function a poll function so you were transmitted packets or you want to see if there is new data available or not and on your physical interface so did the header is really simple there's only
2 of functions exposed which which are dead and the and that creates and them but destroy in this case a all the
rest this is on needs which can see here so this is the create function uh which will allocate the some memory at the at the top for the device driver will set the MAC address because this an internet device the we will in the device and then sets so that a few function pointers which will which will do the actual work these are called X which are put into a structure actually we will what we've done here in with what is a weight it's easy to get started on new platforms as you make wrappers around existing driver
or implementation and and and and that system we had the internet to read available so this is actually just a wrapper around this function and then you can get started with a 1 page of functional even half a sh function and he could see the drivers
is working the the San function is just the same story we're using the internet right and in that sense uh API from the and that so let's get down to a demo at what we've done here is we've taken and this is
small the Midi keyboard that actually it's mandatory for for the we I think
but uh it wasn't a great success at so you can find really cheap on ebay a great thing there is they have a MIDI boards which we will use this miniport animated protocol so really simple so just need level translator and then with the you watch you can read out flies which are on the on the media channel and what we're doing is you can see this here
is an we take the keyboard we're transmit uh we translate this to serial serial stream the my chip they the controller will read this
out to you speak a TCP to put this on a on a Wi-Fi channel you and
the Wi-Fi over Wi-Fi we're actually transmitting it to TCP stream with on top 0 and q 0 which is a great message message queuing protocol which makes it really easy to and descendant but uh publish messages actually so the the keyboard here is a publisher and my laptop will subscribe to this uh this publisher and get every message that it's that makes available so these messages will be there and he knows which are played on the keyboard so that I can receive an what would a tiny Python scripts on my laptop and then uh I would these flights again into a virtual media device and this version the device can then be hooked up to any synthesizer on my laptop so I can show you the
the then uh Python script which
will read these the binary packages but right so and that that's about it's I think yeah and it's a few more lines at the bottom most of them are operant functions is just as he was going on so and this is just to show how easy it is to to do TCP IP communication by using 0 and q but but yeah I I will
just borrowed to devise a meanwhile and let it connects the to the Wi-Fi network and I don't know if there's anybody you can actually played piano because I can't say that it again so it's it's again and do
this demo sir anyone wants to play a few notes yeah get them along yeah yes I accept that the yeah the borders there is this USB part in the and so the boards connected I will not connected the Python script they considered this immediately over receiving media messages and that now I
have this vigil MIDI device as should connected to were 2 synthesizer and I
should be able to play the piano maybe and yeah go
up yes I have yeah see FIL make a connection can OK go ahead and the the great thanks so knows there's a anything less for a b 2 minutes to questions so so this is a great project I'm very impressed I might like to use it but my projects the bill the 3 so I call why be done that way as a good idea that's a good question we we think yeah that have the trees a little bit to restrictive for the purpose yes she gets through the I and I don't know maybe I can go all the help of an expert on this matter I have here I want to reply with another question actually so what was the need of a circular GPL 3 if we have to the 2 which is what which was working pretty well I think we can take this ofline OK so we we're going to we're going to cut this discussion about GPL license and I think it if you it if you simply say GPL 2 or later and then adding the problem so that we can discuss this later and thank you very much for the demo if anybody wants to carry on playing the piano we have an open slots after the next speech but we're going stick to our timing here thank you very much for this amazing piece of work also we have a 5 minute break and then we have our last formal talk for the day