LinuxCNC support for XY2-100 interface using xy2mod and hostmot2 firmware

25 Aug 2020 10:55 #179342 by tstaroveski
Dear all,
Please accept my apologies for the long post. I have a problem trying to get the xy2-100 protocol working. This protocol/interface seems to be supported in LinuxCNC master branch (2.9, available from ) using xy2mod and mesa cards with hostmot2 firmware.

Being aware that this implementation is very new and not very well documented, I was hoping that someone could point me in the right direction on which particular hostmot2 firmware, mesa card and corresponding daughter board would be suitable for using XY2-100 protocol.

The only information on the xy2mod I was able is on the following sites:
  4. hostmot2 man pages (from LinuxCNC 2.9)

I am not sure how to proceed. So far I managed to successfully comile latest LinuxCNC from the master branch (2.9). Then I tried to load the hostmot2 firmware for 5i22-1,5 card, which I presently have for testing. I tried loading the following bitfiles:
  1. SV16.BIT, SVST2_4_7I47.BIT, SVST8_24.BIT and SVST8_8.BIT (/lib/firmware/hm2/5i22-1.5, available from hostmot2-firmware-all/hostmot2-firmware-5i22-1.5 package, version 0.8.21.g5be856c)
  2. sv16b.bit, svst8_24b.bit and svst8_8b.bit (manually extracted to /lib/firmware/hm2/5i22-mesanet/ from file available from ) - these seem to be older then bitfiles from hostmot2-firmware-all package.

Following syntax was used within HAL for testing:

loadrt threads name1=th01ms period1=1000000
loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1 debug_pin_descriptors=1 debug_modules=1

#Each of the following lines was sequentially uncommented in order to analyze the output from dmesg
#loadrt hm2_pci config="firmware=hm2/5i22-1.5/SV16.BIT num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"
#loadrt hm2_pci config="firmware=hm2/5i22-1.5/SVST2_4_7I47.BIT num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"
#loadrt hm2_pci config="firmware=hm2/5i22-1.5/SVST8_24.BIT num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"
#loadrt hm2_pci config="firmware=hm2/5i22-1.5/SVST8_8.BIT num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"

#loadrt hm2_pci config="firmware=hm2/5i22-mesanet/sv16b.bit num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"
#loadrt hm2_pci config="firmware=hm2/5i22-mesanet/svst8_24b.bit num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"
#loadrt hm2_pci config="firmware=hm2/5i22-mesanet/svst8_8b.bit num_xy2mods=1 num_encoders=0 num_pwmgens=0 num_stepgens=0"

addf          th01ms
addf hm2_5i22.0.write         th01ms

Neither of the combinations produced any meaningful output results, which would potentially indicate that the xy2mod was  sucsesfully initialised. Instead, all the pins are initialized as GPIO without any errors reported during the loading of hm2_pci driver.

Please correct me if I am wrong, but it would seem that the available hostmot2 bitfiles for 5i22 do not support xy2mod.
Is there any combination of hostmot2 firmware, mesa cards and daughter boards known to work with xy2mod?

Any advise on how to proceed would be greatly appreciated.

With kind regards and many thanks in advance,

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

25 Aug 2020 13:14 #179379 by PCW
Since the xy2-100 interface is very new its not available in standard distributed bitfiles
This means in general you would have to compile your own firmware to include the xy2-100 module.
The module is compatible with any Mesa FPGA card, typically you need 4 differential (RS422) outputs
at the minimum to interface to the galvanometer hardware (clock,sync,xdata,ydata).
These can be step/dir outputs from cards with differential drivers:
(7I76, 7I76E, 7I96, 7I47, 7I52S, 7I78, 7I85S, 7I88 etc etc)

I used a 7I96 for most of my testing, here is a bare bones hal/ini file set that replaces the
X, Y stepgen axis with the galvanometer interface:

File Attachment:

File Name:
File Size:4 KB

Note that the galvanometer hal interface mimics a stepgen run in velocity mode
This is to allow the XY2-100 interface module to interpolate positions at the
standard data rate (so 100K positions per second)
The following user(s) said Thank You: tstaroveski

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

26 Aug 2020 11:21 #179509 by Todd Zuercher
Where can I find out more info about this? And running a galvo laser with Linuxcnc?
We have several old galvo lasers at work who's Win98 vintage software is getting very long in the tooth and difficult to find suitable hardware to run on.

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

26 Aug 2020 15:20 #179554 by PCW
Depending on their age, the galvanometers may be analog rather than XY2-100

The XY2-100 modules hal interface is very much like the hardware stepgen
so setup is almost identical with just some name changes.

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

26 Aug 2020 16:05 #179556 by Todd Zuercher
Yes you're probably right. I didn't really know what this was for.
Thanks for clearing that up.

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

26 Aug 2020 16:25 #179557 by PCW
I don't actually know when the xy2-100 protocol started replacing analog interfaces
but it does seem to be after 2000 or so. It does seem to be a de-facto rather than
official standard.

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

27 Aug 2020 09:57 #179674 by tstaroveski
Dear PCW,

Thank you very much for your quick and detailed response.

I would also like to thank andy who also responded on the similar question I asked on  to on the emc-developers mailing list ( ).

I realized that I would be needing some sort of mesa daughter board that has differential signal outputs (or mesa card which already has such outputs preinstalled on board). However, without dmesg logs from hostmot2 it was very difficult to predict which particular GPIO pins would get allocated during the xy2mod(s) initialization, and consequently, which combination of daughter boards would be needed to integrate xy2mod with other possible hostmot2 functions such as encoders, pwmgens or similar.

I would like to ask a few more questions which I will post separately to avoid long posts. I hope it's ok.

My first question is about the examples you sent (

In this example, you are initializing the hostmot2 with the following code:

DRIVER=hm2_eth board_ip="" 
# DRIVER=hm2_eth board_ip="" debug=-1
CONFIG="num_encoders=1 num_stepgens=4 num_pwmgens=1 sserial_port_0=0000xxxx enable_raw"

# hostmot2 driver
loadrt hostmot2
# load low-level driver

However, the LinuxCNC_Manual_Pages.pdf ( , page 265), as well as hotmot2 man page (from LinuxCNC 2.9)  states that xy2mod(s) should be initialized with num_xy2mods=N, which is not stated in the example you you provided. In turn, you seem to have initialized xy2mod in a different way (by using num_encoders=1 num_stepgens=4 num_pwmgens=1 sserial_port_0=0000xxxx enable_raw).

In addition, the man page also states that parameters for xy2mod include "read-timer-number" and "write-timer-number", which are both of s32 type. It is not clear whether num_xy2mods should be followed by the num_dplls=N (corresponding number of phase-locked loop timers), and are these parameters used to adjust the bitrate of the XY2-100 protocol?

Any comment would be greatly appreciated.

Kind regards,

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

27 Aug 2020 15:58 - 27 Aug 2020 15:59 #179700 by PCW
The default module in initialization enables all modules if they are not mentioned
in the driver command line. Since my test config only had one xy2mod, one is enabled.

Typically only one DPLL is ever used (so again its not mentioned in the command line)

The read-timer-number and write timer-number set which DPLL timer is used to set the
offset from reference time that the feedback position is read and velocity and
acceleration pins are written. Typically the timer used to set the read offset is set to 100
usec or so before the nominal read time, and the write offset about 500 usec after
(for a 1 KHz servo thread)

The DPLLs function here is to filter out sampling and update time jitter to improve
motion precision.

The bit rate is fixed at 2 MHz (this could be changeable but 2 MHz seems to be
the standard.)
Last edit: 27 Aug 2020 15:59 by PCW.
The following user(s) said Thank You: tstaroveski

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

27 Aug 2020 16:49 #179704 by Bari
For the analog galvos I use the mesa 7i77's.
Had the galvos running within a few minutes after wiring them up.

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

27 Aug 2020 23:27 #179754 by vre
Can you give more information because i have also some analog x-y galvos
with f-theta lens and i want to use them for engraving with laser.
Also i have analog mesa card 7I33TA and other mesa cards for i/o

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

Moderators: PCWjmelson
Time to create page: 0.184 seconds
Powered by Kunena Forum