RPI4 Raspbian 64 bit & LinuxCNC
25 Feb 2022 09:13 #235772
by euridium
Replied by euridium on topic RPI4 Raspbian 64 bit & LinuxCNC
Hello,
i have been reading and testing a pi4 64bit image for a while trying to get decent latency results.
I have read as much as i can on the forums, articles, etc and i've been running linuxcnc on PCs using software stepping for quite a while (but no expert!)
I would like to move the PC with parallel port (step and direction) to a PI4 with GPIO -
smaller foot print.
It's running a small CNC milling machine (taig) - i appricate that the rapids might not be speedy, but thats OK just now.
However, i am strugging to get a decent latency histogram reliably over 12 hours or so.
running a 80,000 base, i get latency of around -+40us.
I am running the latest elovalvo image (i have tried both raspbian (debian buster) & the ubuntu)
I have disabled wireless and bluetooth & sound, running "isolcpus=1,2,3 idle=poll"
does anyone have any suggestions on how i can further reduce the latency to a 20us (ish) on the histogram with a 80,000 base (or lower if possible) ?
OR, am i not quite understanding, and a 40us latency is perfectly fine with a 80,000 base? for software stepping over GPIO.
i appriciate the hal_gpio now has a double step option.
i'm yet to try and linux cnc directly at present - was trying to get a decently base + latency first.
Any help greatly appricated!
i have been reading and testing a pi4 64bit image for a while trying to get decent latency results.
I have read as much as i can on the forums, articles, etc and i've been running linuxcnc on PCs using software stepping for quite a while (but no expert!)
I would like to move the PC with parallel port (step and direction) to a PI4 with GPIO -
smaller foot print.
It's running a small CNC milling machine (taig) - i appricate that the rapids might not be speedy, but thats OK just now.
However, i am strugging to get a decent latency histogram reliably over 12 hours or so.
running a 80,000 base, i get latency of around -+40us.
I am running the latest elovalvo image (i have tried both raspbian (debian buster) & the ubuntu)
I have disabled wireless and bluetooth & sound, running "isolcpus=1,2,3 idle=poll"
does anyone have any suggestions on how i can further reduce the latency to a 20us (ish) on the histogram with a 80,000 base (or lower if possible) ?
OR, am i not quite understanding, and a 40us latency is perfectly fine with a 80,000 base? for software stepping over GPIO.
i appriciate the hal_gpio now has a double step option.
i'm yet to try and linux cnc directly at present - was trying to get a decently base + latency first.
Any help greatly appricated!
Please Log in or Create an account to join the conversation.
22 Mar 2022 18:05 - 22 Mar 2022 18:11 #238020
by elovalvo
Replied by elovalvo on topic RPI4 Raspbian 64 bit & LinuxCNC
I recently bought a Raspberry Pi 400 and took care of installing LinuxCNC.
First I noticed that the revision was new (c03131), not yet reported on the site :
www.raspberrypi.com/documentation/comput...ry-pi-revision-codes
It was therefore necessary to modify the cpuinfo.c and hal_pi_gpio.c
cpuinfo.c
hal_pi_gpio.c
Also since Linux kernel 5.15 has been released, and is now the default branch of raspberrypi/linux, I prepared Raspberry Pi OS (bullseye 64-bit) with Preempt_RT kernel
(github.com/kdoren/linux/releases/tag/rpi_5.15.27-rt35)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.15.27-rt35-v8+ #1 SMP PREEMPT_RT Fri Mar 11 16:34:20 GMT 2022 aarch64 GNU/Linux
I then compiled and installed the latest version of LinuxCNC (linuxcnc-uspace_2.9.0~pre0_arm64).
The files .deb (installable with gdebi) are available at this link:
linuxcnc-uspace_2.9.0~pre0_arm64_deb.zip
If you want to avoid the whole installation procedure of the various elements, the microSD image of this installation is available at this link
linucnc-2.9.0pre-bullseye_arm64rt.zip
I then mounted the SD on three raspberry Pi models, whose characteristics (obtained with the 'pinout' command) are as follows:
a) Raspberry Pi 4 Model B Rev 1.1 2GB
Revision : b03111
SoC : BCM2711
RAM : 2GB
Storage : MicroSD
USB ports : 4 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 1
Display ports (DSI): 1
b) Raspberry Pi 4 Model B Rev 1.1 4GB
Revision : c03111
SoC : BCM2711
RAM : 4GB
Storage : MicroSD
USB ports : 4 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 1
Display ports (DSI): 1
c) Raspberry Pi 400 Rev 1.1 4GB
Revision : c03131
SoC : BCM2711
RAM : 4GB
Storage : MicroSD
USB ports : 3 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 0
Display ports (DSI): 0
The first tests of operation gave good results.
In particular, these are the graphs obtained through the
latency-histogram --nobase --sbinsize 1000 --show
a)
b)
c)
Also in the case of the Pi 400 it is possible to reduce the servo cycle up to 35us without generating the 'Unexpected realtime delay' error.
First I noticed that the revision was new (c03131), not yet reported on the site :
www.raspberrypi.com/documentation/comput...ry-pi-revision-codes
It was therefore necessary to modify the cpuinfo.c and hal_pi_gpio.c
cpuinfo.c
hal_pi_gpio.c
Also since Linux kernel 5.15 has been released, and is now the default branch of raspberrypi/linux, I prepared Raspberry Pi OS (bullseye 64-bit) with Preempt_RT kernel
(github.com/kdoren/linux/releases/tag/rpi_5.15.27-rt35)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.15.27-rt35-v8+ #1 SMP PREEMPT_RT Fri Mar 11 16:34:20 GMT 2022 aarch64 GNU/Linux
I then compiled and installed the latest version of LinuxCNC (linuxcnc-uspace_2.9.0~pre0_arm64).
The files .deb (installable with gdebi) are available at this link:
linuxcnc-uspace_2.9.0~pre0_arm64_deb.zip
If you want to avoid the whole installation procedure of the various elements, the microSD image of this installation is available at this link
linucnc-2.9.0pre-bullseye_arm64rt.zip
I then mounted the SD on three raspberry Pi models, whose characteristics (obtained with the 'pinout' command) are as follows:
a) Raspberry Pi 4 Model B Rev 1.1 2GB
Revision : b03111
SoC : BCM2711
RAM : 2GB
Storage : MicroSD
USB ports : 4 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 1
Display ports (DSI): 1
b) Raspberry Pi 4 Model B Rev 1.1 4GB
Revision : c03111
SoC : BCM2711
RAM : 4GB
Storage : MicroSD
USB ports : 4 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 1
Display ports (DSI): 1
c) Raspberry Pi 400 Rev 1.1 4GB
Revision : c03131
SoC : BCM2711
RAM : 4GB
Storage : MicroSD
USB ports : 3 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 0
Display ports (DSI): 0
The first tests of operation gave good results.
In particular, these are the graphs obtained through the
latency-histogram --nobase --sbinsize 1000 --show
a)
b)
c)
Also in the case of the Pi 400 it is possible to reduce the servo cycle up to 35us without generating the 'Unexpected realtime delay' error.
Attachments:
Last edit: 22 Mar 2022 18:11 by elovalvo.
The following user(s) said Thank You: andypugh, Skippy1, tommylight, Elco, mwiktowy, JT, rdtsc, Rabin
Please Log in or Create an account to join the conversation.
23 Mar 2022 16:33 - 24 Mar 2022 13:04 #238115
by Elco
Replied by Elco on topic RPI4 Raspbian 64 bit & LinuxCNC
Thanks for the image. There was an error message about cmdline.txt, easy to fix. Works on an SD card, but is there anything particular that it will not run from an SSD? Tried at least 10 times the usual procedure, but no luck.
Thanks.
Update: Fixed by - after using the SD copy utility - manually changing in the SSD the the partition name (rootfs -> root) and the root PARTUUID in boot/cmdline.txt. Then use sudo raspi-config to reset USB as primary boot and reboot the system.
Thanks.
Update: Fixed by - after using the SD copy utility - manually changing in the SSD the the partition name (rootfs -> root) and the root PARTUUID in boot/cmdline.txt. Then use sudo raspi-config to reset USB as primary boot and reboot the system.
Last edit: 24 Mar 2022 13:04 by Elco.
The following user(s) said Thank You: elovalvo
Please Log in or Create an account to join the conversation.
25 Mar 2022 10:18 #238319
by elovalvo
Replied by elovalvo on topic RPI4 Raspbian 64 bit & LinuxCNC
Can you tell me how to get rid of the error on cmdline.txt so I can fix the image?Thanks for the image. There was an error message about cmdline.txt, easy to fix. Works on an SD card, but is there anything particular that it will not run from an SSD? Tried at least 10 times the usual procedure, but no luck.
Thanks.
Please Log in or Create an account to join the conversation.
25 Mar 2022 15:47 #238347
by Elco
Replied by Elco on topic RPI4 Raspbian 64 bit & LinuxCNC
Hello elovalvo,
I installed the image in linucnc-2.9.0pre-bullseye_arm64rt.zip on my RPi4B (8 GB).
At boot it complained (message in top right of screen) that it could not access
/boot/5.15.27-rt35-v8+/cmdline.txt
I found the same cmdline.txt in /boot so I copied that over the one in /boot/5.15.27-rt35-v8+/
At reboot the message did not show up anymore. Could have been my SD card that dropped a bit.
Elco
I installed the image in linucnc-2.9.0pre-bullseye_arm64rt.zip on my RPi4B (8 GB).
At boot it complained (message in top right of screen) that it could not access
/boot/5.15.27-rt35-v8+/cmdline.txt
I found the same cmdline.txt in /boot so I copied that over the one in /boot/5.15.27-rt35-v8+/
At reboot the message did not show up anymore. Could have been my SD card that dropped a bit.
Elco
The following user(s) said Thank You: elovalvo
Please Log in or Create an account to join the conversation.
27 Mar 2022 14:39 #238460
by Elco
Replied by Elco on topic RPI4 Raspbian 64 bit & LinuxCNC
After I installed linucnc-2.9.0pre-bullseye_arm64rt.zip on my RPi, I have made many attempts to get something running. Except for the built-in sim.axis version, unfortunately every test ended up as an error.
Since all the debug reports start with
Debug file information:
Can not find -sec TRAJ -var TPMOD -num 1
Can not find -sec EMCMOT -var HOMEMOD -num 1
Note: Using POSIX realtimemotmod: dlopen: /usr/lib/linuxcnc/modules/motmod.so: undefined symbol: kinematicsSwitch
There is probably a configuration problem. According to the (draft) 2.9 manual, the parameters TPMOD and HOMEMOD are optional, but the system complains about not seeing them. Linuxcnc.report attached.
E
Since all the debug reports start with
Debug file information:
Can not find -sec TRAJ -var TPMOD -num 1
Can not find -sec EMCMOT -var HOMEMOD -num 1
Note: Using POSIX realtimemotmod: dlopen: /usr/lib/linuxcnc/modules/motmod.so: undefined symbol: kinematicsSwitch
There is probably a configuration problem. According to the (draft) 2.9 manual, the parameters TPMOD and HOMEMOD are optional, but the system complains about not seeing them. Linuxcnc.report attached.
E
Attachments:
Please Log in or Create an account to join the conversation.
27 Mar 2022 15:56 #238464
by dgarrett
Replied by dgarrett on topic RPI4 Raspbian 64 bit & LinuxCNC
> dlopen: /usr/lib/linuxcnc/modules/motmod.so: undefined symbol: kinematicsSwitch
report not attached?
Suspect use of an out-of-tree kinematics module that
needs updating for master branch to include macro
KINS_NOT_SWITCHABLE
Ref:
linuxcnc.org/docs/devel/html/getting-sta...dating-linuxcnc.html
"13.5.5. Motion
The motion module supports kinematics modules that
define new functions kinematicsSwitchable() and
kinematicsSwitch() to switch their kinematics type. A
hal pin, motion.switchkins-type, is provided for use of
such kinematics modules.
Provided kinematics modules that implement kinematics
switching use the switchkins.o object to supply the
required rtapi_main() and related functions. Kinematics
modules that do not support kinematics switching use
the macro "KINS_NOT_SWITCHABLE" provided by
kinematics.h."
report not attached?
Suspect use of an out-of-tree kinematics module that
needs updating for master branch to include macro
KINS_NOT_SWITCHABLE
Ref:
linuxcnc.org/docs/devel/html/getting-sta...dating-linuxcnc.html
"13.5.5. Motion
The motion module supports kinematics modules that
define new functions kinematicsSwitchable() and
kinematicsSwitch() to switch their kinematics type. A
hal pin, motion.switchkins-type, is provided for use of
such kinematics modules.
Provided kinematics modules that implement kinematics
switching use the switchkins.o object to supply the
required rtapi_main() and related functions. Kinematics
modules that do not support kinematics switching use
the macro "KINS_NOT_SWITCHABLE" provided by
kinematics.h."
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19204
- Thank you received: 6437
27 Mar 2022 16:26 #238466
by tommylight
Replied by tommylight on topic RPI4 Raspbian 64 bit & LinuxCNC
@ Elco,
Please do not edit the title when replying, it makes a mess for people who are helping and for those trying to find the topic.
Thank you.
Please do not edit the title when replying, it makes a mess for people who are helping and for those trying to find the topic.
Thank you.
Please Log in or Create an account to join the conversation.
27 Mar 2022 17:41 #238469
by Elco
Replied by Elco on topic RPI4 Raspbian 64 bit & LinuxCNC
Sorry about that, I seem to be at war with the forum software. Tried a few times to attach something, kept saying no file attached.
Here we go again.
Not my day...
Elco
Here we go again.
Not my day...
Elco
Attachments:
Please Log in or Create an account to join the conversation.
27 Mar 2022 21:07 #238485
by rodw
Replied by rodw on topic RPI4 Raspbian 64 bit & LinuxCNC
Can you share your ini file?
Further to What Dewey has said the log indicates some missing ini file sections.
Further to What Dewey has said the log indicates some missing ini file sections.
Please Log in or Create an account to join the conversation.
Time to create page: 0.188 seconds