The Software part
Update: eibd is no longer under development please install knxd.
Install Raspbian as operating system for Rasperry Pi. All developing tools to compile the eibd daemon are already included. For the current version you need a SD card with at least 4GB. The installation of rapbian is described here in detail. Its simple:-)
When your operating system is up, login as user pi and set a static IP Address to ensure the gateway is always reachable at the same IP Address.
For Debian 7 Wheezy edit the following files with your favorite editor. For me its vi :-). For Debian 8 and systemd based network configuration scroll down.
1 |
pi@raspberry~: $ sudo vi /etc/network/interfaces |
comment the following line
# iface eth0 inet dhcp
insert your static TCP/IP parameter.
allow-hotplug eth0
iface eth0 inet static
address 192.168.2.150
netmask 255.255.255.0
gateway 192.168.2.1
On Debian 8 Jessie also add the route to the eibnet mulicast address (in debian wheezy this is set by the init script) and set the interface eth0 from “allow-hotplug” to “auto” so it will not be handled by systemd, to activate the old style debian network config.
auto eth0
iface eth0 inet static
address 192.168.2.150
netmask 255.255.255.0
gateway 192.168.2.1
post-up route add -net 224.0.23.12 netmask 255.255.255.255 eth0
pre-down route del -net 224.0.23.12 netmask 255.255.255.255 eth0
adjust address, subnetmask and gateway. Open /etc/resolv.conf to set a DNS Server. In home environments this is usually the DSL Router.
1 |
pi@raspberry~: $ sudo vi /etc/resolv.conf |
nameserver 192.168.2.1
Reboot your device and login again. I preferred a remote login over ssh from my workstation.
I wrote a script install_eibd.sh which compiles and installs the eibd daemon. You can download it below. The script needs an active internet connection. Check the connection
Network configuration for Debian 8 Jessie
1 |
pi@raspberry~: $ sudo su - |
Create new file /etc/systemd/network/eth0.network. Name is not importend, just the prefix network.
[Match]
# You can also use wildcards. Maybe you want enable dhcp
# an all eth* NICs
Name=eth0
[Network]
#DHCP=v4
# static IP
# 192.168.100.2 netmask 255.255.255.0
Address=192.168.100.2/24
Gateway=192.168.100.1
DNS=192.168.100.1
# Route for Multicast Address EIB/KNX
[Route]
Destination=224.0.23.12/32
Disable the old way to configure the network, enable systemd based network configuration, enable systemd generated resolve.conf (DNS resolution) and disable dhcpcd.
Set an link from the system wide resolve.conf to systemd
Reboot to get the config active
Check the connection.
1 |
pi@raspberry~: $ ping -c 2 www.heise.de |
2 |
PING www.heise.de (193.99.144.85) 56(84) bytes of data |
3 |
64 bytes from 193.99.144.85: icmp_req=1 ttl=128 time =8.551 ms |
4 |
64 bytes from 193.99.144.85: icmp_req=2 ttl=128 time =9.680 ms |
6 |
--- 193.99.144.85 ping statistics --- |
7 |
2 packets transmitted, 2 received, 0% packet loss, time 1002ms |
8 |
rtt min/avg/max/mdev = 0.551/0.615/0.680/0.069 ms |
Note: Some rasbian version has a bug that the permissions for /bin/ping were not set correctly. The following error occurs: “ping: icmp open socket: Operation not permitted”. The setuid on /bin/ping is missing, because only root can open sockets.
1 |
pi@raspberry~: $ sudo chmod u+s /bin/ ping |
Installing eibd
The script must be run as root because some files are copied and modified in locations where only root have the appropriate permissions.
What the script does:
- Check for root permissions
- Download and compile pthsem
- Download bcusdk, but compile eibd only
- installing eibd binaries to /usr/local/bin
- create a init script /etc/init.d/eibd
- Add a user eibd with group membership dialout (to access serial device /dev/ttyAMA0)
- Disable bootmessages on serial interface /dev/ttyAMA0
- Disable console on serial interface /dev/ttyAMA0
- Disable console on serial interface /dev/ttyAMA0
- On Raspberry Pi 3 it disable the bluetooth module because its uses ttyAMA0 by default
On a Raspberry Pi 3 it is strongly recommended to update to the latest Kernel to addressing some issues with the serial device ttyAMA0
1 |
pi@raspberry~: $ sudo su |
Start a root shell, get the script.
1 |
pi@raspberry~: $ sudo su |
The highlighted eibd features are enabled. Alter the script if you need additional features.
–enable-ft12 enable FT1.2 backend
–enable-pei16 enable BCU1 kernel driver backend
–enable-tpuart enable TPUART kernel driver backend (deprecated)
–enable-pei16s enable BCU1 user driver backend (very experimental)
–enable-tpuarts enable TPUART user driver backend
–enable-eibnetip enable EIBnet/IP routing backend
–enable-eibnetiptunnel enable EIBnet/IP tunneling backend
–enable-usb enable USB backend
–enable-eibnetipserver enable EIBnet/IP server frontend
–enable-groupcache enable Group Cache (default: yes)
–enable-java build java client library
Start the script. This should be run about 20 minutes. Do not execute update-rc.d on debian jessie.
After the script has finished. eibd, vbusmonitor2, groupwrite and some other stuff should be installed at /usr/local/bin, the init script eibd in /etc/init.d and the startup links in /etc/rc3.d must exists. At the end of the script a warning message “insserv: warning: script ‘mathkernel’ missing LSB tags and overrides” is shown. This can be ignored.
3 |
-rwxr-xr-x 1 root staff 471140 Feb 18 22:14 eibd |
4 |
-rwxr-xr-x 1 root staff 10788 Feb 18 22:14 vbusmonitor2 |
7 |
-rwxr--r-- 1 root root 2142 Feb Feb 18 22:14 /etc/init.d/eibd |
10 |
lrwxrwxrwx 1 root root 14 Feb 18 22:14 /etc/rc3.d/S18eibd -> ../init.d/eibd |
Reboot your device
The eibd options and features are defined at variable EIBD_OPTIONS in file /etc/init.d/eibd. Currently are defined:
- EIB Busaddress of the daemon 1.1.128
- EIBnet/IP server
- EIBnet/IP Routing
- EIBnet/IP Tunneling
- Answer discovery and description requests
- Listen on UNIX domain socket /tmp/eib
- Listen on TCP port, default 6720
This gets a detail list of command line parameter
After the reboot and if your Raspberry KNX Board is connected the eibd should running
2 |
2996 ? Ss 0:00 /usr/ local /bin/eibd -d -D -T -R -S -i -u --eibaddr=1.1.128 tpuarts:/dev/ttyAMA0 |
If the process is running. Check if you see EIB packets on wire.
2 |
LPDU:
BC 11 17 00 03 C1 00 81 06 :L_Data low from 1.1.23 to 0/0/3 hops: 04
T_DATA_XXX_REQ A_GroupValue_Write (small) 01 LPDU: CC :ACK |
3 |
LPDU:
BC 11 17 00 03 81 00 81 46 :L_Data low from 1.1.23 to 0/0/3 hops: 00
T_DATA_XXX_REQ A_GroupValue_Write (small) 01 LPDU: CC :ACK |
Thats it. Comments are welcome!
I’ve writted another post if you want to use Raspberry Pi and eibd with a KNX USB Interface.
Update 09.06.2016: I’ve added the first release of a script to compile and install knxd. knxd is a fork of eibd. Any comments are welcome. Configfile is /etc/default/knxd, Socket /tmp/knx. See this EIB/KNX Router with knxd