Rocrail in the raspberry!

Questions and discussions around compiling of Rocrail, usage of wxWidgets etc.

Moderators: dadolphs, Moderators

Postby mserrano » 06.01.2013, 23:19

Thanks Eric,

Yes, I know it is possible to change the baudrata... I have actually tried the baud rates I think ddx is using (19200 an 38400) and they seem to work.

I have the feeling the problem is not on the baudrate, but on the capability of the port.
After some days reading in the internet I have found some extra information... not very much for the amount of hours invested though.
Apparently, there are two UARTS at the rpi, and the one active by default is not as powerful as expected: ... ial-ports/
In particular the issue of the buffering could be affecting
I have being trying to make use of this second uart.
First, compiling the script here ... us-viewer/
I was able to see the status for each pin
Then, using the example from
I made a small c program to change pin 14 and pin 15 to ALT_5 (assuming this should be the second UART).

With this configuration, it seems the serial driver is not capable of sending anything...which I think is normal. In any case after rebooting, the pins 14 and 15 always come back to alt0.

At this point, I do not know what else to test... I do not know so much about linux and how rocrail manages the serial ports...

I will keep checking the rpi community to see if someone explains how ((if it is possible) to use this second port.

If someone with more experience on rocrail use of serial ports and ddx can check if the rpi uart is compliant with rocrail requirements, it would be great.

On the other hand, I have completed the tests with the usb adapter. As expected, the signal is not so good, especially with Marklin format... It can still be used, but certain decoders (tams) are not working properly (glitches).

This is particularly weird: the rpi serial port manages perfectly MM decoders, but is impossible to run DCC. I would have expected a behavior similar to the usb adaptor, where dcc works perfectly, and some MM decoders have problems.

Rocrail and CS2

Postby Pimanel » 09.01.2013, 13:04

Hi to all

mserrano, I bought a Raspberry Pi as well and I want to controll my layout with it. I found your tutorial very simple to follow. Thanks for that.

I have a couple of questions. My layout is controlled by a CS2 (Marklin). Do I have to follow all your steps or do I need to do something different?
All these commands that you perform and running rocrail are done inside the "windows environment of the debian-wheezy package"?
And since I am not familiar to Linux, to where I have to copy the rocrail files of the layout (.xml, .ini, etc...)?

Thanks in advance.

Postby mserrano » 09.01.2013, 13:29

Hi Johannes,

I am not so familiar with the CS2, but from what I know, the configuration should be much easier than the configuration of the DDX.

You do not need to do anything related to the serial port in the guideline - section 3.1.3.

As far as I know, the CS2 requires an IP address, so you need to have the rpi in the same network as the CS2. Instructions on how to set a fix IP address in the rpi are found in section 4.1.2.

Other than that, you do not need anything else.

All the commands are introduced from the terminal. By default the rpi does not start with the "window environment", unless you selected otherwise during the first configuration. in order to launch the windows environment you need to tap "startx".

If you changed the configuration, or you prefer to work with the window environment, you need to open a terminal too - lxterminal.

With the instructions I provided, you need to copy the xml and ini files in "/opt/rocrail". There are other ways to install such files, but in the guidelines I prepared, the files should be there.

If you need anything else, just let me know.

PS: One last thing, I would recommend you to plug the rpi and the CS2 through a switch connected to internet. This way: 1) you still get internet in the rpi - I do not know if the CS2 requires it; 2) you avoid power problems with the ehternet port of the rpi (sometimes it requires too much current).

Postby Pirat-Kapitan » 09.01.2013, 14:28

I skiped the startx-part of mserranos instruction.
My RasPi runs only the rocrail server and the clients run on windows xp laptops and iPad / androidpad.

Rocrail runs as Daemon: planfile in the directory /opt/rocrail.
Rocrail runs in console modus: planfile in the directory /home/pi/rocrail.

A german instruction, how to (made after the instructions of mserrano) is posted. Sorry, I do not translate this to english.

Best regards
You do not have the required permissions to view the files attached to this post.
Clearasilfahrer auf Spur G&H0m, Lenz LZV (3.6), ORD-20, Manhart-Funki und WLM, RS-Bus Rückmelder (Reedkontakte/GBM),
Rocrail auf RasPi mit mobilen Geräten (andRoc). Details auf ... at-kapitan.

Postby Toto » 09.01.2013, 14:58

Hallo Johannes,

Ich beschäftige mich auch schon seit einiger zeit mit dem Raspi, hab auch schon eine Installation nach Manolos Vorgaben durchgeführt und es lief sogar incl Rocview. Leider werfen mich ständige Spannungsprobleme (denke ich) immer wieder zurück. Hab schon diverse Netzteile, Tastaturen, Mäuse und USB Hubs probiert, doch es ergab keine wirkliche Besserung. Was für ein Netzteil, Tastatur, Maus und Monitor (welcher Anschluß?) benutzt Du? Bei Mir erlischen immer die Ethernet LED´s und ich kann keine Tastatureingaben mehr machen. (Suche im Pi-Forum ergab meistens das Resümee: Spannungsproblem)


Spur 0, ECoS, Can Bus Rückmelder (GCA), Digital-Bahn Decoder, Bidib, Lenz LZV100

Postby Pirat-Kapitan » 09.01.2013, 17:09

Hi Torsten,
this is the english written part of the forum.
You asked about problems of power supply and which devices are on may Raspi:

no screen / keyboard
LAN Connection via cable to Router
Powersupply are some different USB-Power-Supply 5 V / 1,2 A.
Only rocrail as server, no GUI on RasPi.
I use 2 RasPi working, 1 x on my stationary Layout (garden railway) and 1 x mobile installation (demo, shows etc.)

in german
ich setze den RasPi nur via Ethernetkabel an den WLAN-Router verbunden ein. Kein Monitor, keine Tastatur.
Netzteil sind diverse USB-Schaltnetzteile 5V / 1,2 A.
ich nutze keine graphische Oberfläche auf dem RasPi.

Bei mir laufen derzeit 2 RasPi, 1 x stationär und 1 x mobil.

Du kannst mich gerne mal direkt anmorsen.

best regards
Clearasilfahrer auf Spur G&H0m, Lenz LZV (3.6), ORD-20, Manhart-Funki und WLM, RS-Bus Rückmelder (Reedkontakte/GBM),
Rocrail auf RasPi mit mobilen Geräten (andRoc). Details auf ... at-kapitan.

Postby Helge » 10.01.2013, 20:51

Hello Torsten,

let me add my experiences to what Johannes has already stated.

A raspi will run connected to an ethernet router with a 5V 700mA usb power supply, but this is only valid for this very simple configuration.

If you want to use a usb keyborad, a monitor and probably a usb wlan adapter you should go for 2 A power supply.
Regarding the power consumption a monitor is not a problem but the keyboard and the usb wlan adapter.

Your monitor should be one with a hdmi connector or at least dvi connector. If your monitor has dvi input you need an adapter cable hdmi to dvi.
A vga monitor can not be used at the raspi. The reason for this is that vga provides an anlog signal, dvi or hdmi a digital one.



Postby Pirat-Kapitan » 10.01.2013, 21:56

Hi Helge and Torsten,
if You want connect more than 2 USB decices, You have to use an USB-hub. Please chose an active hub with a powersupply of its own.
Then You do not have to count powerconsumption via USB of RasPi.

In german:
aktiven USB-Hub bei Verwendung von USB-Geräten verwenden.
Ich fahre zwar mit WLAN Stick und kabelloser Tastatur über das RS-netzteil (wurde mit dem RasPi bei RS bestellt), aber mit Maus dazu brauche ich eh´den Hub und der hat ein 2A Netzteil.

best regards
Clearasilfahrer auf Spur G&H0m, Lenz LZV (3.6), ORD-20, Manhart-Funki und WLM, RS-Bus Rückmelder (Reedkontakte/GBM),
Rocrail auf RasPi mit mobilen Geräten (andRoc). Details auf ... at-kapitan.

Postby Toto » 11.01.2013, 00:43

Hello Johannes & Helge,

first of all let me say sorry for my answer in the wrong language. I´ve tried the raspi in many configutations so long, always with an powered hub and a monitor unsing also dvi or hdmi. After triying a normal usb-keyboard and mouse, i use a logitech K400r keyboard witch has a touchpad included and is offically ok for the raspi. For power supply i´ve tried a Annsmann 1A supply, a LG 1A handy loader and a ipad supply with 2A. The fault was the same. In the raspi forum i´ve read that some of them don´t supply 5V all the time, but some people use 5,15V supplys. my next step will be to order one of this supplys and test again. Rocrail will run on a windows pc untill the raspi is in service. Many thanks for your feedback.

Spur 0, ECoS, Can Bus Rückmelder (GCA), Digital-Bahn Decoder, Bidib, Lenz LZV100

Postby zeno » 24.01.2013, 14:37


I have also rebuilt rocrail several times using the excellent instructions given in this topic.

However, as noted by Colin Begg, there seems to be an issue with the build process.

The tables appear to load correctly.

When auto mode is switched on then the routing does not operate as expected.

In order to confirm that this was not an issue with nightly builds the software was rebuilt after reverting to an earlier version which matches the windows software I am using. On windows all is well. When I switch to the rocrail server on the raspberry pi then then the routing fails.

During the build process I get some messages - "return from incompatible pointer type [enabled by default] ".

Finally, when Rocrail starts there is a warning in syslog about a deprecated system call "warning: process `rocrail' used the deprecated sysctl system call with 8.1.2."

GCC 4.6 is the current level on the Raspberry Pi.

Postby Pirat-Kapitan » 24.01.2013, 15:54

Hi Zeno,
which version of rocrail do You use ?
which version of RasPi-OS?
Do You use rocrail only or rocrail and rocview on the RasPi ?
GCC 4.6 ? I did not see this on my RasPi.

best regards
Clearasilfahrer auf Spur G&H0m, Lenz LZV (3.6), ORD-20, Manhart-Funki und WLM, RS-Bus Rückmelder (Reedkontakte/GBM),
Rocrail auf RasPi mit mobilen Geräten (andRoc). Details auf ... at-kapitan.

Postby zeno » 24.01.2013, 19:57

Hi Johannes,

Rocrail is a nightly build 4559 (but I have used older versions too). It is currently installed on Windows and the RPI,

o/s: Raspbarian official release reported as:
Operating system Debian Linux 7.0
Kernel and CPU Linux 3.2.27+ on armv6

I use a remote connection on the RPI, can start rocview but it is very slow.

the 4.6 is the c++ version which can be determined by typing "gcc --help" in a terminal window.

Postby Pirat-Kapitan » 25.01.2013, 00:15

Hi Zeno
I use rocrail version 4466 (my latest building) on RasPi an on a windows PC with XP, iPad and androidpad and I did not noticed such message.

As i wrote before, i do not use rocview on Raspi.
I check it today running rocrail as daemon, running /opt/rocrail/./ I got a new plan but now error message.
OS an C++ on my rasPi are as Yours.

Best regards
Clearasilfahrer auf Spur G&H0m, Lenz LZV (3.6), ORD-20, Manhart-Funki und WLM, RS-Bus Rückmelder (Reedkontakte/GBM),
Rocrail auf RasPi mit mobilen Geräten (andRoc). Details auf ... at-kapitan.

Postby zeno » 25.01.2013, 01:07

Hi Johannes,

The system log message is a warning for a deprecated system call which you will not see in the rocrail user logs. It probably irrelevant, but you should be able to find the message it in /var/log/syslog when rocrail daemon starts or is restarted.

The other warning messages are generated during compilation of the source (make PLATFORM=LINUX fromtar). They could be significant in this instance because the message means that the return type is not as expected. The default return is integer.

It may just need another option to be supplied to the make process for Raspberry pi.

I will try 4466, hope it works it takes a long time to cross-compile.

I also do not use Rocview on my Raspberry Pi.

BTW I use a locobuffer interface from RRcirkits . I also tried a cheap USB serial cable with an old locobuffer 2 from Hans de Loof and this also works which is "nice to know".

Postby zeno » 25.01.2013, 16:33

Hi Johannes

Having tried a few tests I think that I now understand what is happening.

My plan does not conform to the current "block side" approach, having been created years ago just after "block side" was implemented.

My windows version of rocrail.ini does not have "block side" flag set. The Linux version does have this flag set (in fact it forces the flag to true).

I am now rewriting my plan to conform to the standard so that a proper comparison can be made.


Return to Building & Compiling