Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Raspberry pi rt preempt

  • hcvoort

    hcvoort - 2022-04-18


    A couple of years ago I used the Pi as a soft PLC in which you could apply an rt-preempt patch to the kernel to reduce jitter. I remember that Edwin also made a short post on how to do this. Is there still a quick way to patch a kernel for a Raspi 3B? Or do I really have to build a kernel?



  • mondinmr

    mondinmr - 2022-04-18

    You could use Debian image.
    In Debian repo you can find RT PREEMPT precompiled path.
    Tuning kernel cmdline using CPU pinning and using a fixed pinning on codesys task make possible a jitter <30us on a PI4.

    • hcvoort

      hcvoort - 2022-04-18

      Thanks for your comment. Do you have link for the debian repo?

  • mondinmr

    mondinmr - 2022-04-18
    • hcvoort

      hcvoort - 2022-04-18

      Thanks. I went through it but only saw standard builds (tested). Could you point me to the precompiled images with preempt-rt patch?

      • mondinmr

        mondinmr - 2022-04-19

        I searched again!

        RPI 2 is supported in debian with
        linux-image-rt-armmp in 32 bits arch

        RPI 3 I cannot find info

        RPI 4 apparently only in 64 bits linux-image-rt-arm64 (Tested by me in debian daily build) and CODESYS for arm at 64 bits


        Last edit: mondinmr 2022-04-19
  • mondinmr

    mondinmr - 2022-04-19

    I just mounted a PI2 image:

    $ unxz 20220121_raspi_2_bullseye.img.xz
    $ sudo losetup -Pf 20220121_raspi_2_bullseye.img
    $ sudo mount /dev/loop24p2 /mnt
    $ cd /mnt/etc/apt
    $ cat sources.list
    deb http://deb.debian.org/debian bullseye main contrib non-free
    deb http://security.debian.org/debian-security bullseye-security main contrib non-free
    # Backports are _not_ enabled by default.
    # Enable them by uncommenting the following line:
    # deb http://deb.debian.org/debian bullseye-backports main contrib non-free

    Enable those repo in raspbian than:

    $ sudo apt-get update
    $ sudo apt-get install linux-image-rt

    NEVER DO apt-get upgrade!!!!
    Remove repos before!!!

    In a Raspberry PI 4 64bit it worked for me, but now I'm switching to a my distro built with YOCTO.


Log in to post a comment.