# Raspberry Pi 4 and a preferred OS

**URL:** <https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620>\
**Category:** Hardware\
**Tags:** linux, rpi\
**Created:** [January 15, 2021, 4:11am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620 "2021-01-15T04:11:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [January 15, 2021, 4:11am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/1 "2021-01-15T04:11:20Z")

</div>

Hi, I was asked by a colleague about the Raspberry Pi and PTB setup. I had previously played a bit, but gave up due to lots of fiddling required; It seems GPU drivers are now in place in recent kernels etc. Ubuntu 20.10 installs and runs great (using this to build a first computer for my son). Using neurodebian I just tried to install octave 5.2 + PTB, PsychLinuxConfig runs fine, but no mex files work (“cannot open shared object file: No such file or directory”). I tried also installing `liboctave-dev` but this did nothing. Is the problem Ubuntu, and sticking with the default RPi OS is required?

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [January 15, 2021, 5:44am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/2 "2021-01-15T05:44:59Z")

</div>

OK, I noticed Mario’s post in the windows tablet thread and applied his fix, and reinstalled octave and now everything is working pretty well (`VBLSyncTest` and `PerceptualVBLSyncTest` both work perfectly), though text drawing fails with this error:

```auto
Failed to load X11 font with name -*-calibri-regular-r-*--64-*-*-*.
Try a Screen('TextFont') name according to one of the listed available fonts above.

Error in function DrawText: Usage error
Couldn't select the requested font with the requested font settings from X11 system!

```

I tried using `fc-cache -r -v` to rebuild the OS cache, to no avail.

And OpenGL blending is broken in e.g. `ProceduralGarboriumDemo`

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [January 16, 2021, 1:05am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/3 "2021-01-16T01:05:37Z")

</div>

> [@Ian-Max-Andolina](#):
>
> And OpenGL blending is broken in e.g. `ProceduralGarboriumDemo`

Actually, this is just a side effect of the default configuration in the demos. For e.g. ProceduralGarboriumDemo uses this to set up the screen:

```auto
PsychImaging('AddTask', 'General', 'FloatingPoint32BitIfPossible');

```

The Raspberry Pi GPU doesn’t support 32bit and falls back to 16bit, but then disables blending. Passing in FloatingPoint16bit or 8bit explicitly and blending is enabled (although the blending mode looks wrong for that demo)…

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [January 18, 2021, 5:09am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/4 "2021-01-18T05:09:27Z")

</div>

That’s because PTB does not yet handle the RPi 4’s new VideoCore-6  
gpu. The older VC-4 for RPi 0-3 doesn’t support floating point textures or framebuffers at all, only the new VC-6 does, but with some limitations in full 32 bpc float mode. I just added needed detection logic for the VC-6 on my master branch to detect and handle this, and now we get 32 bpc float without alpha-blending, or 16 bpc float framebuffers with alpha-blending and for 32 bpc float textures we get a fallback for texture filtering, based on our filter shader. See comments in following commit, but it looks pretty good what the new Pi can do in terms of precision and functionality:

> <https://github.com/kleinerm/Psychtoolbox-3/commit/1e9f8ca53946f108ccdc21cb28d56ebfaf270521>

-mario

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [January 18, 2021, 6:40am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/5 "2021-01-18T06:40:00Z")

</div>

Oh, that’s neat! Do you have a preferred method to run Octave on the RPi but with your latest PTB? It seems Neurodebian installs 3.0.15 of PTB and this becomes a system toolbox (sorry I’ve never used Octave so its all a bit new to me). I get lots of complaints of shadowing functions if I just dump a PTB folder in the path, but perhaps that’s the way?

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [January 19, 2021, 7:24pm UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/6 "2021-01-19T19:24:11Z")

</div>

This is what i add at the top of my ~/.octaverc:

```
warning('off', 'Octave:shadowed-function');
graphics_toolkit('gnuplot');
more off;

```

Suppresses shadowed function warning, chooses old gnuplot plotting backend if the OpenGL qt based one makes trouble on some embedded graphics drivers like on the RPi. more off; makes output paging behave like Matlab, although latest Octave already uses Matlab compatible settings.

The distros itself ship whatever NeuroDebian had as recent version at time of distro version initial release, e.g., at Debian-10 initial release in case of Raspbian. NeuroDebian does not ship more up to date PTB’s for ARM atm.

I only test on Raspbian atm., the surprisingy low number of installations and lack of payment by labs does not justify much effort - i consider it still a hobby project. These are the kind of projects that need to be funded via contract work, or by many labs buying our licenses, so this can be paid out of the common money pot. E.g., if i wouldn’t have considered the RPi 4 enablement work done so far as a “christmas day fun project” hobby - and even paid the RPi 400 out of my own pocket - this would have so far cost 2500 Euros in billable time.

-mario

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [January 21, 2021, 12:10am UTC](https://psychtoolbox.discourse.group/t/raspberry-pi-4-and-a-preferred-os/3620/7 "2021-01-21T00:10:39Z")

</div>

OK thanks, my RPi will go to its intended purpose soon (first computer for my Son), so I’ve also just about run out of play time.

Neurodebian did install on the 64bit Ubuntu 20.10, and had 5.2 octave & 3.0.16 of PTB which worked OK. Fully loaded it uses about 1GB of the 4GB of RAM, more than Raspian for sure but the performance was smooth in use. I assumed that having a newer kernel and MESA etc. should help PTB. But as Ubuntu is a 64bit cuild it doesn’t work at all with a standard PTB download, only the Neurodebian builds. I also didn’t find a way to get Octave 6.1 to install (I tried flatpak and other distribution-agnostic systems to no avail, and didn’t have time to attempt compiling it myself).

For anyone who is looking for a tiny and flexible system to run experiments, I would think that with a small further push and a bit of support to Mario, RPi is close to being an ideal solution. We currently use Android tablets for automated training (using Mymou for experiment control), but I do think there are advantages in terms of programming flexibility in being able to run RPi with an largely functional PTB.
