63

I know it runs Linux and there are real time patches available for Linux. Would those patches work?

Has anybody tried another real-time-os on the Raspberry Pi?

The idea is to use the board for regulation and control jobs that are time critical.

Avio
  • 1,239
  • 2
  • 15
  • 27
Lars Pötter
  • 1,068
  • 2
  • 9
  • 13

9 Answers9

22

In Linux kernel, enabling PREEMPT_RT will provide bounded latencies and realtime APIs. Besides configuring PREEMPT_RT, the SCHED_FIFO and SCHED_RR policies also need to be selected. And the applications need to set realtime parameters by calling appropriate APIs or by using appropriate utilities.

According to a free-electrons training: Realtime in Embedded Linux, PREEMPT_RT was a project that brings realtime capability into kernel. It has folded fully into 2.6.33 and 3.0 kernel stream. See the document you'll find everything.

Basically there have been two approaches to bring realtime capability to Linux kernel:

  • Modify inside the kernel, that is PREEMPT_RT project.
  • Run the realtime part side-by-side with a normal kernel and below the normal kernel, there have been three generations: RTLinux, RTAI, and Xenomai. (Aedos as Avio mentions below?)

Edit:

minghua
  • 341
  • 1
  • 5
17

You may be interested in running Xenomai on RaspberryPi. Here you can find a tutorial on how to do this. In a nutshell, Xenomai is a project that created custom Linux kernel (they provide patches that has to be applied to the kernel sources) enabling it to run another kernel (Xenomai core) that is a realtime one. This makes it possible to run Xenomai applications on wide range of hardware without the need to write drivers for them (since Linux is working on very wide range of hardware). This allows writing RT userspace applications using couple different RT APIs available.

Krzysztof Adamski
  • 9,605
  • 1
  • 38
  • 53
8

Wyolum mas the aLaMode (I call it the Almond Pi) to fit on top of the Pi in a stackable manner. It has a real-time clock, uses a aTiny 328, feeds of the GPIO Real UART / power and is flashable in various ways. It is great because the Pi can do whatever you want it do , web server/database while the Arduino runs in real-time interrupt.

enter image description here

Piotr Kula
  • 17,336
  • 6
  • 66
  • 105
2

Since 2018, the Pi kernel comes with a set of -rt branches on github: this is what I'd try first if I wanted to test a realtime kernel on the Pi. Currently the patched kernel version is 4.19. Clicking on "Switch branches/tags" and typing "rt" in the search box will reveal the latest patched version.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147
2

The best solution I've seen to this is the X10i - Real Time Control Board for Raspberry Pi from Heber.

X10i is a universal, powerful and secure real-time controller that permits control over multiple inputs/outputs, via USB, from any PC system. Heber now offers support in many programming languages to make it even easier for programmers, inventors and developers to connect with the outside world from their PC.

The link above provides excellent and extensive documentation and they try and keep the drivers up to date with the latest version of Debian for Pi.

Jivings
  • 22,656
  • 11
  • 94
  • 140
1

RODOS is yet another option. It's an Open Source project developed by the German Aerospace Center and Prof. Montenegro's University team and students.

It's using C++, is completely written the object oriented way and supports ARM7, Atmel AVR, STM32/Cortex-M3, Xilinx, Raspberry Pi :), ...

It's currently used in satellite TET and in LoTTo machines if I didn't get that wrong.

Of course I would prefer running it above Linux (what is possible) to have the best of both worlds - but then the REAL TIME questions remain, because I'm not sure if it is possible that Linux can provide the correct API.

To get RODOS one has to write a message to Prof. Sergio Montenegro or the DLR (German Aerospace Center).

Radagast
  • 11
  • 1
1

besides linux, there are real time operating systems. quite popular among the open sourced ones is ChibiOS/RT:

is a complete, portable, open source, compact and extremely fast RTOS (Real-Time Operating System)

a brief introduction is at http://chibios.org/dokuwiki/doku.php?id=chibios:documents:introduction. being different from linux you might also like the readings of

Well, there are some design choices that should be explained and contribute to make ChibiOS/RT a peculiar design. Nothing really new in itself but the whole is interesting.

or not. if you do like it - experimenting on the pi might be worth the experience at https://github.com/steve-bate/ChibiOS-RPi:

ChibiOS fork for Raspberry PI experimentation.

the author adds a nice guide at

http://www.stevebate.net/chibios-rpi/GettingStarted.html

personally, when it comes to rtos, for me linux is like carrying cross-alpine equipment for plain country needs. you might just not need it. even a pi might be too much. check out http://forum.arduino.cc/index.php?topic=144715.0 for even less weight :)

jitter
  • 258
  • 1
  • 7
1

Here is an article (french translated by google translate) on Raspberry Pi running with Xenomai.

0

See this version of Hypriot Raspbian with RT_PREEMPT_FULL:

http://www.ehu.eus/ehusfera/pablogn/2016/01/20/real-time-kernel-for-the-raspberry-sbc/

Pablo
  • 1