error on a modified component

More
03 Jan 2024 20:17 - 03 Jan 2024 20:18 #289693 by bobwolf
Hello everyone and happy new year
I modified the pwmgen.c component to be able to easily control an rc servo...
like pwmgen it has 3 possible configurations and I can load multiple configurations at the same time
despite the countless compilation errors I managed to create a valid compilation... after which the errors that linuxcnc gave me at startup arrived... using the terminal and halrun I reset all the messages it gave me and from the terminal the component runs with all configurations
when I try to start it from linuxcnc it only works with configuration 1 and gives me the error of the attached report

why does he do this?
how can I fix it?
ps.
then I have to see if it works on a logical level... but that's another story ;-)

ciao
Roberto

File Attachment:

File Name: linuxcnc.r...1-03.txt
File Size:12 KB
Attachments:
Last edit: 03 Jan 2024 20:18 by bobwolf.

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

More
03 Jan 2024 21:34 #289699 by PCW
Replied by PCW on topic error on a modified component
It might be a little easier for debugging to just load the component
with halcmd -kf  rather then running a full LinuxCNC installation

halcmd -fk
halcmd: loadrt pwmgen output_type=0
halcmd: addf pwmgen.update servo-thread
halcmd: addf pwmgen.make-pulses base-thread


Note: You seem to be using a Mesa card so using the hardware
RCPWMGEN is a possibility.

 

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

More
04 Jan 2024 11:01 #289754 by bobwolf
i've do your command

bobwolf@fresacnc:~$ halcmd -fk
halcmd: loadrt rc_gen output_type=0
Note: Using POSIX realtime
halcmd: addf rc_gen.update servo-thread
HAL: ERROR: thread 'servo-thread' not found
<stdin>:2: addf failed
halcmd: addf rc_gen.make-pulses base-thread
HAL: ERROR: thread 'base-thread' not found
<stdin>:3: addf failed
halcmd:

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

More
04 Jan 2024 11:07 #289758 by bobwolf
and this if i put in the .hal file
loadrt -fk rc_gen output_type=2

Debug file information:
./custom.hal:20: waitpid failed /usr/bin/rtapi_app -fk
./custom.hal:20: /usr/bin/rtapi_app exited without becoming ready
./custom.hal:20: insmod for -fk failed, returned -1
3443
Stopping realtime threads
Unloading hal components
Note: Using POSIX realtime

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

More
04 Jan 2024 11:35 #289762 by bobwolf
I tried to comment (exclude), in the .hal file the lines of my component and if I exclude the line
addf rc_gen.update servo-thread
linuxcnc starts normally
Is there maybe some problem with that part of my program?

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

More
04 Jan 2024 12:06 #289768 by Aciera
Could you post the contents of your component?

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

More
04 Jan 2024 12:21 #289769 by bobwolf
here is my file...
I'm not a programmer and I'm self-taught
the file is a modification of the pwmgen.c file
 

File Attachment:

File Name: rc_gen.c
File Size:21 KB
Attachments:

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

More
04 Jan 2024 12:45 #289773 by PCW
Replied by PCW on topic error on a modified component

i've do your command

bobwolf@fresacnc:~$ halcmd -fk
halcmd: loadrt rc_gen output_type=0
Note: Using POSIX realtime
halcmd: addf rc_gen.update servo-thread
HAL: ERROR: thread 'servo-thread' not found
<stdin>:2: addf failed
halcmd: addf rc_gen.make-pulses base-thread
HAL: ERROR: thread 'base-thread' not found
<stdin>:3: addf failed
halcmd:
 

 Sorry my example assumed LinuxCNC was running

A stand alone example would be:

halcmd -fk
halcmd: loadrt pwmgen output_type=0
halcmd: loadrt threads
halcmd: start
halcmd: addf pwmgen.update thread1
halcmd: addf pwmgen.make-pulses thread1

Have you considered using the hardware RCPWM?
It would have much better resolution than a software PWMgen
especially since the full scale RC PWM range is only 1 ms


 

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

More
04 Jan 2024 14:03 #289778 by bobwolf
if I start linuxcnc my program with configuration 1 everything is fine and it doesn't give me errors
if I set 0 or 2 in my program linuxcnc doesn't start

below is the terminal if I follow the steps you told me:

halcmd: loadrt rc_gen output_type=0
Note: Using POSIX realtime
halcmd: loadrt threads
halcmd: start
halcmd: addf rc_gen.update thread1
halcmd: rtapi_app: caught signal 11 - dumping core

halcmd: addf rc_gen make-pulses thread1
HAL: ERROR: bad position: 0
<stdin>:12: addf failed
halcmd: unloadrt rc_gen
Waited 3 seconds for master. giving up.
Note: Using POSIX realtime
rc_gen: not loaded
<stdin>:13: exit value: 255
<stdin>:13: rmmod failed, returned -1
<stdin>:13: unloadrt failed
halcmd: unloadrt rc_gen
<stdin>:14: component 'rc_gen' is not loaded
halcmd: loadrt rc_gen output_type=0
Note: Using POSIX realtime
halcmd: loadrt threads
halcmd: start
halcmd: addf rc_gen make-pulses thread1
HAL: ERROR: bad position: 0
<stdin>:18: addf failed
halcmd:

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

More
04 Jan 2024 14:27 #289780 by bobwolf

if I start linuxcnc my program with configuration 1 everything is fine and it doesn't give me errors
if I set 0 or 2 in my program linuxcnc doesn't start



 

ok i haven't understand...
i've open halcmd -fk on terminal
i've run linuxcnc from the desktop icon
halcmd exit from terminal with no message

bobwolf@fresacnc:~$ halcmd -fk
halcmd: bobwolf@fresacnc:~$



 

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

Time to create page: 0.122 seconds
Powered by Kunena Forum