Ethercat CATIO-A setup

More
27 Jul 2025 07:06 #332400 by oneKone
Ethercat CATIO-A setup was created by oneKone
Hi;
I've tried to setup an ethercat catio-a for pwm to control a vfd. Initially i followed this post: forum.linuxcnc.org/ethercat/52997-etherc...module-help?start=10 to get me started. In the cia402.hal i've added "net spindle-pwm => lcec.0.0.PWM-OUT-0" and "net spindle-duty =>  lcec.0.0.DUTY-OUT-0" 

within linuxcnc/ halshow/ watch pins i can set the spindle duty and spindle frequency. The biggest problem is i'm not sure where to go from here for configuration to have a set frequency and pwm tied to spindle rpm. To me, is seems all of the spindle documents don't apply to (CIA402) ethercat io modules.

I should note that i'm a complete lcnc noob so there's more than likely something i've missed along the way. I'm hoping to get some help from someone that's successfully setup something like this in the past. 

cheers

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

More
28 Jul 2025 06:15 #332456 by Hakan
Replied by Hakan on topic Ethercat CATIO-A setup
You are kind of out of the ethercat swamp now. It's now all linuxcnc and hal
to set up the spindle.
You will need to know what the spindle expects as input (read the manual)
and what input you need to give to the ethercat unit to produce that (read that manual).

The example here uses the pwmgen component, ethercat does that now so you won't need that.
linuxcnc.org/docs/html/examples/spindle.html
You have the speed in spindle.0.speed-out, you should connect that to the duty cycle but you almost certainly
need to scale the rpms to the duty cycle number. Check example 1 in the doc above how to use the scale component
for that. So you will have the spindle rpm going in to the scale component and the output from
the scale component going to the lcec.0.0.DUTY-OUT-0 pin.

Set the frequency to the spindle's preferred frequency like 1500 (don't know, check manual)
setp lcec.0.0.PWM-OUT-0 1500
if that pin is for the frequency.

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

More
29 Jul 2025 00:18 - 29 Jul 2025 01:11 #332503 by oneKone
Replied by oneKone on topic Ethercat CATIO-A setup
Cheers Hakan. I'll have a read through and see what I can come up with.

Edit:
Looks like I need to convert to a U32 unit (for the duty cycle). Hopefully I can get something working within the next few days. 
Last edit: 29 Jul 2025 01:11 by oneKone. Reason: Added findings

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

More
29 Jul 2025 06:59 #332511 by Hakan
Replied by Hakan on topic Ethercat CATIO-A setup
Yes one often need some type conversion.
Maybe conv_float_u32? linuxcnc.org/docs/html/hal/components.html

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

More
30 Jul 2025 22:03 #332574 by oneKone
Replied by oneKone on topic Ethercat CATIO-A setup
again, cheers once again for pointing me in the right direction.

unfortunately i'm still far to green to get a working hal snippet for pwm control, but chatGPT isn't... after a bit of back and forward this was the result:

setp lcec.0.0.PWM-OUT-0 98304000 #sets frequency to 1.5khz

loadrt scale count=1
loadrt conv_float_u32 count=1

addf scale.0 servo-thread
addf conv-float-u32.0 servo-thread

setp scale.0.gain 3.5

net gui-rpm spindle.0.speed-out => scale.0.in
net scaled-rpm scale.0.out => conv-float-u32.0.in
net rpm-u32 conv-float-u32.0.out => lcec.0.0.DUTY-OUT-0


i now have a working PWM out!

i did try outputting to analog out but there seems to be some problem with it, for example 20 000 rpm would output 3v, 10 000rpm would give 5v, 7500 rpm would output 2v. It's not the end of the world, but hopefully i can get it sussed at the very least for others that try this board.

once again,
cheers for the help to get a working PWM out!

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

Time to create page: 0.080 seconds
Powered by Kunena Forum