jump to navigation

RealtimePi – out of the box real-time RaspberryPi Raspbian October 9, 2017

Posted by GuySoft in linux, open source, programming.
Tags: , , ,
trackback
RealtimePi logo

RealtimePi logo

Hey all,
So it started as a curiosity, and it looks like its working. I made a Raspbian-based distro that ships with a realtime kernel called RealtimePi. You can download the latest here.  It’s open source, sources are here.

A realtime system means its deterministic, it means you should know how long things take to run. They way to do is is to apply a patch to the linux kernel that makes it non-preemptible. To explain – Preemption is the act of temporarily interrupting a task being carried out by a computer system, without requiring its cooperation, and with the intention of resuming the task later.

This is useful for building hardware and robotics, low latency audio and other gpio because there are no surprises when it comes to timing. It seems like something good to try out with the RaspberryPi, because of the GPIO and IOT capabilities.

Bundled with CustomPiOS you can build your customized realtime-kernel device.

Features

  • Both armv6 and arm v7 are supported! Aka all versions of RaspberryPi to date!
  • 4.9.52-rt37-v7 with PREEMPT kernel
  • Easy way to set up the network using realtimepi_wpa_supplicant.txt in the boot partition

Steps to install

  1. Download the image here
  2. Unzip and flash it to an SD card (small enough to fit a 2GB card)
  3. Open newly flashed image and edit two files, one for the wifi, and one for the bot token:
  4. Put in realtimepi-wpa-supplicant.txt your wifi address (skip if using Ethernet cable). Here is how it should look:
    wifi

You can test the realtime kernel is enabled, by running in the commandline

uname -a

You should see something like this, note PREEMPT RT which indicates its realtime:

 Linux realtimepi 4.9.52-rt37 #1 PREEMPT RT Fri Oct 6 22:29:28 UTC 2017 armv6l GNU/Linux

The line should  look a little different for armv7

I am not an expert with actually building realtime systems, so input on how it preforms, and examples would be appreciated!

 

Comments»

1. JAM - October 14, 2017

I went to try it out. For me, Gadget USB-Ethernet seems to crash under mild network traffic on the pi zero.

GuySoft - October 14, 2017

Hey, it might be that you got this known issue:
https://www.osadl.org/Single-View.111+M5c03315dc57.0.html

I haven’t managed to reproduce it, so I didn’t apply the patch given there.
They give a workaround, adding this in the cmdline.txt:

dwc_otg.fiq_enable=0
dwc_otg.fiq_fsm_enable=0

If you can try that and report its success or failure, I’ll know what to fix for the next release.

GuySoft - March 7, 2018

The patch is now part of the release.

2. BruceR - October 14, 2017

Thanks, I’m going to try this with my Pedal-Pi

lifeinlowkey - January 8, 2018

I recently got a Pedal-Pi too, and was thinking of trying this! How did it go for you?


https://polldaddy.com/js/rating/rating.js

GuySoft - January 8, 2018

Iv’e been reading and it looks like the Pedal-Pi is just a rewrite of the arduino version. If you already have a Pi you should really try guitarix or rackarack, you can have a full real-time padal system like that. I’m looking in to building a distro for this.

lifeinlowkey - January 8, 2018

Thank you, I’ll take a swing at those. I look forward to the distro!

jujudusud - April 10, 2018

Searching for a solution to use effects on raspberry pi.
you should have a look at : https://github.com/BlokasLabs/modep-gen
It uses mod-app (a midi pedalboard for guitar and bass under debian or archlinux) and a midi and analog audio Pi-Hat.

GuySoft - April 10, 2018

Is there a project page? That is just a fork of the pi-gen buildroot. I really suggest moving to CustomPiOS, its impossible at a glance to understand what that disrro does.

jujudusud - April 18, 2018

There’s a commercial website to sell the Raspberry Pi Hat named Pisound which is an audio interface + midi interface.
I think it’s a Raspbian lite RT with an application (mod-app) taransforming the Rpi in a midi multieffect with web interface accessible via Wifi adhoc.
Please take a look :
https://blokas.io/
Thanks GuySoft 🙂

GuySoft - April 18, 2018

PiSound didn’t invent that, they are using moddevices mod-ui. Which you can also get from the Zynthian project that I am part of 🙂
http://zynthian.org/
Also- they are using pi-gen’s source to build it. Which means contributing to it would be a major pain. That is why I built CustomPiOS.

I would have tested the PiSound, but with a price tag of 99 eur its too much for me to experiment with, so i’ve been testing audioinjectors. If you can report audio quality results it would be great, because audioinjector at the moment seems to be lacking it.

jujudusud - April 18, 2018

I know that PiSound did not invent mod-ui and mod-host etc …
My goal :
– use Rpi 3B or Pi zero W
– my regular usb soundcard + midi (presonus audiobox usb)
– using LV2 plugin with Jack2 etc …
– playing guitar or bass guitar plugged into the usb soudndcard
– possibility to have access with a remote PC or Phone to the parametres of the effects.
my first attemp is here :

In french 🙂

GuySoft - April 19, 2018

Cool! So is that setup with RealtimePi or just plain raspbian?
I can ship a desktop-install script if you need that.

jujudusud - April 19, 2018

On this video it’s a raspbian desktop, jack launched by Cadence (from Kxstudio), Guitarix.
I have downloaded the last nightly of realtimepi and i have to test it headless (ssh).
Can I have a graphical window throught ssh ?

GuySoft - April 19, 2018

You can either install a desktop. Or ssh using -X flag on a computer with X . Or use this script: https://github.com/guysoft/OctoPi/blob/devel/src/modules/octopi/filesystem/home/pi/scripts/install-desktop

jujudusud - April 19, 2018

Thanks Guysoft !
Ok, my Pi zero W don’t boot.
My Pi 3B is booting very weel. I will test that later.
I can’t for now connect with ssh from Windows 10 and Putty.
I will tell you when it’s ok

jujudusud - April 20, 2018

Ok GuySoft ! Great ! My Pi3 is booting on RT kernel and desktop is installed and configured. my audio interface is recognised and confirgured as well.
I have to start Jack now. Any advice ? could you help ?
Thanks a lot.

GuySoft - April 20, 2018

Yoy can try settings of jack with qjackctl, which is a gui tool. Your usb card should work with it. However the USB host driver otg_dwc for raspberrypi is not mainline kernel (meaning its on different fork) and might not work correctly.
https://discourse.zynthian.org/t/realtime-kernel-for-raspi/1063/11?u=guysoft

jujudusud - April 21, 2018

Hello GuySoft, Not a very good attemp for me.
No possibility to use Under à good latency and more and more xruns. Better with the raspbian lite + lightdm without RT Kernel.

GuySoft - April 21, 2018

The realtime kernel gives you low latency ,which you do not have with your normal kernel. It doesn’t not increase performance but lowers it.
I get no xruns using a raspberrypi audioinjector card that connects using the i2c interface.
xruns means that you are probably setting wrong settings for your usb card. Or that your card does not work well with a realtime kernel due to it using a usb host module that is not part of the mainline kernel.
See: https://github.com/raspberrypi/linux/issues/2244#issuecomment-342822204

jujudusud - April 22, 2018

Hello GuySoft, Which audioinjector card should I buy ?
do you have an url of the shop ?

GuySoft - April 23, 2018

You need either the stereo card: http://www.audioinjector.net/

Or if you are patient they have a new one launching:

3. JAM - October 17, 2017

I added the above lines. For me, the pi zero was still hanging. I could not get past a ‘sudo apt-get update’. It also crashed for me sometimes while ssh-ing into the device. I tried an external power supply thinking the crashes were due to insufficient power on the OTG port, but that did not seem to solve it. To test if it was the hardware, I went back to a stock raspian sd card and it seemed to be OK.

GuySoft - October 17, 2017
GuySoft - October 21, 2017

Hey, there is an RC of version 0.2 with a patch that might solve your problem now:
https://github.com/guysoft/RealtimePi/issues/4

JAM - May 7, 2018

I Just tested the 0.3 version of the nightly builds on the Pi Zero. Everything appears to working much better.

Cyclictests (@idle) are showing latency of :
min: 16us
avg: 34 us
max: 96us

which is better than i thought it would be. Additionally, the USB g_ether was working flawlessly.

Nice Work!

GuySoft - May 7, 2018

Cool, would appreciate if you report that to the git issue tracker so its saved there, and other users can reply, and not here, where this stuff would be lost.

4. Yuliya P - February 16, 2018

I have installed it and now I must enter my login data. But I don’t know the default login and password. Can anybody help me?

GuySoft - February 16, 2018

Same as any raspbian image pi/raspberry

5. G - March 7, 2018

I am having trouble setting up wifi and having it automatically come up on boot.

I have separately tried editing realtimepi-wpa-supplicant.txt and realtimepi-network.txt to have my wifi ssid and key. I have also changed both. From reading the comments in realtimepi-network.txt it seems that only thins file needs to be edited for a single ssid setup.

I cannot however get the wlan going – neither automaticall at boot or manually via iwconfig or ifconfig or iw

What i have for the realtimepi-wpa-supplicant.txt, I put identical info to what I used with a standard raspbian install:

code:
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

Network={
ssid=”myssid”
psk=”mypassword”
key_mgmt=WPA-PSK
}

for realtimepi-network.txt I used:
code:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wpa-ssid myssid
wpa-psk mypassword

Some help would be greatly appreciated.

Thank you

G

GuySoft - March 7, 2018

Please open an issue in the github, this a comment section, not a issue tracker.
https://github.com/guysoft/RealtimePi/issues
Just paste it so we can go though troubleshooting there.

6. G - March 8, 2018

I have created an issue in github. I also corrected my code there.

7. Saurius - June 10, 2018

Hi, have you thinking about a FullpageOS rt-preeemted distro?

GuySoft - June 10, 2018

You can build that already, but why would you want to build that?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: