open_source:ccgx:installing_ccgx_func_on_raspberry_pi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
open_source:ccgx:installing_ccgx_func_on_raspberry_pi [2019-01-22 10:16] – external edit 127.0.0.1 | open_source:ccgx:installing_ccgx_func_on_raspberry_pi [2019-06-22 15:47] (current) – mvader | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Installing CCGX functionality on a raspberry pi ====== | ====== Installing CCGX functionality on a raspberry pi ====== | ||
- | === NOTE - new Information === | + | The contents of this page were moved to the Venus OS wiki: |
- | Note that information in this page is old. New information here: | + | |
- | https:// | + | |
- | And somewhat older info here: | + | https://github.com/victronenergy/venus/wiki |
- | https://www.victronenergy.com/blog/ | + | |
- | ===== And continue reading for the rest of the really old text ===== | ||
- | This page described my (Matthijs Vader) experience while trying to make the CCGX code work on a raspberry pi. | ||
- | |||
- | Just for fun, originally more a Windows man, and with initially as little help from our own software engineers as possible. :). | ||
- | |||
- | Below steps have been done on a raspberry pi 2. Much of the source code is not yet available publicly. So to start, I am putting instructions down for all the projects that are available. And for projects that contain private Victron source code I'll perhaps see if I can make them compile, and put the binaries here for download. A explanation for adding binary packages to Raspbian wheeze is [[raspbian_deb|here]]. | ||
- | |||
- | ===Cross compile vs compiling locally=== | ||
- | There are many different ways to make the ccgx functionality run on a rpi. For example do something with Poky/ | ||
- | |||
- | ===Optimizing make and gcc (not required!)=== | ||
- | Below steps have all been done on my new raspberry pi 2, running this version: | ||
- | < | ||
- | pi@raspberrypi ~ $ cat / | ||
- | Linux version 3.18.7-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 | ||
- | pi@raspberrypi ~ $ cat /etc/issue | ||
- | Raspbian GNU/Linux 7 \n \l | ||
- | pi@raspberrypi ~ $ gcc --version | ||
- | gcc (Debian 4.6.3-14+rpi1) 4.6.3 | ||
- | </ | ||
- | |||
- | [[http:// | ||
- | |||
- | To see if there really was an improvement in compile time, I have timed compiling the git sources. Running make clean before retrying. | ||
- | |||
- | With the original gcc version (4.6), it took 12m26s | ||
- | With the original gcc version, and -j4, it took only 4m12 ! | ||
- | |||
- | Then switched to the new compiler: | ||
- | export CC=gcc-4.8 | ||
- | |||
- | And ran make clean again, and ./configure --prefix=/ | ||
- | |||
- | === Install screen (not required!) === | ||
- | screen is a handy little to that jeeps your session running after disconnect led from Ccgx. Most of my raspberry Pi work I am doing in left over time using my phone, therefore often just a few minutes trying out the next command: I love the screen function! | ||
- | |||
- | To install: | ||
- | sudo apt-get install screen | ||
- | | ||
- | Then to start a session: | ||
- | screen | ||
- | | ||
- | you'll get a fresh shell. You can even add second shell using Ctrl-c, and cycle through them with Ctrl-n. | ||
- | |||
- | Next time when you login, reconnect to the still running session with: | ||
- | screen -r | ||
- | |||
- | ===== Steps ===== | ||
- | |||
- | ==== 1. Install daemontools ==== | ||
- | [[http:// | ||
- | |||
- | To install daemontools follows [[http:// | ||
- | < | ||
- | -include / | ||
- | </ | ||
- | |||
- | Daemontools will now be running, to make sure check the processlist: | ||
- | < | ||
- | pi@raspberrypi ~ $ ps ax | grep svscan | ||
- | 2171 ? Ss 0:00 /bin/sh / | ||
- | 2173 ? S 0:00 svscan /service | ||
- | 2260 pts/0 S+ 0:00 grep --color=auto svscan | ||
- | </ | ||
- | |||
- | But is not doing anything yet, as there are no services setup in /service yet. | ||
- | |||
- | ==== 2. Install the dbus-cli ==== | ||
- | [[https:// | ||
- | |||
- | First, get the code from above, and put it somewhere in the path, like so: | ||
- | < | ||
- | cd / | ||
- | sudo wget https:// | ||
- | sudo chmod a+x ./dbus | ||
- | </ | ||
- | |||
- | Then, get some dependencies, | ||
- | sudo apt-get install python-pip | ||
- | | ||
- | Then install lxml, which is needed by dbus-cli: | ||
- | sudo apt-get -y install libxml2-dev libxslt1-dev python-dev python-lxml | ||
- | | ||
- | Done! If all works, you'll be able to run dbus -y from the commandline: | ||
- | pi@raspberrypi ~ $ dbus -y | ||
- | org.freedesktop.DBus | ||
- | |||
- | ==== 3. Install dbus-modbustcp ==== | ||
- | [[https:// | ||
- | |||
- | First get the sources: | ||
- | cd | ||
- | mkdir dev | ||
- | cd dev | ||
- | git clone https:// | ||
- | | ||
- | Install the qt libraries: | ||
- | sudo apt-get install libqt4-dev | ||
- | | ||
- | Run qmake to create the makefile (set MACHINE to ccgx to make dbus_modbustcp use the system D-Bus): | ||
- | export MACHINE=ccgx && qmake | ||
- | | ||
- | Run make to compile the sources: | ||
- | make | ||
- | | ||
- | Done! Run the binary to see that you were successful: | ||
- | ~/ | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | ERROR 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | | ||
- | Note that I have not yet looked into that error! | ||
- | |||
- | sudo ln -s / | ||
- | |||
- | ==== 4. Install dbus_qwacs ==== | ||
- | [[https:// | ||
- | |||
- | To compile, follow the same steps as dbus_modbustcp. | ||
- | |||
- | When done, output will look like this: | ||
- | ~/ | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | INFO 2015-02-27T21: | ||
- | |||
- | And that goes on forever, since the local settings process is not yet installed, lets do that first! | ||
- | |||
- | ==== 5. Local settings ==== | ||
- | [[https:// | ||
- | |||
- | Steps to install (probably not as it should be done with regards to rights etc, welcome to correct this! Also it is perhaps better to make a install script for localsettings. Instead of just cloning the whole thing and adding some files, same thing: if you can improve, please do): | ||
- | cd /opt | ||
- | sudo mkdir color-control | ||
- | cd ./ | ||
- | sudo chmod a+w . | ||
- | git clone --recursive https:// | ||
- | cd localsettings | ||
- | | ||
- | sudo apt-get install python-gobject | ||
- | |||
- | Create the folder where localsettings will store settings.xml | ||
- | sudo mkdir /data | ||
- | sudo mkdir /data/conf | ||
- | sudo chmod a+w /data/conf | ||
- | | ||
- | All done (except for setting this up with daemontools). Run it to see what happens: | ||
- | < | ||
- | $ ./ | ||
- | localsettings v1.01 starting up | ||
- | 2015-03-01 14: | ||
- | 2015-03-01 14: | ||
- | 2015-03-01 14: | ||
- | Traceback (most recent call last): | ||
- | File " | ||
- | main(sys.argv[1: | ||
- | File " | ||
- | run() | ||
- | File " | ||
- | busName = dbus.service.BusName(dbusName, | ||
- | File "/ | ||
- | retval = bus.request_name(name, | ||
- | File "/ | ||
- | ' | ||
- | File "/ | ||
- | message, timeout) | ||
- | dbus.exceptions.DBusException: | ||
- | </ | ||
- | |||
- | So.. that doesnt work yet. The problem is that there are two D-Busses: system and session. On the CCGX we use the system D-Bus: all services, such as localsettings will connect tot the system D-Bus instead of the session one. But on Linux by default the system D-Bus is locked down: only user such and such is allowed to create service such and such, etc. I have looked a few seconds into what the session D-Bus is, and what it is normally used for, and it seems that there is one per user. And that doesn' | ||
- | |||
- | Open the config file with: | ||
- | sudo nano / | ||
- | | ||
- | And then look for the < | ||
- | < | ||
- | < | ||
- | <!-- All users can connect to system bus --> | ||
- | <allow user=" | ||
- | |||
- | <!-- Signals and reply messages (method returns, errors) are allowed | ||
- | by default --> | ||
- | <allow send_type=" | ||
- | <allow send_requested_reply=" | ||
- | <allow send_requested_reply=" | ||
- | <allow send_interface=" | ||
- | <allow receive_interface=" | ||
- | <allow receive_sender=" | ||
- | |||
- | <!-- All messages may be received by default --> | ||
- | <allow receive_type=" | ||
- | <allow receive_type=" | ||
- | <allow receive_type=" | ||
- | <allow receive_type=" | ||
- | |||
- | <!-- Allow everything to be sent --> | ||
- | <allow send_destination=" | ||
- | <!-- Allow everything to be received --> | ||
- | <allow eavesdrop=" | ||
- | <!-- Allow anyone to own anything --> | ||
- | <allow own=" | ||
- | |||
- | <!-- Allow anyone to talk to the message bus --> | ||
- | <allow send_destination=" | ||
- | </ | ||
- | |||
- | <limit name=" | ||
- | </ | ||
- | |||
- | Alternatively it could also be a good idea to look even better at how our smart guys have configured this on the CCGX, but for now the goal of this adventure is just to make it work. Not to do it by the book. :) | ||
- | |||
- | So, after making above change, reboot (sudo reboot), and retry: | ||
- | < | ||
- | $ ./ | ||
- | localsettings v1.01 starting up | ||
- | 2015-03-01 14: | ||
- | 2015-03-01 14: | ||
- | 2015-03-01 14: | ||
- | </ | ||
- | |||
- | Yes! Now open a second terminal, and see if you can talk to the settings: | ||
- | < | ||
- | pi@raspberrypi ~ $ dbus -y | ||
- | org.freedesktop.DBus | ||
- | com.victronenergy.settings | ||
- | pi@raspberrypi ~ $ dbus -y com.victronenergy.settings | ||
- | / | ||
- | /Settings | ||
- | </ | ||
- | |||
- | Yes! From that same terminal, we can try creating a new setting: | ||
- | < | ||
- | $ dbus -y com.victronenergy.settings /Settings AddSetting Matthijs Setting1 50 i 0 100 | ||
- | </ | ||
- | |||
- | It will return 0, which means succesfull, and in the other terminal you'll this: | ||
- | 2015-03-01 14: | ||
- | |||
- | To see more instructions, | ||
- | |||
- | So still left on the todo list is making localsettings run as a service under daemontools. More later. | ||
- | |||
- | ===== DISQUS ===== | ||
- | ~~DISQUS~~ | ||
open_source/ccgx/installing_ccgx_func_on_raspberry_pi.txt · Last modified: 2019-06-22 15:47 by mvader