WHB04B-6 Manual Pulse Coder

More
20 Mar 2017 14:54 #89949 by smalla
I had recently bought this device and now need some help here. So I tought for some unknown reason that this is the same device just like the XHC-HB04 but with 6 axes. But it is not. So I need to write a code to operate this MPG.

I thought the the drivers for the xhc-hb04 would be a good starting point, so I have copied the cc, tcl etc. files and renamed them to whb04b accordingly

I have done so far:
1. replaced the USB id in whb04b.cc from 10ce:eb70 to 10ce:eb93 as the transceiver is using this. Compiled successfully. When I ran whb04b alone, Im receiving something, as lines advancing with working with the buttons.
LinuxCNC wont start it stucks in waiting for components to become ready and giving me a steadily growing bunch of dots. Forever.

Now Im stuck, dont know where and what to look for. My guess that the "magic" packet is changed and the hal driver cant recognize the mpg. But how can I test it ? What Should I look for?

any help will be appreciated.

Thanks

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

More
21 Mar 2017 16:40 #90009 by andypugh
This might be as simple as the component name not matching the file name.

"loadusr -W" waits for a component with a specific name to announce its readiness, this is triggered by hal_ready()
github.com/LinuxCNC/linuxcnc/blob/master...mps/xhc-hb04.cc#L784

but the comp_id is linked to a module name:
github.com/LinuxCNC/linuxcnc/blob/master...omps/xhc-hb04.cc#L40

And this is what HAL is waiting for.

Typically the comp_id name and the file 9and hence .ko) name need to match. Perhaps you missed one, or are using the loadusr -Wn with the wrong name ("n" means "wait for a component of this name")
The following user(s) said Thank You: smalla

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

More
21 Mar 2017 22:36 #90036 by smalla
Replied by smalla on topic WHB04B-6 Manual Pulse Coder
Line 40 modname is replaced to whb04b,
loadusr -W whb04b is used in whb04b.tcl to call the program

The error is:
whb04b: waiting for WHB04B device
whb04b: found WHB04B device
Waiting for component 'whb04b' to become ready....................................................................................

if I run whb04b alone im getting:
...
Creating pin: whb04b.jog.minus-z
Creating pin: whb04b.jog.plus-a
Creating pin: whb04b.jog.minus-a
whb04b: waiting for WHB04B device
whb04b: found WHB04B device
04 CC 00 00 0D 06 00 0C delta +13
04 79 00 00 0D 11 00 08 delta +13
04 C2 00 00 0D 11 FE 00 delta +13
04 E6 00 00 0D 11 FF 04 delta +13

and the whole thing is running in sim mode.
I have checked the hal, and pins are not created for whb04b neither xhc-hb04.
there is no kernel module (.ko) made for whb04b, but I could not find one for xhc-hb04 either. Am I missing something?

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

More
21 Mar 2017 22:46 #90037 by andypugh

there is no kernel module (.ko) made for whb04b, but I could not find one for xhc-hb04 either. Am I missing something?


I think that is normal for a user-space HAL module.

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

More
22 Mar 2017 15:04 #90074 by smalla
Replied by smalla on topic WHB04B-6 Manual Pulse Coder
I made some progress, restarted from scratch from github source, compiled the module, and now it definetly working. Because it is doing something: randomly changing manual, mdi modes, and switching off machine when I play on the encoder, so there is communication, there is sometimes a percent (%) sign appears on the encoder, so the communication is two way, now I need to adjust the settings and debug the protocol.

Anybody knows how to do it ?

Thanks

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

More
23 Mar 2017 17:14 #90127 by andypugh
If you go back to sim-mode, does it tell you what buttons it thinks are being pressed?

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

More
24 Mar 2017 12:00 #90190 by smalla
Replied by smalla on topic WHB04B-6 Manual Pulse Coder
Not really.
I see jog.increment is always rising, If I push a button, move the mpg.
If I press Fn with any other keys, one pin is turning off, but nothing else seems to be moving.

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

More
24 Mar 2017 14:25 - 24 Mar 2017 14:28 #90211 by smalla
Replied by smalla on topic WHB04B-6 Manual Pulse Coder
with whb04b program itself I have identified these output commands:
Axis select:
04 XX XX XX XX 06 XX XX - Off
04 XX XX XX XX 11 XX XX - X
04 XX XX XX XX 12 XX XX - Y
04 XX XX XX XX 13 XX XX - Z
04 XX XX XX XX 14 XX XX - A
04 XX XX XX XX 15 XX XX - B
04 XX XX XX XX 16 XX XX - C

Resolution
04 XX XX XX 0D XX XX XX - 1X
04 XX XX XX 0E XX XX XX - 10X
04 XX XX XX 0F XX XX XX - 100X
04 XX XX XX 10 XX XX XX - MPG
04 XX XX XX 1A XX XX XX - Lead

Buttons:
1 2
04 XX 01 ZZ XX XX XX XX - Reset
04 XX 02 ZZ XX XX XX XX - Stop
04 XX 03 ZZ XX XX XX XX - Start
04 XX 04 ZZ XX XX XX XX - Feed+
04 XX 05 ZZ XX XX XX XX - Feed-
04 XX 06 ZZ XX XX XX XX - Spindle+
04 XX 07 ZZ XX XX XX XX - Spindle-
04 XX 08 ZZ XX XX XX XX - Morigin <-
04 XX 09 ZZ XX XX XX XX - /2
04 XX 0A ZZ XX XX XX XX - Worigin <-
04 XX 0B ZZ XX XX XX XX - Spindle On/off
04 XX 0C ZZ XX XX XX XX - Fn
04 XX 0D ZZ XX XX XX XX - Switch Coorinate

MPG:
04 XX XX XX XX XX 01- XX - MPG+
04 XX XX XX XX XX FF- XX - MPG-
04 XX XX XX XX XX 00 XX - MPG idle

And I dont know what second and eight column does, they seem to change with every input, but I cant see the relation.
Last edit: 24 Mar 2017 14:28 by smalla.

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

More
24 Mar 2017 15:18 #90216 by andypugh
8th column could be a checksum, or even a serial number.

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

More
26 Mar 2017 03:05 - 26 Mar 2017 09:47 #90279 by f1oat
Replied by f1oat on topic WHB04B-6 Manual Pulse Coder
Here we see that mpg pulses are in bytes #6, instead of #4 for original XHC-HB04.
You will need to patch here: github.com/LinuxCNC/linuxcnc/blob/af15a4...mps/xhc-hb04.cc#L440
Also, you will need to adapt buttons coding.
But the tricky part will be adapting the LCD display framing, if it has changed.
To guess the framing, one solution is to boot a windows machine with the official driver, and capture the USB traffic with an USB analyzer software.
Would like to help, but I do not have this pendant on my side.
Frederic.
Last edit: 26 Mar 2017 09:47 by f1oat.

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

Time to create page: 0.188 seconds
Powered by Kunena Forum