Beginner: KFLOP only wiring

Moderators: TomKerekes, dynomotion

MarcioMadruga
Posts: 9
Joined: Tue Mar 17, 2020 2:44 pm

Beginner: KFLOP only wiring

Post by MarcioMadruga » Tue Mar 17, 2020 3:23 pm

Hi, I’m starting this thread because it is kind of rare to see people working with a KFLOP only setup. No other boards.
The manual indicates KFLOP JP7 as GPIO, I wired my 3 stepdir drivers to IO8 and 9 (X), IO10 and 11 (Y) and IO pins 12 and 13 for the Z axis, as directed. To this point, everything works fine.
The problem: Limit switches and encoder inputs (which I also need to connect) share the same IO pins. Where can I configure/route/define connector pins for each input? I searched KMotion config screens, C files and even Kmotiondef.h, to no avail.

JP7 has 16 5v IO pins, 6 for my 3 axis stepdir, 6 for my home and limit switches, and 4 for my (X and Y only) encoders (AB).
I just need to know where to go for pin assignment, or if I should be using pins from the other connectors. Is there a default,
Standard wiring for “3 axis 3 encoder, home and limit switches + Pwm output for VFD (spindle driver)”?

Thank you very much

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Beginner: KFLOP only wiring

Post by TomKerekes » Tue Mar 17, 2020 6:23 pm

Hi Marcio,
The problem: Limit switches and encoder inputs (which I also need to connect) share the same IO pins. Where can I configure/route/define connector pins for each input? I searched KMotion config screens, C files and even Kmotiondef.h, to no avail.
The labels for Home and Limits are only suggestions. Those are handled in software so any Input can be used for them.

Step/Dir Outputs, Encoder Inputs, and PWM Outputs are hardware devices and have dedicated pins with some options to be multiplexed to alternate connectors.


JP7 has 16 5v IO pins, 6 for my 3 axis stepdir, 6 for my home and limit switches, and 4 for my (X and Y only) encoders (AB).
I just need to know where to go for pin assignment, or if I should be using pins from the other connectors. Is there a default,
Standard wiring for “3 axis 3 encoder, home and limit switches + Pwm output for VFD (spindle driver)”?
You might use the standard IO for your Step/Dir outputs and Encoder Inputs on JP7. Then assign any unused IO for your Home and Limits. They can be configured as described here.

PWM outputs are on KFLOP JP6 by default. See here. PWM0 can be switched to IO44 on JP7 if that is more convienient for you with this code:

Code: Select all

	FPGA(KAN_TRIG_REG)=4;  	// Mux PWM0 to JP7 Pin5 IO 44  
If you create a wiring diagram we can check it for you.
Regards,

Tom Kerekes
Dynomotion, Inc.

MarcioMadruga
Posts: 9
Joined: Tue Mar 17, 2020 2:44 pm

Re: Beginner: KFLOP only wiring

Post by MarcioMadruga » Wed Mar 18, 2020 4:38 am

Thank you very much.

I will reroute my breakout board, and will take advantage of the PWM0 mux to JP7. Very neat feature.
For some reason, I assumed all pin labels were mere suggestions. I’ll let you know the results. Thanks again.

Best Regards

Marcio

MarcioMadruga
Posts: 9
Joined: Tue Mar 17, 2020 2:44 pm

Re: Beginner: KFLOP only wiring

Post by MarcioMadruga » Mon Mar 30, 2020 5:19 am

Hi Tom,

Regarding Spindle control: I set KFLOP to output PWM to IO44 as you directed. I use this signal to drive a converter, which drives the 0-10V input on
my VFD -> spindle. It works manually. I have to recompile and run the init program to change the speed and direction (I had two IO bits from JP6 connected to digital inputs in the VFD to enable and set direction).

Would it be possible to configure IO bits to perform this controls, as described in "KMotionCNC Spindle Control"? I found rich documentation there,
but I don't have the Kanalog board to use DAC output for speed control. Is it possible to configure "Two IO Bits" in the Tool Setup Screen for M3, 4 and 5,
and route the speed value to the S parameter?

Thank you

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Beginner: KFLOP only wiring

Post by TomKerekes » Mon Mar 30, 2020 3:54 pm

Hi Marcio,

Yes you should be able to use a similar configuration as used with KStep Spindle Control. See the Spindle_S_Kstep.c, Spindle_Off_KStep.c, Spindle_CW_Kstep.c, Spindle_CCW_KStep.c examples in the \C Programs\KStep\KMotionCNC directory. Configure them in the KMotionCNC Tool Setup for the S, M5, M3, M4 Actions respectively. Use any unused Thread and Var=1

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

MarcioMadruga
Posts: 9
Joined: Tue Mar 17, 2020 2:44 pm

Re: Beginner: KFLOP only wiring

Post by MarcioMadruga » Mon Apr 27, 2020 6:37 am

Hi Tom,

I appreciate all the help. I managed to get my 3-axis stepdir router running. Now some minor issues:

1) I had to turn off the limit switch options (in the Config&Flash screen and C program) because my movement was being stopped erratically,
as if my switches were being pressed (mechanical normally closed switches connected to bits 17-22 for the three axis). Is it normal?

2) I have incremental rotary encoders connected to axis 0 and 1. Axis 0 = input chan 0 output chan 8, Axis 1 = input chan 1 output chan 9.
Is there any way to monitor the signal from the encoders? I'm trying the step response screen, but there is no position reading from the
encoders. I need to get past this to configure PID and operate in real closed loop mode.

Thank you

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Beginner: KFLOP only wiring

Post by TomKerekes » Mon Apr 27, 2020 5:32 pm

Hi Marcio,
1) I had to turn off the limit switch options (in the Config&Flash screen and C program) because my movement was being stopped erratically,
as if my switches were being pressed (mechanical normally closed switches connected to bits 17-22 for the three axis). Is it normal?
Most systems use 24V opto isolated inputs such as provided by our Konnect Board. If you are running 3.3V signals directly to limit switches it would be likely to pick up noise. Sometimes adding a capacitor (0.1uF Ceramic) from the KFLOP input pin to GND may kill the noise. It must be added close to KFLOP

2) I have incremental rotary encoders connected to axis 0 and 1. Axis 0 = input chan 0 output chan 8, Axis 1 = input chan 1 output chan 9.
Is there any way to monitor the signal from the encoders? I'm trying the step response screen, but there is no position reading from the
encoders.
Are the encoders wired up to KFLOP encoder input #0 (JP7 Pins 7 and 8) and #1 (JP7 Pins 9 and 10)? Do inputs 0, 1, 2, 3 toggle on the Digital IO Screen when the encoder moves? Do you have the Axes configured for Input Mode Encoder? The Step Response Screen can plot the Encoder Position or you can observe the current Encoder Position on the Axis Screen.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

MarcioMadruga
Posts: 9
Joined: Tue Mar 17, 2020 2:44 pm

Re: Beginner: KFLOP only wiring

Post by MarcioMadruga » Thu May 14, 2020 4:40 pm

Hi Tom,

I'm in a struggle here. In the Step Response Screen, when I click the "Move" button with proper motor configurations, the plot shows a
blue curve (command) and a similar red curve (movement) which is read from the encoder. When I try extreme speed settings, the machine fails with a
high pitched wail, and the plot shows the perfect blue command curve, but a mangled red curve, indicating the real movement done. So:

1) Is it necessary to align command and movement curves perfectly? The two curves are very similar, but a little offset in the plot.

2) The green curve (error) always appears as a flat line. I understand it should be representing the difference between command and movement,
to feed error to the feedback loop. I am starting with PID values 1, 0.01 and 0.1. What should I adjust to get PID working?

3) Once the machine is operating in real closed loop mode, the error correction is always active? (will the error correction adjust movement when
I jog the router with the kmotionCNC buttons manually, or error correction will only apply to GCode execution?)

Thank you very much

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Beginner: KFLOP only wiring

Post by TomKerekes » Thu May 14, 2020 5:13 pm

Hi Marcio,
When I click the "Move" button with proper motor configurations, the plot shows a
blue curve (command) and a similar red curve (movement) which is read from the encoder. When I try extreme speed settings, the machine fails with a high pitched wail, and the plot shows the perfect blue command curve, but a mangled red curve, indicating the real movement done.
That is likely a stepper motor "stall". If you exceed the motor's velocity or acceleration limits the motor will stall and just squeal or vibrate with basically no torque. Sort of like when a gear strips. The speed needs to slow down for it to re-engage. Max Following error can be used to detect this, disable the axis, and stop. Stepper motors will typically stall at around 500-1000RPM (27000 - 53000 steps/sec)

What speed are you running? What kind of hardware do you have? You might try low acceleration to see whether the cause is acceleration, velocity, or both. Post all your settings and and a plot.

1) Is it necessary to align command and movement curves perfectly? The two curves are very similar, but a little offset in the plot.
Not sure what you mean by "offset". At the beginning? End? While moving? Please post a plot.

2) The green curve (error) always appears as a flat line. I understand it should be representing the difference between command and movement,
to feed error to the feedback loop. I am starting with PID values 1, 0.01 and 0.1. What should I adjust to get PID working?
Actually the green output plot is the correction which is a function of the error but different from error.

Are you in CL Step mode? What are your filters set at? post all your settings? Usually with Closed Loop Steppers only I gain is used with a 2nd order low pass filter. You might read this.

3) Once the machine is operating in real closed loop mode, the error correction is always active? (will the error correction adjust movement when
I jog the router with the kmotionCNC buttons manually, or error correction will only apply to GCode execution?)
Yes it is always active whenever the axis is enabled.
Regards,

Tom Kerekes
Dynomotion, Inc.

MarcioMadruga
Posts: 9
Joined: Tue Mar 17, 2020 2:44 pm

Re: Beginner: KFLOP only wiring

Post by MarcioMadruga » Fri May 15, 2020 4:06 am

Hi Tom,

This is the situation I talked about: I press "move" with proper speed and acceleration values. The machine moves ok and this plot is shown.
Should the movement (red line from the encoder) be exactly coincident with the blue command line? If so, which parameters should I adjust?
Image 1 - proper settings.jpg
When I force a stall with a speed set too high, I can observe the position fails to follow the command, the red line seems to reflect the failed movement:
PID values are 1,0 and 0, but results don't seem to change when I set non-zero values for Integral and derivative.
Image 2 - Stalled motor.jpg
To this point, I understand my encoders are working, but I am missing something, because the output green line is always flat.
Am I correct? should the green line (output) reflect the adjustment to be made to the movement? Here is my filters screen:
Image 3 - Filters Screen.jpg
Machine: 3 axis nema 32 (200 steps/turn) with rotary encoders (400ppr)
Image 4 - Axis motor encoder.jpg
Thanks again

Post Reply