element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Blog PiIoT - The perfect reading place #17 [tech]: Compiling the EnOcean Link library for the Raspberry PI
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: balearicdynamics
  • Date Created: 14 Aug 2016 1:38 PM Date Created
  • Views 1021 views
  • Likes 2 likes
  • Comments 2 comments
  • enocean link library
  • internet of things
  • raspberry pi toolchain
  • cross-compiling
  • library issues
  • piiot
  • them
  • eclipse
  • ssh remote connection
  • enocean
  • raspberry pi
  • remote deploy
  • enocean link
  • enocean link source correction
  • iot
  • arm toolchain
  • c++
  • esp3 protocol
Related
Recommended

PiIoT - The perfect reading place #17 [tech]: Compiling the EnOcean Link library for the Raspberry PI

balearicdynamics
balearicdynamics
14 Aug 2016

    • Introduction
    • The EnOcean Link library: warnings and issues
      • What Raspberry PI should be used
      • Credits
      • How-to a bit confused
      • Problems and source issues
    • Compiling the EoLink library for the Raspberry Pi
      • Importing the EOLink in Eclipse
      • Preparing the projects build configurations
      • Setting the cross compiling options for the selected build
      • Special case: the EOLink library
      • Patching the library and compiling
      • Build the library project

Introduction

The EnOcean Link library is a set of C++ APIs supporting the EnOcean PIEnOcean PI gateway and the IoT communication protocols between the EnOcean sensors and actuators. The development environment, desktop platform and Eclipse C/C++ IDE settings and configuration mentioned in this article are described in detail in the previous PiIoT - The perfect reading place #16[tech]: Setup the Raspberry PI Cross-compiler for EnOcean

 

The EnOcean Link library: warnings and issues

As always happens the first time I approach a new embedded technology, issues and problems arrives together. Avoiding that other users interested to this technology meet the same problems it is the worth to write down a short list of tips I have discovered on the run. For better understanding I will add in attach the documents I refer to, including some posts and articles saved in pdf format.

 

What Raspberry PI should be used

This is the first problem I meet. I have installed several times the EnOcean Link library and compiled it on the Raspberry PI3 as well as the Fhem web serve with very poor results; EnOcean support confirmed me that the PI3 is not 100% allowed (at least not yet) supporting the EnOcean technology and they until now have only tested their software over the PI2. So I have moved the EnOcean gateway on the Raspberry Pi2BRaspberry Pi2B with 16Gb microSD, and the last Raspbian Jessie distribution installed.

 

Credits

When I had some serious problems compiling the library and other issues with the Fhem web server I should thank to the immediate support through element14Dave that put me in contact with the EnOcean support. Special thanks to markus.kreitmair that investigated in depth the issues and supported me solving them.

 

How-to a bit confused

I have started checking the available documentation; unfortunately not all the documents was helpful; the complete setting and installation path was deducted picking information here and there after a lot of testing and wrong results. Starting from the Element14 article element14: How to use EnOcean Pi with Raspberry Pi (outdated, it is by three years ago) there is only one is essential information: the link to download the Gateway software.

Finding this document is not so easy: go to the Pi IoT - Smarter Spaces with Raspberry Pi 3: The Kit- UPDATED! showing the list of the components of the kit, including the EnOcean Pi. Clicking on the product in the list (the buy link) you see the documents in the datasheet tab. At that point you can select the Element14 technical page link: 868 MHz Transceiver module for Raspberry Pi using EnOcean TCM 310

This sounds well structured and in the download area you can download the Gateway firmware zip file. Sadly the image below shows the landing page I have reached from this link.

image

It is mentioned the Gateway firmware download; as firmware I expect the software that in some way will be installed updating the microcontroller or similar (in this case the Atmel micro on board of the EnOcean PI device) The journey trying to find some kind of useful software ended on the Error 404 page; but the article also includes a link to download the EnOcean Link library. For some reasonI have not found any other way to get the link and download the library then this way. After downloading the library, the rest of the documentation seems too outdated to setup a development environment.

Btw, the EnOcean Pi Library can be downloaded from the following link : https://www.element14.com/community/servlet/JiveServlet/download/55295-6-118009/EnOcean+Link+%28Trial%29+V1.2.0.0.zip

Note that it is not excluded that someone else can find an easier and more structured way to find this material.

After the library download this document is almost useless.

 

Problems and source issues

During his investigations Markus helped me to identify the chip code meaning. If someone else has the same doubts on what is the meaning of the hardware coding consider that it is not related to the version but the numbers refers to the production batch.

 

About some issues I had trying to work with Fhem version 5.7 and the EnOcean Link gateway it seems depending on some problem of the serial driver. If this issue arises the best workaround is installing the Fhem version 5.5 instead and things should work fine.

 

In the documentation it is reported a method to disable the /dev/ttyAMA0 serial of the Raspberry PI for the EnOcen PI gateway working. The command sudo rpi-serial-console disable is no longer available in the most recent Raspbian Jessie distribution and should be replaced by one of the following two:

 

sudo systemctl stop serial-getty@ttyAMA0.service

or

sudo systemctl disable serial-getty@ttyAMA0.service

 

Use the first to temporarily stop the serial; the original status will be restored on the next boot. To permanently disable the serial instead you should use the second command above.

 

There is also a source issue documented by Markus as reported below:

There is a problem with the communication with the EnOcean Pi with the new version of Raspian. There is a class in EoLink called eoLinuxPacketStream which uses termios to connect to the serial port. In the “Open” method add the following:

a) newtio.c_cc[VMIN] = 1;

 

a) newtio.c_cflag |= CLOCAL;

b) newtio.c_cflag |= CREAD;

 

Compiling the EoLink library for the Raspberry Pi

Before starting compiling we should prepare the EOLink package for the Eclipse IDE.

You do not need to decompress che zip package after download. Just copy it somewhere on your development desktop (I have placed it on the Ubuntu Desktop folder.

Importing the EOLink in Eclipse

First we should import the projects in the EOLink library package as Eclipse projects.

image

From the Eclipse worksspace Project Explorer right click in the project area and select configure to detect new projects (see the image above)

image

Then select in the dialog wizard Import Projects from File System or Archive (we will use the archived zipped package) browsing to the EOLink zipped folder.

image

After selecting the zip file you see all the included Eclipse projects.

Select all the proposed projects. The first in the list is the zipped file with the _expanded suffix: it is the folder where Eclipse unzip the package to make the content available for working

image

At the end of this operation as show in the above image your workspace will include three new projects:

  1. EOLink - The library tree
  2. examples - The examples set
  3. Tutorial - The library tutorials

 

Preparing the projects build configurations

Before managing and cross compiling the projects we should set them properly for the cross-compiling environment.

Every project includes some different configurations; ignore the Eclipse build all features! We should setup every build configuration for our usage

As shown in the image below right click on the desired project (in this case the EOLink library) and from the Build Configurations contextual menu select Set Active then the desired build configuration from the list. These settings involves the compile and link choices for the project and are independent by any source modification we will apply in future. The Build configuration settings should be applied once as the projects are newly imported; You should remember to make the same changes to any build configuration you will use in future for any project that should be cross compiled for the Raspberry PI.

image

 

Setting the cross compiling options for the selected build

image

As shown in the above image after the desired build configuration has been selected from the project properties you should select the Cross GCC toolchain in the Tool Chain Editor option.

image

Then, from the same dialog window, in the Setting option select the ToolSettings tab and the first element in the folder list Cross Settings. You should introduce the cross compiler prefix and the full path folder where it is installed in your machine. Accordingly with the previous post indications the two parameters should be:

 

Prefix settings : arm-linux-gnueabihf-

Path: ~/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian

 

Special case: the EOLink library

These setting should be applied only to the EOLink project: This is not an executable program but it is the static library linked by any program that should use the EOLink library. Before compiling the library, from the Settings option you should also go to the Build Artifact selecting  Type, name, extension and output prefix as shown in the image below.

image

 

Patching the library and compiling

Before compiling the EOLink library we should add the patch to the eoLinuxPacketStream.cpp source as explained above. The file is located in the sources tree in EOLink/Packet/eoLinuxPacketStream.cpp starting from line 80:

 

newtio.c_cflag &= ~PARENB;


newtio.c_cflag &= ~CSTOPB;


newtio.c_cflag &= ~CSIZE;


newtio.c_cflag |= CS8;


newtio.c_cflag &= ~CRTSCTS;


// === Patch suggested by EnOcean support. Enrico Miglino BlaearicDynamics@gmail.com


newtio.c_cflag |= CLOCAL;


newtio.c_cflag |= CLOCAL;


// === Patch END





//Hardware control of port


// Blocking:     VTIME = 1


// Non-blocking: VTIME = 0 + O_NDELAY


newtio.c_cc[VTIME] = blocking ? 1 : 0; // Read-timout 100ms when blocking





// === Patch suggested by EnOcean support. Enrico Miglino BlaearicDynamics@gmail.com

//

newtio.c_cc[VMIN] = 0;


newtio.c_cc[VMIN] = 1;


// === Patch END





tcflush(fd, TCIFLUSH);


//Acquire new port settings


if (tcsetattr(fd, TCSANOW, &newtio) != 0)



puts(strerror(errno));





return EO_OK;

For convenience the patched file is attached to this post

Build the library project

To build the desired project (in this case the EOLink library) we should just Clean and Build the selected build configuration. Also this option is accessible from the project contextual menu.

imageimage

At the end of the cross-compile process We will find the libEOLink.a static library in the project ReleaseLib folder. At this point we are ready for compiling the desired tutorial and example we see in the other two project trees.

Attachments:
EOLink.Packet.eoLinuxPacketStream.cpp.tar.gz
  • Sign in to reply

Top Comments

  • DAB
    DAB over 9 years ago +2
    Nice update with useful lessons learned. I always try to do a post mortem on each project to capture these little engineering gems for use in the next project. DAB
  • balearicdynamics
    balearicdynamics over 9 years ago in reply to DAB

    Hi DAB!

     

    The idea is to provide as much information is possible to make the settings easily replicable. With your post you point the attention to the problem I was thinking about. This article, as well as some others, I think maybe one of the tutorials we have discussed to place in a specific section. But this is also part of the PiIoT Challenge posts series and I have no idea if it is the worth to replicate it or just add it to the list of possible tutorials...

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 9 years ago

    Nice update with useful lessons learned.

     

    I always try to do a post mortem on each project to capture these little engineering gems for use in the next project.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube