Difficulty building RTAI linuxcnc from source
- southbayguy
- Offline
- Senior Member
- Posts: 63
- Thank you received: 1
When the linuxcnc application starts, I accept the motenc configuration.
The application fails. It reports finding core_servo.hal and motenc_motion.hal, which is encouraging. But it reports it fails to find hal_motenc.so. I went to usr/lib/linuxcnc/modules and I couldn't find it either.
Where do I find hal_motenc.so so I can copy it into usr/lib/linuxcnc/modules?
Thanks.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
- Posts: 63
- Thank you received: 1
I would like to attach the error file but don't see how to, so I'm going to copy it into this reply.
Error report created by /usr/lib/tcltk/linuxcnc/show_errors.tcl:
Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-4.19.195-rtai-amd64/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
LINUXCNC - 2.8.4
Machine configuration directory is '/home/robert/linuxcnc/configs/by_interface.vitalsystems'
Machine configuration file is 'motenc.ini'
INIFILE=/home/robert/linuxcnc/configs/by_interface.vitalsystems/motenc.ini
VERSION=1.1
PARAMETER_FILE=motenc.var
TASK=milltask
HALUI=
DISPLAY=tklinuxcnc
COORDINATES=X Y Z
KINEMATICS=trivkins
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Found file(lib): /usr/share/linuxcnc/hallib/core_servo.hal
Found file(REL): ./motenc_motion.hal
Shutting down and cleaning up LinuxCNC...
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Debug file information:
insmod: ERROR: could not insert module /usr/realtime-4.19.195-rtai-amd64/modules/linuxcnc/hal_motenc.ko: No such device
./motenc_motion.hal:4: exit value: 1
./motenc_motion.hal:4: insmod for hal_motenc failed, returned -1
See the output of 'dmesg' for more information.
1181
Stopping realtime threads
Unloading hal components
Kernel message information:
[ 81.889306] I-pipe: head domain RTAI registered.
[ 81.889307] RTAI[hal]: mounted. ISOL_CPUS_MASK: 0.
[ 81.889309] SYSINFO - # CPUs: 4, TIMER NAME: 'lapic-deadline', TIMER IRQ: 4355, TIMER FREQ: 436496376, CLOCK NAME: 'tsc', CLOCK FREQ: 3491913000, CPU FREQ: 3491913000, LINUX TIMER IRQ: 4355.
[ 81.916994] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[ 81.917026] kstacks pool size = 524288 bytes
[ 81.917027] RTAI[sched]: hard timer type/freq = lapic-deadline/436496376(Hz)
[ 81.917027] linear timed lists.
[ 81.917028] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 3491913000 hz.
[ 81.917028] RTAI[sched]: timer setup = 84 ns, resched latency = 0 ns.
[ 81.922989] USERMODE CHECK: OK.
[ 81.922990] USERMODE CHECK PROVIDED (ns): KernelLatency -1, UserLatency -1.
[ 82.047900] KERNEL SPACE LATENCY ENDED AT CYCLE: 1243, LATENCY = 2035, VARIANCE = 33761/10004569, GAIN = 843651/1000000000, LEAST = 1802.
[ 82.135457] AFTER KERNEL CALIBRATION (WITH RTAI TASK, ns): KernelLatency 582, UserLatency -1 (CALIBRATION: PERIOD 10000 (ns), TIME 212464979 (ns)).
[ 82.282734] USER SPACE LATENCY ENDED AT CYCLE: 1203, LATENCY = 2428.91, VARIANCE = 0.00352333, GAIN = 0.000880833, LEAST = 2394.
[ 82.283597] USERMODE USER SPACE CALIBRATION: OK.
[ 82.283598] AFTER USER CALIBRATION (ns): KernelLatency 582, UserLatency 695 (CALIBRATION: PERIOD 10000 (ns), TIME 148140014 (ns)).
[ 82.283599] FINAL CALIBRATION SUMMARY (ns): KernelLatency 582, UserLatency 695.
[ 82.299324] RTAI[math]: loaded, using musl libm.
[ 82.498353] MOTENC: ERROR, unknown card detected
[ 84.960423] RTAI[math]: unloaded.
[ 85.031025] SCHED releases registered named ALIEN PEDV$D
[ 85.033507] RTAI[malloc]: unloaded.
[ 85.138915] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[ 85.156159] I-pipe: head domain RTAI unregistered.
[ 85.156163] RTAI[hal]: unmounted.
Info report created by linuxcnc_info:
The file: /tmp/linuxcnc_info.txt
can be posted to a forum or a web site like:
pastebin.com
in order to provide information about the linuxcnc
system and configuration.
Date: Sat 22 Jul 2023 02:15:24 PM PDT
UTC Date: Sat 22 Jul 2023 09:15:24 PM UTC
this program: /usr/bin/linuxcnc_info
uptime: 14:15:24 up 4 min, 1 user, load average: 0.10, 0.40, 0.22
lsb_release -sa: Debian Debian GNU/Linux 10 (buster) 10 buster
which linuxcnc: /usr/bin/linuxcnc
pwd: /home/robert/linuxcnc/configs/by_interface.vitalsystems
USER: robert
LOGNAME: robert
HOME: /home/robert
EDITOR:
VISUAL:
LANGUAGE:
TERM: dumb
COLORTERM:
DISPLAY: :0.0
DESKTOP: lightdm-xsession
display size: 1920x1080 pixels (508x285 millimeters)
PATH: /usr/bin:/home/robert/linuxcnc/configs/by_interface.vitalsystems/bin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
uname items:
nodename -n: debian
kernel-name -s: Linux
kernel-vers -v: #5 SMP PREEMPT Sun Jul 11 19:13:27 BST 2021
machine -m: x86_64
processor -p: unknown
platform -i: unknown
oper system -o: GNU/Linux
/proc items:
cmdline: BOOT_IMAGE=/boot/vmlinuz-4.19.195-rtai-amd64 root=UUID=b657697c-0bf8-4903-9250-3f8aee8bca89 ro initrd=/install/gtk/initrd.gz quiet
model name: Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
cores: 4
cpu MHz: 3229.143
parport:
serial: 0000-0000 : serial 0000-0000 : serial
Versions:
gcc: gcc (Debian 8.3.0-6) 8.3.0
python: Python 2.7.16
git: git version 2.20.1
git commit: NA
tcl: 8.6
tk: 8.6
glade: not_in_PATH
glade-gtk2: not_in_PATH
linuxcnc_var all:
LINUXCNCVERSION: 2.8.4
LINUXCNC_AUX_GLADEVCP: /usr/share/linuxcnc/aux_gladevcp
LINUXCNC_AUX_EXAMPLES: /usr/share/linuxcnc/aux_examples
REALTIME: /etc/init.d/realtime
RTS: /usr/realtime-4.19.195-rtai-amd64/bin/rtai-config
HALLIB_DIR: /usr/share/linuxcnc/hallib
dpkg -l '*linuxcnc*':
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============-====================-============-=====================================================================
ii linuxcnc 1:2.8.4 amd64 motion controller for CNC machines and robots
un linuxcnc-doc <none> <none> (no description available)
ii linuxcnc-doc-en 1:2.8.4.1.gb7824717b all motion controller for CNC machines and robots (English documentation)
ii linuxcnc-doc-es 1:2.8.4.1.gb7824717b all controlador de movimiento para máquinas CNC y robots (Español).
ii linuxcnc-doc-fr 1:2.8.4.1.gb7824717b all motion controller for CNC machines and robots (French documentation)
un linuxcnc-sim <none> <none> (no description available)
rc linuxcnc-uspace 1:2.8.4.1.gb7824717b amd64 motion controller for CNC machines and robots
Please Log in or Create an account to join the conversation.
Debug file information:
insmod: ERROR: could not insert module /usr/realtime-4.19.195-rtai-amd64/modules/linuxcnc/hal_motenc.ko: No such device
I think that this means that the motenc device was not found, rather than that the driver was not found.
In the kernel log there is
[ 82.498353] MOTENC: ERROR, unknown card detected
So I think that the system is returning the ENODEV code from here:
github.com/LinuxCNC/linuxcnc/blob/master...rs/hal_motenc.c#L313
Ideally you would increase the rtapi debug level and try again.
To do this, insert "debug 3" in the HAL file above the "loadrt hal_motenc" line
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
- Posts: 63
- Thank you received: 1
Thank you very much for your help.
I inserted a line "debug 3" immediately above the line "loadrt hal_motenc" in the file motenc_motion.hal,
which is at home/robert/linuxcnc/configs/by_interface.vitalsystems/
"Debug 3" did not seem to contribute much new except maybe more latency detail.
Comments about the Motenc board all cite the Motenc-100 board. I'm using an older Motenc-7544 board. Dunno if this matters.
I can pull and re-seat the board if that will help. It is encouraging that the kernel sees a PCI board. I guess it just doesn't know what to do with it.
Error report created by /usr/lib/tcltk/linuxcnc/show_errors.tcl:
Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-4.19.195-rtai-amd64/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
LINUXCNC - 2.8.4
Machine configuration directory is '/home/robert/linuxcnc/configs/by_interface.vitalsystems'
Machine configuration file is 'motenc.ini'
INIFILE=/home/robert/linuxcnc/configs/by_interface.vitalsystems/motenc.ini
VERSION=1.1
PARAMETER_FILE=motenc.var
TASK=milltask
HALUI=
DISPLAY=tklinuxcnc
COORDINATES=X Y Z
KINEMATICS=trivkins
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Found file(lib): /usr/share/linuxcnc/hallib/core_servo.hal
Found file(REL): ./motenc_motion.hal
Shutting down and cleaning up LinuxCNC...
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Debug file information:
insmod: ERROR: could not insert module /usr/realtime-4.19.195-rtai-amd64/modules/linuxcnc/hal_motenc.ko: No such device
./motenc_motion.hal:5: exit value: 1
./motenc_motion.hal:5: insmod for hal_motenc failed, returned -1
See the output of 'dmesg' for more information.
3136
Stopping realtime threads
Unloading hal components
Kernel message information:
[91800.110178] I-pipe: head domain RTAI registered.
[91800.110180] RTAI[hal]: mounted. ISOL_CPUS_MASK: 0.
[91800.110182] SYSINFO - # CPUs: 4, TIMER NAME: 'lapic-deadline', TIMER IRQ: 4355, TIMER FREQ: 436496376, CLOCK NAME: 'tsc', CLOCK FREQ: 3491913000, CPU FREQ: 3491913000, LINUX TIMER IRQ: 4355.
[91800.113045] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[91800.113070] kstacks pool size = 524288 bytes
[91800.113070] RTAI[sched]: hard timer type/freq = lapic-deadline/436496376(Hz)
[91800.113071] linear timed lists.
[91800.113071] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 3491913000 hz.
[91800.113072] RTAI[sched]: timer setup = 81 ns, resched latency = 0 ns.
[91800.119208] USERMODE CHECK: OK.
[91800.119209] USERMODE CHECK PROVIDED (ns): KernelLatency 581, UserLatency 694.
[91800.119210] FINAL CALIBRATION SUMMARY (ns): KernelLatency 581, UserLatency 694.
[91800.121540] RTAI[math]: loaded, using musl libm.
[91800.150350] MOTENC: ERROR, unknown card detected
[91802.443987] RTAI[math]: unloaded.
[91802.490705] SCHED releases registered named ALIEN PEDV$D
[91802.495351] RTAI[malloc]: unloaded.
[91802.602675] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[91802.620012] I-pipe: head domain RTAI unregistered.
[91802.620016] RTAI[hal]: unmounted.
Info report created by linuxcnc_info:
The file: /tmp/linuxcnc_info.txt
can be posted to a forum or a web site like:
pastebin.com
in order to provide information about the linuxcnc
system and configuration.
Date: Sun 23 Jul 2023 03:48:37 PM PDT
UTC Date: Sun 23 Jul 2023 10:48:37 PM UTC
this program: /usr/bin/linuxcnc_info
uptime: 15:48:37 up 1 day, 1:37, 1 user, load average: 0.00, 0.00, 0.00
lsb_release -sa: Debian Debian GNU/Linux 10 (buster) 10 buster
which linuxcnc: /usr/bin/linuxcnc
pwd: /home/robert/linuxcnc/configs/by_interface.vitalsystems
USER: robert
LOGNAME: robert
HOME: /home/robert
EDITOR:
VISUAL:
LANGUAGE:
TERM: dumb
COLORTERM:
DISPLAY: :0.0
DESKTOP: lightdm-xsession
display size: 1920x1080 pixels (508x285 millimeters)
PATH: /usr/bin:/home/robert/linuxcnc/configs/by_interface.vitalsystems/bin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
uname items:
nodename -n: debian
kernel-name -s: Linux
kernel-vers -v: #5 SMP PREEMPT Sun Jul 11 19:13:27 BST 2021
machine -m: x86_64
processor -p: unknown
platform -i: unknown
oper system -o: GNU/Linux
/proc items:
cmdline: BOOT_IMAGE=/boot/vmlinuz-4.19.195-rtai-amd64 root=UUID=b657697c-0bf8-4903-9250-3f8aee8bca89 ro initrd=/install/gtk/initrd.gz quiet
model name: Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
cores: 4
cpu MHz: 3603.331
parport:
serial: 0000-0000 : serial 0000-0000 : serial
Versions:
gcc: gcc (Debian 8.3.0-6) 8.3.0
python: Python 2.7.16
git: git version 2.20.1
git commit: NA
tcl: 8.6
tk: 8.6
glade: not_in_PATH
glade-gtk2: not_in_PATH
linuxcnc_var all:
LINUXCNCVERSION: 2.8.4
LINUXCNC_AUX_GLADEVCP: /usr/share/linuxcnc/aux_gladevcp
LINUXCNC_AUX_EXAMPLES: /usr/share/linuxcnc/aux_examples
REALTIME: /etc/init.d/realtime
RTS: /usr/realtime-4.19.195-rtai-amd64/bin/rtai-config
HALLIB_DIR: /usr/share/linuxcnc/hallib
dpkg -l '*linuxcnc*':
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============-====================-============-=====================================================================
ii linuxcnc 1:2.8.4 amd64 motion controller for CNC machines and robots
un linuxcnc-doc <none> <none> (no description available)
ii linuxcnc-doc-en 1:2.8.4.1.gb7824717b all motion controller for CNC machines and robots (English documentation)
ii linuxcnc-doc-es 1:2.8.4.1.gb7824717b all controlador de movimiento para máquinas CNC y robots (Español).
ii linuxcnc-doc-fr 1:2.8.4.1.gb7824717b all motion controller for CNC machines and robots (French documentation)
un linuxcnc-sim <none> <none> (no description available)
rc linuxcnc-uspace 1:2.8.4.1.gb7824717b amd64 motion controller for CNC machines and robots
Please Log in or Create an account to join the conversation.
linuxcnc.org/docs/2.9/html/man/man3/rtap...sg_level.3rtapi.html
No harm in trying 5 I suppose.
Anyway, it does seem that the driver only supports the Motend-100 and Motenc-lite:
github.com/LinuxCNC/linuxcnc/blob/2.8/sr...rs/hal_motenc.c#L397
If you are prepared to build LinuxCNC from source, then it might turn out to be quite easy to modify the driver to support your board.
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
- Posts: 63
- Thank you received: 1
www.vitalsystem.com/portal/motion/motenc/motenc_lite.php
Please Log in or Create an account to join the conversation.
And setting the debug level higher ought to be giving us that information.
The driver does override the msg_level in one place, but should set it back afterwards.
github.com/LinuxCNC/linuxcnc/blob/2.8/sr...rs/hal_motenc.c#L451
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
- Posts: 63
- Thank you received: 1
After trying these variations, with no change in result, I'm wondering if there might be something funkier going on, like the hal_motenc code is looking for the board ID in the wrong place ... something like that.
My confidence in the board itself is high because it has run a CNC mill for seven or eight years, running under Ubuntu. This was the original installation of LinuxCNC you helped me with. Both J7 jumpers were installed when the board was running that original machine.
I'm thinking the code (specifically the hal_motenc driver) has evolved since then while the Motenc hardware has not. Back when we put the first machine together, the Motenc-Lite board was mainstream hardware and the code expected its use. Perhaps that isn't true any more.
Please Log in or Create an account to join the conversation.
That's reading something from the FPGA, but it's hard to know what without the debug working.
It really should be telling us what it found in this line:
rtapi_print_msg(RTAPI_MSG_INFO, "MOTENC: Card is %s, ID: %d\n", pDevice->pTypeName, pDevice->boardID);
Is there any chance that the FPGA has been reprogrammed by someone, at some time?
Please Log in or Create an account to join the conversation.