LinuxCNC on Raspberry Pi 5

More
04 Feb 2025 17:49 #320630 by unknown
Replied by unknown on topic LinuxCNC on Raspberry Pi 5

I'm trying to follow Deje63's step by step to build the RT Kernel but I end up with an error:
"reversed (or previously applied patch detected) assume -R?" when trying to run command
"patch -p1 < ../patch-$RT_PATCH_VERSION.patch".
I'm not sure what it meant so I tried to patch anyway but end upp with make throwing "Error 2" at me,.on makefile:1921. Any idea what this might be and/or how to rectify it?

OR even better if anyone might be able to share an .img with LinuxCNC working with Rpi5 and built on RaspberryOS Lite.
I can't get the GPIO pins to work with the distro on the downloads page and it looks like in the man pages that a build on RpiOS is necessary for this to work...

Edit: attached Deje's txt-file for convenience. 

 

I can't get the GPIO pins to work this doesn't help.
and it looks like in the man pages that a build on RpiOS is necessary for this to work... This is not true

Output from a halrun session loading the driver

halcmd: loadrt hal_gpio inputs=GPIO5,GPIO6,GPIO12,GPIO13,GPIO16,GPIO17,GPIO18,GPIO19 \
halcmd+:                                 outputs=GPIO20,GPIO21,GPIO22,GPIO23,GPIO24,GPIO25,GPIO26,GPIO27 \
halcmd+:                                 invert=GPIO20,GPIO27 \
halcmd+:                                 reset=GPIO21,GPIO22
Note: Using POSIX realtime
halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  Name
     4  bit   OUT         FALSE  hal_gpio.GPIO12-in
     4  bit   OUT         FALSE  hal_gpio.GPIO12-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO13-in
     4  bit   OUT         FALSE  hal_gpio.GPIO13-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO16-in
     4  bit   OUT         FALSE  hal_gpio.GPIO16-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO17-in
     4  bit   OUT         FALSE  hal_gpio.GPIO17-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO18-in
     4  bit   OUT         FALSE  hal_gpio.GPIO18-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO19-in
     4  bit   OUT         FALSE  hal_gpio.GPIO19-in-not
     4  bit   IN          FALSE  hal_gpio.GPIO20-out
     4  bit   IN          FALSE  hal_gpio.GPIO21-out
     4  bit   IN          FALSE  hal_gpio.GPIO22-out
     4  bit   IN          FALSE  hal_gpio.GPIO23-out
     4  bit   IN          FALSE  hal_gpio.GPIO24-out
     4  bit   IN          FALSE  hal_gpio.GPIO25-out
     4  bit   IN          FALSE  hal_gpio.GPIO26-out
     4  bit   IN          FALSE  hal_gpio.GPIO27-out
     4  bit   OUT         FALSE  hal_gpio.GPIO5-in
     4  bit   OUT         FALSE  hal_gpio.GPIO5-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO6-in
     4  bit   OUT         FALSE  hal_gpio.GPIO6-in-not
     4  s32   OUT             0  hal_gpio.read.time
     4  s32   OUT             0  hal_gpio.reset.time
     4  s32   OUT             0  hal_gpio.write.time

This is from the latest image. Now if something doesn't work, please please go into detail. How are we supposed to fix an issue when you don't elaborate on what happens ? I can't tell you how frustrating this is.

This driver wont work on the RPi5 hal_pi_gpio has it depend on the bcm2835 headers, which is applicable for the Rpi4 & Rpi3.

 

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 17:50 #320631 by unknown
Replied by unknown on topic LinuxCNC on Raspberry Pi 5

If you build LinuxCNC now from Master you don't have to patch the kernel anymore from 6.12+.
To be clear, of course you still need a PREEMPT_RT built kernel.
 

Do you know if this has filtered down to 2.9.4 yet ?

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 18:33 #320634 by rodw
Replied by rodw on topic LinuxCNC on Raspberry Pi 5
the 2.9.4 image or the Pi 5 has been released and is on the Downloads page. It includes the 6.12 kernel which has been built from the official Raspberry Pi kernel source
 

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 21:21 - 04 Feb 2025 23:39 #320657 by royka
Replied by royka on topic LinuxCNC on Raspberry Pi 5
@unknown Nope until now it's only at the master branch, when I see time I'll do a pull request for the 2.9 branch. You could possibly build from the 2.9 branch and apply the following patch with: git apply ../linuxcnc-rt-detect-6.12.patch

forum.linuxcnc.org/media/kunena/attachme...rt-detect-6.12.patch

Or just put "LINUXCNC_FORCE_REALTIME=1" in front of the LinuxCNC command of set it as a permanent environment setting
Last edit: 04 Feb 2025 23:39 by royka.

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 02:36 #320691 by unknown
Replied by unknown on topic LinuxCNC on Raspberry Pi 5
Once again thanks mate.

I'm going to play around with making an RPi5 image based on Trixie\Testing so I'll give it a whirl.

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 04:05 #320693 by rodw
Replied by rodw on topic LinuxCNC on Raspberry Pi 5

Once again thanks mate.

I'm going to play around with making an RPi5 image based on Trixie\Testing so I'll give it a whirl.

You might as well use the provided image becasue you basically end up with Trixie (with 6.1.2 kernel) and 2.9.4 already installed.

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 04:12 #320695 by rodw
Replied by rodw on topic LinuxCNC on Raspberry Pi 5
You could also try installing Debian Trixie from the debian image now its available
raspi.debian.net/daily-images/

Note that this will not install a desktop, just a console but it will have a preempt_rt kernel available. I did do up a doc on doing this for Debian Bullseye which will basically be the same.

docs.google.com/document/d/1S0K-UBlXnsYC...b_0/edit?usp=sharing

The name for xfce package might have changed search the debian packages for XFCE to get the right name today.
The following user(s) said Thank You: jairobbo

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 06:49 #320705 by jairobbo
Replied by jairobbo on topic LinuxCNC on Raspberry Pi 5
Hello everyone,

I started to work with linuxcnc only a few weeks ago, when I decided to upgrade my 3d printer with A and B axis.
Because my pi4 was starting to jitter I acquired a pi5. :) As one does.. :)

I etched the image 2.94 for pi5 to an SD card. Running this image, GPIO is not working.

halcmd loadrt hal_gpio help
Note: Using POSIX realtime
Invalid parameter `help'
<commandline>:0: waitpid failed /usr/bin/rtapi_app hal_gpio
<commandline>:0: /usr/bin/rtapi_app exited without becoming ready
<commandline>:0: insmod for hal_gpio failed, returned -1
cnc@raspberrypi:~$

I dont have the knowledge to troubleshoot this. Unfortunately. Maybe somebody here know how to solve this.

kind regards,
JAiro

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 06:53 #320706 by unknown
Replied by unknown on topic LinuxCNC on Raspberry Pi 5
Already built the Trixie image, just wanted to make sure there were no gotchas. Haven't added desktop yet, I'll do that when the base image boots from nvme drive on the Pi. Build the packages, put them up on github like before and build a full image.
Eventually this will need building once Trixie is officially released, might as well start checking if anything goes pear shaped.

I started with the most recent pull from pyavitz's repo and hoping that it's just the user script is needed to be slotted in and of course the userdata.txt I used for the Bookworm build. Oh and turn SPI on as default and just for myself as I'm probably the only one that uses midnight commander ditch the red & green defaults.

With regards to network manager, I really haven't noticed an issue with it on the RPi5 even with gnome network manager, reckon it's worth putting it in ? Another personal pref as it's easy to turn wifi on & off when needed.
Does this affect ethercat ?
The following user(s) said Thank You: jairobbo

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 07:47 #320709 by KrisJ
Replied by KrisJ on topic LinuxCNC on Raspberry Pi 5
Pardon me for not posting the errormessage encountered.
I was using hal_pi_gpio since I was under the impression from the forum that it is recommended for new projects.
Under "known bugs" on the man page it says:
*
At the moment (2023-07-16) this driver only seems to work on Raspbian as the generic Debian image does not set up the correct interfaces in /dev/gpiomem and restricts access to the /sys/mem interface.
*
The error message I got was related to access to /sys/mem. Since it was a known bug I did not save and post the error-message but instead tried going the Raspbian route.


I'm not sure what to make of your output from halrun but do you mean that you are successfully using GPIOs on a Rpi5 with hal_gpio and the downloaded "standard" img?
I'm not sure where I picked up that hal_pi_gpio was the way to go but if it works with hal_gpio I suppose that is the way to go. Thoughts?

Please Log in or Create an account to join the conversation.

Time to create page: 0.123 seconds
Powered by Kunena Forum