SpindleOnCWJogDir.c not working :'(

Moderators: TomKerekes, dynomotion

cemoa9
Posts: 82
Joined: Mon Jun 01, 2020 11:01 am

Re: SpindleOnCWJogDir.c not working :'(

Post by cemoa9 » Thu Apr 22, 2021 12:12 pm

Hello Tom,

So I had a look at the pulses in KMotionCNC, it was constantly moving even with spindle stopped, kept investigating, as soon as I plug in the JP5 it starts counting, I guess from noise issue, movie available here :

https://drive.google.com/file/d/1jYrcrF ... sp=sharing

And the way the encoder is connected attached, A B Z going in parallel to the feedback card and to JP5.

Any suggestion?

Cordially

Francois
Attachments
Capture.PNG

cemoa9
Posts: 82
Joined: Mon Jun 01, 2020 11:01 am

Re: SpindleOnCWJogDir.c not working :'(

Post by cemoa9 » Thu Apr 22, 2021 1:47 pm

Hello again,

So I tried to change the channel of the encoder, moved it to ch2, no more oscillation of position, seems to work well.

But as I need 5 axis control step/dir I need to use at least one from JP5 and I am afraid it just does not work properly, during tool change process that could be very nasty... What do you think?

Cordially

Francois

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

Re: SpindleOnCWJogDir.c not working :'(

Post by TomKerekes » Thu Apr 22, 2021 4:26 pm

Hi Francois,

You should use differential signals in noisy environments. Consider adding a 3rd party differential Driver. This can also be used to create 2 single ended signals (the + and - signals) with higher drive than simply a 4.7K pull up.

It seems like your cable is unnecessarily long.

Paralleling the signal is not a good idea.

Its not clear if the cable is shielded or where the shield is grounded or to what. Normally its best to connect the shield to the DC GND of the Receiver (KFLOP) only.

The 4.7K pull up is very weak. What is the spec on the driver?

Termination resistance on the KFLOP end may help.

You might multiplex the Encoder Inputs from JP5 to JP6. See the MuxEncoders.c example. This will add 150ohm termination so the encoder must be able to drive this,
Regards,

Tom Kerekes
Dynomotion, Inc.

cemoa9
Posts: 82
Joined: Mon Jun 01, 2020 11:01 am

Re: SpindleOnCWJogDir.c not working :'(

Post by cemoa9 » Thu Apr 22, 2021 7:05 pm

Hello Tom,

Cable used for the video is not the one used normally, I just picked one new for the video, same effect happens with a very short cable (40cm) and VFD not powered.

Yeah, I guessed so for the paralleling, I may need to find a solution there.

Grounding was done on the COM of the 5V powersupply (which powers Kflop), I can change that.

Which spec do you mean Tom? (not really sure, they also suggest : 5V Recommended pull-up resistor: above 100–220, 1/2W)

Do you mean a pull-up resistor per phase very close to the Kflop?

By multiplexing the encoder, you mean having in parallel the A B signal to 2 encoders channel then the code would make one filtered out of them?


I need to make more tests on it, but using ch2 encoder is ok (not needed for something else). Big question is why it works very well (so far) on JP7 and very noisy of JP5?

Thanks a lot,

Francois

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

Re: SpindleOnCWJogDir.c not working :'(

Post by TomKerekes » Thu Apr 22, 2021 7:22 pm

Which spec do you mean Tom? (not really sure, they also suggest : 5V Recommended pull-up resistor: above 100–220, 1/2W)
How much current the encoder output can source/sink. If it it open collector then it can't source any current. Normally an output can actively source current so a 120 ohm to GND at the receiver end will reduce reflections and ringing. I suppose with a 120 ohm pull up resistor to +5V at the encoder end and a 120 ohm resistor to GND at the KFLOP end the high voltage will go to 2.5V which is sufficient for KFLOP.
Do you mean a pull-up resistor per phase very close to the Kflop?
I was thinking termination (pull down resistor)
By multiplexing the encoder, you mean having in parallel the A B signal to 2 encoders channel then the code would make one filtered out of them?
No. Multiplexing just switches the encoder inputs from one connector to the other. The advantage of JP6 might be a GND on that connector and also the built in 150 ohm termination.
Regards,

Tom Kerekes
Dynomotion, Inc.

cemoa9
Posts: 82
Joined: Mon Jun 01, 2020 11:01 am

Re: SpindleOnCWJogDir.c not working :'(

Post by cemoa9 » Fri Apr 23, 2021 9:52 am

Hello Tom,

No idea how much it can source, I could not find it in the specs.

Concerning noise issues, it worked on JP7 until VFD is powered and driving the motor.

So I followed your advice and grounding is done on JP7 GND, it improved significantly the noise reduction, but still not enough. I so changed the routing of the encoder cable and connected it directly to JP7, that works fine, but now VFD has no encoder feedback.
In order to keep the signal clear, I was thinking to send the encoder signal to the VFD via JP5, is it possible?

Cordially

Francois

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

Re: SpindleOnCWJogDir.c not working :'(

Post by TomKerekes » Fri Apr 23, 2021 2:30 pm

Hi Francois,
I was thinking to send the encoder signal to the VFD via JP5, is it possible?
Not really. There isn't a means of routing fast signals through KFLOP from one connector to another. I suppose you could measure the frequency coming in JP7 and command a Step/Dir to output Quadrature at approximately that frequency on JP5. But there may be a delay and you'd be making things unnecessarily complicated. I'd suggest what I mentioned earlier and add a differential driver to the encoder. A differential driver provides basically two single ended outputs. Run one to the VFD and the other to KFLOP. One being inverted wont matter.
Regards,

Tom Kerekes
Dynomotion, Inc.

cemoa9
Posts: 82
Joined: Mon Jun 01, 2020 11:01 am

Re: SpindleOnCWJogDir.c not working :'(

Post by cemoa9 » Thu May 06, 2021 7:22 pm

Hello Tom,

So after different trials of routing and shielding, result is still not good enough, I will apply all we discussed sor far :

1) encoder feedback going to VFD with A A/ B B/ Z Z/ then from the output to a differential driver as close as possible to the Kflop
2) shielding and grounding on the kflop
3) use the multiplexing to JP6, and here is the question, I had a look at the code, and could not figure out how it works (I feel quite dumb as there is only one line...)

// Mux encoder inputs from KFLOP JP7 & JP5 to JP4 and JP6
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;

Cordially

Francois

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

Re: SpindleOnCWJogDir.c not working :'(

Post by TomKerekes » Fri May 07, 2021 6:51 pm

Hi Francos,

That line writes a value to a 16bit FPGA register called ENC_NOISE_FILTER_ADD. This register contains 2 bits to control multiplexing of the encoder inputs and also a value to set how much digital filtering is applied to the encoder inputs to help remove glitches. When an encoder A or B input changes it must remain stable for a number of FPGA 16.67MHz clock cycles or it will be ignored. The default value is 7. If your encoders do not need to operate near 1 million counts per second then the filtering may be increased to a value bigger than the default (replace the symbol with a number). Max is 255. Since you're only using JP6 you don't need to multiplex the other encoders to JP4.


HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

cemoa9
Posts: 82
Joined: Mon Jun 01, 2020 11:01 am

Re: SpindleOnCWJogDir.c not working :'(

Post by cemoa9 » Fri May 07, 2021 8:56 pm

Hello Tom,

Thank you, so the first digit is the encoder channel and the second the noise filtering time, one point remaining, to which IOs of JP6 (orJP4) is it redirecting?

Cordially

Francois

Post Reply