Is there a way to change the step pulse width?

If you have a question about the software please ask it here.

Is there a way to change the step pulse width?

Postby A_Camera » Wed Aug 04, 2021 6:01 pm

I have a problem. I am trying to use UCCNC with a servo motor but it seems like the pulse width is too short if I have a kernel frequency of 200kHz, which I have happily used with my steppers for many years now. The servo requires a minimum of 2.5µs and that can only be done if the kernel frequency is set to 100kHz. I measured the pulses and it seems that 400kHz = 1.2µs, 200kHz = 2.5µs and 100kHz is 5µs. I suspect my oscilloscope did not measure with the best accuracy, so at 200kHz it can be (probably is) slightly less than 2.5µs which is why the servo is not turning at all in that case. Setting to 100kHz solves this, but I'd like to use 200kHz just like before.

Can this be solved somehow? Or is the only solution if I make a pulse stretcher circuit which extends the pulses to meet the minimum requirements of the servo? I know in Mach3 the pulse width can be set in the configuration, so why can't we do that in UCCNC?
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: Is there a way to change the step pulse width?

Postby hmnijp » Thu Aug 05, 2021 4:04 pm

Yes, I also ran into this problem when using Chinese servo stepper motors. Their declared 200 kHz (2.5 μs) is not correct, this is the threshold value. In reality, it is smaller. When using AXBB, it turned out possible only with a frequency of 100 kHz. I have not tested, but it is possible that the AXBB pulse width is actually slightly smaller too (given the imperfect rising and falling edge of the signal). It would be nice to have 150 kHz or 180 kHz options for this case.
hmnijp
 
Posts: 44
Joined: Sun Jan 17, 2021 12:59 am

Re: Is there a way to change the step pulse width?

Postby cncdrive » Sat Aug 07, 2021 2:37 am

Yes, that is correct.
With 200kHz kernel frequency the pulses are 2.5usec long, so the high and low side of the signal at 200kHz is 5usec.
1/5usec is 200kHz.

It is not possible to make pulses longer, because at 200kHz there is simply no more time than 5usec for the pulse high and low side to happen.
If the pulse would be longer then it is simply not possible to do 200kHz only less frequency.
So, what you asking for is simply not possible.

In Mach3 it was possible to change the pulse length with it's LPT port driver, because Mach3 used short pulses 5usec if I recall even with it's 25kHz kernel frequency. With 25kHz and even with 50kHz kernel frequency it is possible to make the pulses longer than 5usec.
So, why this was possible in mach3 is only for this reason. If MAch3 was using 200kHz kernel frequency then it would be also not possible to make the pulses longer than that...
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Is there a way to change the step pulse width?

Postby A_Camera » Sat Aug 07, 2021 4:23 pm

Yes,I know 5µs = 200kHz, but 3 + 2 = 5, as well as 2.5 + 2.5. Besides, the 200kHz is only a limiting factor when the axis is running at 200kHz. Anyway, my interpretation of your answer is: "No, it's not possible to do anything about it because it's easier this way."

Oh, well, fixing it on my side is fairly simple, only needs a HC14, a resistor, a capacitor and a diode.

https://adapting-camera.blogspot.com/2016/12/the-making-of-pulse-stretcher.html

Image

Of course, the above with the 800µs timing is not suitable, the capacitor and resistor must be changed, but it is simple to do it.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am

Re: Is there a way to change the step pulse width?

Postby cncdrive » Sat Aug 07, 2021 7:04 pm

Your perception is not correct, but your idea is correct that 3+2 is also 5 just like 2.5 + 2.5, but the problem with 3 + 2 is that it would very likely make things worst, because if the limitation in the drive is the speed of the optocoupler then further shortening the inactive state of the signal would even lower the max. frequency the drive can properly read.
However I see one possible scenario when what you saying could be useful, if forexample the drive can read max. 150kHz and so the 200kHz kernel frequency would not work with the 2.5usec active and 2.5usec inactive states of the signal, but with for example with 3 + 2 usec the active edge would be 3 usec always, but the inactive edge would be only 2 usec when the 200kHz is reached and if on the software side the max. velocity is limited to not make more than 150kHz with using a properly low velocity value to limit the freq. under 150kHz then the max. frequency which the drive could handle might become higher.
However this is a special case, because usually drives can handle max. 100kHz or if they can handle higher frequency then they can handle 200kHz.
It is very unlikely that a drive can handle 150kHz (between 100 and 200kHz kernel freq.) or 300kHz (between 200 and 400kHz kernel freq.)
So, I think that implementing this pulse varying as a feature would probably not help many people.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Is there a way to change the step pulse width?

Postby A_Camera » Sun Aug 08, 2021 10:33 am

I think there is nothing wrong with my perception, but you took my words literally. ;) The 3 + 2 is only a problem at maximum frequency. My main point was that even if the kernel frequency is set to 200kHz, I think very few people ever use that on all axes, so by allowing setting the pulse width, of course, in reality it would mean changing the maximum frequency, but even if the pulse width would be 3 + 3 = 6µs the resulting 167kHz would still be very high on that axis, while if you would keep 200kHz kernel frequency you could still have the possibility to run the other axes at that speed, but of course, only if the 2.5µs pulse width is kept for those.

Anyway, no big deal, easily fixed by the circuit I presented. Of course, pulse width must be adjusted so that the minimum low is never violated, otherwise it will result in missing steps or serious crash.
A_Camera
 
Posts: 639
Joined: Tue Sep 20, 2016 11:37 am


Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 46 guests