XHC-HB04 wireless MPG pendant HAL module

More
08 Oct 2016 10:51 #81389 by Spectre
Well I found the sim files

I got that directory and its contents and put them into the machines directory and edited the INI file to have the HAL command to call the tcl file for the HB04 now this is what I interperated in the instructions at the bottom of the readme file..and of course..comes up with a message about the HALUI not configured and then a error crash type screen.

Please can someone explain this in a step by step plain english fashion

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

More
08 Oct 2016 11:46 #81391 by andypugh
Can you give us the exact error message? It makes it easier to guess what is wrong.

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

More
08 Oct 2016 13:19 #81407 by Spectre
As soon as I run my config to start axis small window comes up and says

HALUI is not set

Then the error screen comes up with stacks of text in it

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

More
08 Oct 2016 14:43 - 08 Oct 2016 14:43 #81414 by andypugh

HALUI is not set

That is because your iNI file is not loading halui. You need
HALUI = halui
in the [HAL] section of the INI file. As described here:
linuxcnc.org/docs/2.7/html/config/ini-config.html#_hal_section

Then the error screen comes up with stacks of text in it

The error text is often rather too verbose, and the useful information is also typically in the middle section of the three.
Here is a short primer in deciphering the error log:

Here is an example error log. The first section is Print file information which typically only tells you how far things got. For each section you need to look near the end for the clues. In this case this is the error file you get if you try to load a Mesa configuration without any Mesa hardware.
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-3.4-9-rtai-686-pae/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.8.0~pre1-ja~joints-axes12~e993e7f
Machine configuration directory is '/home/andypugh/linuxcnc/configs/by_interface.mesa.hm2-servo'
Machine configuration file is '3x20-small.ini'
INIFILE=/home/andypugh/linuxcnc/configs/by_interface.mesa.hm2-servo/3x20-small.ini
VERSION=1.0
PARAMETER_FILE=hm2-servo.var
TASK=milltask
HALUI=
DISPLAY=axis
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(REL): ./hm2-servo.hal
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=26115
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments

In this case it got as far as trying to load a HAL file.

Now the Debug File Information. This is usually the informative part.
Debug file information:
Error: could not insert module /usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/hm2_pci.ko: No such device
./hm2-servo.hal:43: exit value: 1
./hm2-servo.hal:43: insmod for hm2_pci failed, returned -1
See the output of 'dmesg' for more information.
26115
  PID TTY      STAT   TIME COMMAND
Stopping realtime threads
Unloading hal components

This isn't telling us all that much in this case, except that it has failed to load a module called hm2_pci.
Quite often this will be the bit that tells you that a HAL file pin label is missing, generally a typo or a non-loaded module.

And, finally, the Kernel Message Information, shich is identical to the output of the "dmesg" command.
Kernel message information:
] SYSINFO: CPUs 2, LINUX APIC IRQ 2312, TIM_FREQ 4124682, CLK_FREQ 3093050000, CPU_FREQ 3093050000
[48367.948452] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[48367.948454] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 4124682, 4124682, 4115500
[48367.952618] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[48367.952645] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[48367.952648] RTAI[sched]: hard timer type/freq = APIC/4124682(Hz); default timing: oneshot; linear timed lists.
[48367.952650] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 3093050000 hz.
[48367.952651] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[48367.961550] RTAI[math]: loaded.
...
(Shortened)
...
[196883.290243] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
[196883.290389] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[196883.290392] SYSINFO: CPUs 2, LINUX APIC IRQ 2312, TIM_FREQ 4124682, CLK_FREQ 3093050000, CPU_FREQ 3093050000
[196883.290394] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
[196883.290396] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 4124682, 4124682, 3822750
[196883.302423] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[196883.302455] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
[196883.302458] RTAI[sched]: hard timer type/freq = APIC/4124682(Hz); default timing: oneshot; linear timed lists.
[196883.302460] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 3093050000 hz.
[196883.302462] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[196883.315517] RTAI[math]: loaded.
[196883.361580] hm2: loading Mesa HostMot2 driver version 0.15
[196883.364862] hm2_pci: loading Mesa AnyIO HostMot2 driver version 0.7
[196883.521647] hm2: unloading
[196885.602304] RTAI[math]: unloaded.
[196885.603793] SCHED releases registered named ALIEN PEDV$D
[196885.610190] RTAI[malloc]: unloaded.
[196885.706496] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[196885.708183] I-pipe: head domain RTAI unregistered.
[196885.708384] RTAI[hal]: unmounted.

We see it loading the realtime system, then the Mesa driver, and then giving up. Though, in this case, there is no helpful message saying "no hardware found" but that is the cause in this case.
Last edit: 08 Oct 2016 14:43 by andypugh.

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

More
08 Oct 2016 16:15 - 08 Oct 2016 16:17 #81422 by dannym

Someone needs to please make up a MPG install for dummies


I got totally tripped up for a long time with the MPG HAL. OK here's what you ask for. These are the elements of note:

1. The driver code already included inside LinuxCNC. You don't touch this. It's essential and does all the magic with the port and creates HAL pins for the functions.
2. The xhc-hb04.tcl file. This actually IS a HAL file, it executes HAL commands in a sophisticated, complicated if/else system, INSTEAD of connecting the HAL. It did not work for me. You do NOT need to use it.. IMHO it is MUCH more trouble than it's worth, and I think it's probably gonna hook up something wrongly that can only be fixed by modifying the .tcl code.
3. layout20.inc, needs to be included in your HAL. Do NOT change layout20.inc
4. Inside your ini system, there can be [XHC_HB04_BUTTONS] and [XHC_HB04_CONFIG], but these ONLY get used by the xhc-hb04.tcl code, not the XHC driver itself.

So if you don't use the xhc-hb04.tcl code, you have HAL like:
# Absolute position LCD
net pos-x halui.axis.0.pos-feedback => xhc-hb04.x.pos-absolute

net originX halui.mdi-command-09 xhc-hb04.button-goto-zero-x

I got tired of people ACCIDENTALLY pressing the yellow "home all" button, so I added:
setp debounce.0.delay 1500
net homeButton xhc-hb04.button-home => debounce.0.0.in
net homeCmd debounce.0.0.out => halui.home-all

So you must hold the button for a solid 1.5 sec to start a homing cycle, not a "whoops". If I used the .tcl, this connection would have to be implemented by changing the .tcl. Or, I might make it so "home all" only has an effect from the MPG if it's never been homed, otherwise it ignores. The case for needing it is if you've stalled an axis, in which case you can go fix it from the terminal in that rare case.

The handwheel does cause vibration on high accel machines. You can create your own lowpass easy enough:

#Lowpass Filtering for mpg
addf mult2Lowpass servo-thread
setp ilowpass.0.scale 1000
setp ilowpass.0.gain 0.01
net jog-counts_in xhc-hb04.jog.counts => ilowpass.0.in
net jog-counts_out ilowpass.0.out => axis.0.jog-counts axis.1.jog-counts axis.2.jog-counts halui.feed-override.counts halui.spindle-override.counts
net jog-scale xhc-hb04.jog.scale => mult2Lowpass.in0
setp mult2Lowpass.in1 0.001
net scale_div_1000 mult2Lowpass.out => axis.0.jog-scale axis.1.jog-scale axis.2.jog-scale #axis.3.jog-scale

# Wheel for feedrate and spindle
setp halui.feed-override.scale 0.00001
net jog-feed halui.feed-override.count-enable <= xhc-hb04.jog.enable-feed-override
net jog-feed2 halui.feed-override.value => xhc-hb04.feed-override

setp halui.spindle-override.scale 0.00001
net jog-spindle halui.spindle-override.count-enable <= xhc-hb04.jog.enable-spindle-override
net jog-spindle2 halui.spindle-override.value => xhc-hb04.spindle-override
Last edit: 08 Oct 2016 16:17 by dannym.

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

More
08 Oct 2016 22:42 #81437 by Spectre
Hi Danny

Thanks for the explanation. So if I dont use the tcl file I have to add all the bits of the code manually?

I used the tcl file and it crashed again requiring a config file then it requires a buttons file to be added. This is soooooo frustrating why is it all so different.

I will upload my std HAL file and INI file can you please edit it and post it back so it will work? The machine now works fine with these files...works perfectly actually but its taken a lot and I mean a lot of reading and editing and a lot of help by cncbasher. I finally got the spindle speed working a treat now which was the last real issue I had. But now trying to add this pendant is also a mission.

I have not found any sort of "standard" 3axis machine INI or HAL file that doesnt have specific mods done to it on here. I think I must have spent almost days of time going through threads on this forum trying to decypher this stuff. I am just using the parallel port at this stage but I have another pc fitted with a 5I25 card which I want to setup the machine with a 7I76 to replace the PMDX I have in there now. So trying to get a grasp on all of this to use as a knowledge base but it has been a mission so far.

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

More
08 Oct 2016 22:50 #81438 by Spectre
Here are my files that work fine but nothing added for the HB-04 I am using the wireless 18 button version and it is in millimeters

I have pretty much every file in the test2 directory that it runs from for the HB-04.

Mark
Attachments:

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

More
09 Oct 2016 05:28 - 09 Oct 2016 05:32 #81445 by dannym
This will MOSTLY do it. Added lines to .ini. Your HAL I didn't look at, but strip any XHC references if there are any. All that needs to be in the xhc HAL file for neatness.

xhc-hb04.hal will barf for the following reasons you need to fix:
1. Will refer to components not created here via loadrt. I could not use TWOPASS due to a LinuxCNC bug so I had to add the components to the main HAL IF that type of component was already used there (can't have two loadrt for the same component in any multiple HAL files).

2. References to things you do not have:
net estop_hardswitch hm2_[HOSTMOT2](BOARD).0.gpio.030.in_not => and2.6.in0
That's my 7i92 pin reference for the estop physical hard switch. I should have named the net elsewhere and reused the name.

3.. "net AM882_enable_all oneshotEstop.out-not => hm2_[HOSTMOT2](BOARD).0.gpio.013.out" this whole thing is a pulse on my DSP drive's Enable line for a reset. You don't need this and can't use it. AM882_alarm is primarily the automatic stall detection, again, meaningless to you.

4. Had to change the cfg file to .comp to save it here. It is unchanged from the std release inside..

You'll need to know this about HAL::
1. bringing in components, "loadrt".
2. making connections (net)

debounce.0 and debounce.1 are there so you have to HOLD DOWN HomeAll or ProbeZ to start the cycle, to prevent accidental use. Recommend it.
Attachments:
Last edit: 09 Oct 2016 05:32 by dannym.

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

More
09 Oct 2016 12:23 #81460 by Spectre
Hi Danny

Thanks for the modded files. I placed them in the directory but it still crashes. I see in the debug its telling me it cant find these lines
# Absolute position LCD
net pos-x halui.axis.0.pos-feedback => xhc-hb04.x.pos-absolute
net pos-y halui.axis.1.pos-feedback => xhc-hb04.y.pos-absolute
net pos-z halui.axis.2.pos-feedback => xhc-hb04.z.pos-absolute
#net pos-a halui.axis.3.pos-feedback => xhc-hb04.a.pos-absolute

# Relative position LCD
net pos-rel-x halui.axis.0.pos-relative => xhc-hb04.x.pos-relative
net pos-rel-y halui.axis.1.pos-relative => xhc-hb04.y.pos-relative
net pos-rel-z halui.axis.2.pos-relative => xhc-hb04.z.pos-relative
#net pos-rel-a halui.axis.3.pos-relative => xhc-hb04.a.pos-relative

As I comment out each axis the debug tells me its the next line I did the first 3 feedback ones and I assume the others will be the same so I am obviously still missing some file or call in the HAL or INI

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

More
09 Oct 2016 12:28 #81461 by Spectre
In the INI file also line #8 in the HALUI seems to be a added Y0 but I removed it and it didnt make any difference but I doodnt think the program got that far. How can I copy and paste the error file as I cant seem to be able to copy and paste any of it...or even save it anywhere... does it come up in a log file anywhere?

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

Time to create page: 0.162 seconds
Powered by Kunena Forum