Problems with including comp userspace application file to LinuxCNC project

More
30 Aug 2023 03:27 #279341 by Aciera
Then I would try a fresh install.

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

More
31 Aug 2023 15:30 #279487 by smal
Hello
I went back to my old hardware configuration. Now my test configuration LinuxCNC-HAL-SIM-AXIS works as expected. To make a resume of my actions:
1. Fresh install debian12
2. Download of linux-2.9 version of software package
3. Buildup dependencies and recompile of the LinuxCNC software package which worked fine after some initial difficulties.

When I start my configuration I have the same problems as before with linux-2.8 and LinuxCNC installation CD software:
1. Problems with inserting XHC-WHB04B-6. Inserting of serialcon is commented on this case:

Debug file information:
Note: Using POSIX realtime
Nonstandard layout:<2 (required: 1|2 are supported)>
trying: 2 (required: 1|2 are supported)
find_file_in_hallib_path: cannot find: <2 (required: 1|2 are supported)>
while executing
"find_file_in_hallib_path $cfg"
(file "./xhc-hb04.tcl" line 473)
invoked from within
"source $filename"
invoked from within
"set result [source $filename]"
(file "/home/smal/linuxcnc-2.9/scripts/haltcl" line 42)
25348
Stopping realtime threads
Unloading hal components
RTAPI_PCI: Unmapped 65536 bytes at 0x7fe452cff000
Note: Using POSIX realtime

2. Problems inserting serialcon module:
Debug file information:
Note: Using POSIX realtime
./smal3D_CNC_machine.hal:66: execv(serialcon): No such file or directory
./smal3D_CNC_machine.hal:66: waitpid failed serialcon serialcon
./smal3D_CNC_machine.hal:66: serialcon exited without becoming ready
34331
Stopping realtime threads
Unloading hal components
RTAPI_PCI: Unmapped 65536 bytes at 0x7f25bf34d000
Note: Using POSIX realtime

I am again in a position where I need help. Lets us concentrate to solve the problem 1 first.

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

More
31 Aug 2023 16:13 #279490 by Aciera
Have you tried running any of the simulation configs at 'Sample Configurations/sim/axis/xhc-hb04/'?

Could you zip up your config folder and post that so we can we what your setup looks like?

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

More
31 Aug 2023 17:42 #279499 by smal
Ok.
I start this:
/home/smal/linuxcnc-2.9/scripts/linuxcnc '/home/smal/linuxcnc-2.9/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini'
LinuxCNC loads but gives a reply that pendant is not connected at startup (require_pendant==0)
If I make lsusb I get:
smal@linuxcnc:~/linuxcnc-2.9/src$ lsusb
Bus 002 Device 003: ID 05e3:0716 Genesys Logic, Inc. Multislot Card Reader/Writer
Bus 002 Device 008: ID 10ce:eb93 Silicon Labs
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 03f0:134a HP, Inc Optical Mouse
Bus 001 Device 003: ID 046d:c312 Logitech, Inc. DeLuxe 250 Keyboard
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Pendant is visible on USB under Silicon Labs.

In the attachment is a tar file of my config folder with all the files active during application start.
Is there any way to turn on debug printouts in the code? To write them in to a file? For debugging own code what kind of printouts do you recommend?
 
Attachments:

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

More
31 Aug 2023 18:55 #279507 by Aciera

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

More
31 Aug 2023 20:56 #279514 by smal
Added single line:
ATTR{idProduct}=="eb70", ATTR{idVendor}=="10ce", MODE="0666", OWNER="root", GROUP="plugdev"
to file:
/etc/udev/rules.d/99-xhc-hb04.rules
After restart of system the problem remains the same: require_pendant==0

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

More
01 Sep 2023 07:32 #279551 by Aciera
I'm not familiar with that pendant so I'm afraid I can't really help much with that issue. You might want to open a new topic with an appropriate title to reach more users.

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

More
02 Sep 2023 07:16 #279647 by Aciera
I'm sorry I forgot the debug questions. I'm not much of a programmer but you can enable debug levels in the ini like this:

[EMC]


# Version of this INI file
VERSION = 1.1

# Name of machine, for use with display, etc.
MACHINE = LinuxCNC-HAL-SIM-AXIS

# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#define EMC_DEBUG_CONFIG 0x00000002
#define EMC_DEBUG_VERSIONS 0x00000008
#define EMC_DEBUG_TASK_ISSUE 0x00000010
#define EMC_DEBUG_NML 0x00000040
#define EMC_DEBUG_MOTION_TIME 0x00000080
#define EMC_DEBUG_INTERP 0x00000100
#define EMC_DEBUG_RCS 0x00000200
#define EMC_DEBUG_INTERP_LIST 0x00000800
#define EMC_DEBUG_IOCONTROL 0x00001000
#define EMC_DEBUG_OWORD 0x00002000
#define EMC_DEBUG_REMAP 0x00004000
#define EMC_DEBUG_PYTHON 0x00008000
#define EMC_DEBUG_NAMEDPARAM 0x00010000
#define EMC_DEBUG_GDBONSIGNAL 0x00020000
#define EMC_DEBUG_PYTHON_TASK 0x00040000
#define EMC_DEBUG_ALL 0x7FFFFFFF /* it's an int for %i to work

DEBUG = 0x00002000
#DEBUG = 0

Not sure how to get that to write to a file other than:

linuxcnc > output.txt

As for own code, I usually heavily use print() for python or rtapi_print() for kinematic components.

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

More
02 Sep 2023 14:47 #279663 by smal
Finally after spend more than 3 working days of experimenting and studying LinuxCNC I have found a way. To minimize the loss of time for other users of LinuxCNC which are interested in the same I will make a detailed description how to do it.
First: never put a userspace application into this folder: /linuxcnc-dev/src/hal/components/. This is to be meant for realtime stuff, ether single c file or comp file, and for that documented mechanism works very fine.For userspace application the appropriate folder is /linuxcnc-dev/src/hal/user_comps/. There are some other examples which can be taken as a reference. There are comp files, folders (subprojects) with more than one c file which is very convenient if added userspace subapplication has several c and h files.
While adding one comp file the according Submakefile should be corrected otherwise there will be no compile.
I have taken this project as a reference: huanyang-vfd. I have changed all the necessary notations and names to aaaa. You will find all the files in the attachment. Notice: also the Submakefile should be corrected in case of any file name changes. Make a folder aaaa in user_comps and copy in the files.To be able to compile aaaa subproject from main Makefile (/linuxcnc-dev/src/) this should be corrected:
->add new line to linenumber 179 (or after: hal/user_comps/huanyang-vfd \) and copy to it:
hal/user_comps/aaaa \
Reference document: wiki.linuxcnc.org/cgi-bin/wiki.pl?MakefileDeMystified
At this point should be possible to compile aaaa subproject with make, sudo make setuid.
Next step is to add loadusr aaaa to active hal file. In my case it is cooling.hal:
# Fake the existence of coolant options
#loadrt and2 count=3
#addf and2.0 servo-thread
#addf and2.1 servo-thread
#net flood iocontrol.0.coolant-flood => and2.0.in0
#net mist iocontrol.0.coolant-mist => and2.0.in1
#net lube iocontrol.0.lube => and2.1.in0

loadrt counter
loadusr aaaa

Next step is to open a new terminal and start the LinuxCNC (scripts folder):
~/linuxcnc-dev/scripts$ ./linuxcnc '/home/smal/linuxcnc-dev/configs/sim/axis/axis_mm.ini'

If you see something like that:
Found file(REL): ./cooling.hal
Notice: this is module aaaa!
note: MAXV     max: 53.340 units/sec 3200.400 units/min
Then you have successfully included your userspace subapplication into LinuxCNC.

 
Attachments:
The following user(s) said Thank You: Aciera

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

Time to create page: 0.078 seconds
Powered by Kunena Forum