SpindleOnCWJogDir.c not working :'(
Moderators: TomKerekes, dynomotion
Re: SpindleOnCWJogDir.c not working :'(
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
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
Re: SpindleOnCWJogDir.c not working :'(
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
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
- TomKerekes
- Posts: 2741
- Joined: Mon Dec 04, 2017 1:49 am
Re: SpindleOnCWJogDir.c not working :'(
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,
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.
Tom Kerekes
Dynomotion, Inc.
Re: SpindleOnCWJogDir.c not working :'(
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
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
- TomKerekes
- Posts: 2741
- Joined: Mon Dec 04, 2017 1:49 am
Re: SpindleOnCWJogDir.c not working :'(
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.Which spec do you mean Tom? (not really sure, they also suggest : 5V Recommended pull-up resistor: above 100–220, 1/2W)
I was thinking termination (pull down resistor)Do you mean a pull-up resistor per phase very close to the Kflop?
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.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?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: SpindleOnCWJogDir.c not working :'(
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
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
- TomKerekes
- Posts: 2741
- Joined: Mon Dec 04, 2017 1:49 am
Re: SpindleOnCWJogDir.c not working :'(
Hi Francois,
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.I was thinking to send the encoder signal to the VFD via JP5, is it possible?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: SpindleOnCWJogDir.c not working :'(
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
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
- TomKerekes
- Posts: 2741
- Joined: Mon Dec 04, 2017 1:49 am
Re: SpindleOnCWJogDir.c not working :'(
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
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.
Tom Kerekes
Dynomotion, Inc.
Re: SpindleOnCWJogDir.c not working :'(
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
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