Spindle config EtherCAT

More
10 Jan 2024 13:22 #290361 by eduard
Hello All,

I having hard time to understand the very basics of HAL pins and where I can find documentation from them. I'm using Qtdragon_hd and mostly testing with halshow. 
All the hardware I have now is up and running (servos, spindle with MX2 ethercat driver, etc)
Now I trying to understand the connection to UI (Qtdragon) but it seems (for me) this part is the hardest, and lacking the documentation or it is too short and uncommented. I read all the doc for LCNC and what I found on forum, but I can not figure out. 

There is somewhere detailed docs for spindle config? Especially for ethercat. How can I start to implement controlword, how I show the spindle status, fault codes, etc throug statusword, CW and CCW through target-velocity (MX2 working with +- sign in front of the rpm).

thx
 

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

More
10 Jan 2024 13:59 #290365 by eduard
Replied by eduard on topic Spindle config EtherCAT
Maybe I try to consume the HAL in smaller bites. 

Here is the more specific question:
I have the
lcec.0.MX2.spindle-controlword what have these basic states:
7 - clear faults
10 - stop spindle 
15 - start the spindle if the rpm input is set

lcec.0.MX2.spindle-target-velocity
receives +- 10000 to 60000 rpm which sets the direction as well

the MX2 can handle cia402. Can I control with dbraun's hal-cia or that is just for servo?
How can I implement it to hal and gui to control the spindle?

thx
 

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

More
10 Jan 2024 20:02 - 10 Jan 2024 20:02 #290396 by 0x2102
Replied by 0x2102 on topic Spindle config EtherCAT
I haven't done nor tested this but the CIA402 comp should work for your spindle in CSV (velocity mode).

I would probably use Pncconf to generate a test machine with a Mesa 7i76e for example and Spindle StepGen.

Use the test machine HAL to copy out the spindle section, remove the stepgen lines and connect our velocity-cmd and velocity-fb to the CIA402 comp.

Connect and set your Spindle CIA402 to CSV mode.
Last edit: 10 Jan 2024 20:02 by 0x2102.
The following user(s) said Thank You: rodw

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

More
11 Jan 2024 16:50 #290437 by eduard
Replied by eduard on topic Spindle config EtherCAT
The drive itself supports VL mode, not CSV:

 
Attachments:

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

More
11 Jan 2024 18:14 #290440 by eduard
Replied by eduard on topic Spindle config EtherCAT
Hi,

any idea how can I solve this:

to enable the spindle rotation I have to send dec 15 to spindle-controlword, but net spindle-enable receives just bit.

or maybe the good question is, how can I send to spindle-controlword the dec15?

I think the cia402 is not working on VDF since not have just VL (velocity) mode.

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

More
11 Jan 2024 21:56 - 11 Jan 2024 22:20 #290459 by 0x2102
Replied by 0x2102 on topic Spindle config EtherCAT
You could look into the org CIA402 code and see if I could modify it to better match your needs. I bit of trial and error will probably be required. 

One option to set values with Bit on or off:
linuxcnc.org/docs/html/man/man9/mux2.9.html
Follows the value of in0 if sel is FALSE, or in1 if sel is TRUE

loadrt mux2 names=mux2.spindle-enable

addf mux2.spindle-enable servo-thread

# Spindle off 
setp mux2.spindle-enable.in0 10
# Spindle on 
setp mux2.spindle-enable.in1 15

net spindle-enable => mux2.spindle-enable.sel

net spindle-ctrl-cmd mux2.spindle-enable.out => lcec.0.MX2.spindle-controlword
Last edit: 11 Jan 2024 22:20 by 0x2102.
The following user(s) said Thank You: eduard

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

More
11 Jan 2024 21:59 #290461 by eduard
Replied by eduard on topic Spindle config EtherCAT
I did not found how to use CiA402 with this VFD since the VL mode not supported (I think) in dbraun hal-cia, and I not have any examples except for servos.

But I made the config and using the hal parameters, can control the vfd and everithing is working with a small exception.

Here is the code:

#*******************
# SPINDLE
#*******************

setp lcec.0.MX2.spindle-controlword 15

net spindle-vel-cmd-rpm => lcec.0.MX2.spindle-target-velocity
net spindle-vel-fb-rpm => lcec.0.MX2.spindle-actual-velocity
#net qtdragon.spindle-fault <= lcec.0.MX2.spindle-statusword

# ---setup spindle control signals---

net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in

# ---Setup spindle at speed signals---

sets spindle-at-speed true

When I set the controlword to 15, the vfd is powering on and waiting for the rpm input.
But when shutting down lcnc if I not set manually to 0:

lcec.0.MX2.spindle-controlword 0

on the next start the vfd not accepting remote signals from lcec (or whatever it is).

I tried to set a shutdown.hal with this parameter

setp lcec.0.MX2.spindle-controlword 0

but not working.

Any idea how to solve this?
The following user(s) said Thank You: hilo90mhz

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

More
11 Jan 2024 22:03 - 11 Jan 2024 22:09 #290462 by 0x2102
Replied by 0x2102 on topic Spindle config EtherCAT
You will need to modify the CIA402 code ...it's just an example that support CSP and CSV but you could modify and support other modes as well.

Add the MUX2 to fix your issue...

It will set the lcec.0.MX2.spindle-controlword to 15 when the "spindle-enable" signal is 1 (true) and to 0 when the "spindle-enable" signal is 0 (false).
Last edit: 11 Jan 2024 22:09 by 0x2102.
The following user(s) said Thank You: eduard

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

More
12 Jan 2024 09:48 - 12 Jan 2024 10:21 #290487 by eduard
Replied by eduard on topic Spindle config EtherCAT
UPD:
It was a type mismatch. After I changed the spindle-controlword to float from u32 in xml, now is working. But its weird, since the servo controlword still u32 and working as well. 
Why?

Anyway, thanks for the help, now I understand what I'm doing in hal. 


After testing, is not working yet.

How can I check these signals:
mux2.spindle-enable.in0
mux2.spindle-enable.in1
spindle-ctrl-cmd

they are not appearing in halshow

This is the full scpindle code:
...
...
loadusr -W lcec_conf /home/eduard/linuxcnc/custom/ethercat-conf.xml
loadrt lcec
loadrt cia402 count=1
loadrt mux2 names=mux2.spindle-enable

addf    lcec.read-all            servo-thread
addf    cia402.0.read-all       servo-thread
addf    motion-command-handler  servo-thread
addf    motion-controller       servo-thread
addf    cia402.0.write-all      servo-thread
addf    lcec.write-all            servo-thread

addf    mux2.spindle-enable        servo-thread
...
...

#*******************
#  SPINDLE
#*******************

#Spindle OFF
setp mux2.spindle-enable.in0 0

#Spindle ON
setp mux2.spindle-enable.in1 15

net spindle-vel-cmd-rpm     => lcec.0.MX2.spindle-target-velocity
net spindle-vel-fb-rpm      => lcec.0.MX2.spindle-actual-velocity
net spindle-enable             => mux2.spindle-enable.sel
net spindle-ctrl-cmd    mux2.spindle-enable.out     =>         lcec.0.MX2.spindle-controlword

#net qtdragon.spindle-fault <= lcec.0.MX2.spindle-statusword

# ---setup spindle control signals---

net spindle-vel-cmd-rps        <=  spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs    <=  spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm        <=  spindle.0.speed-out
net spindle-vel-cmd-rpm-abs    <=  spindle.0.speed-out-abs
net spindle-enable             <=  spindle.0.on
net spindle-cw                 <=  spindle.0.forward
net spindle-ccw                <=  spindle.0.reverse
net spindle-brake              <=  spindle.0.brake
net spindle-revs               =>  spindle.0.revs
net spindle-at-speed           =>  spindle.0.at-speed
net spindle-vel-fb-rps         =>  spindle.0.speed-in

# ---Setup spindle at speed signals---

sets spindle-at-speed true
 
Last edit: 12 Jan 2024 10:21 by eduard.

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

More
06 Feb 2024 00:20 #292599 by scottlaird
Replied by scottlaird on topic Spindle config EtherCAT
This is an Omron MX2? Those are surprisingly cheap on eBay...

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

Time to create page: 0.345 seconds
Powered by Kunena Forum