Forums » Software development »
Stepper impulse width mod SOS
Added by minczer over 10 years ago
Hi,
please help me!
I have a problem with the pulse width of stepping. I measured cca.2us, but the external controller like 5us.
Where can I mod in the source code?
Thanks
Replies (2)
RE: Stepper impulse width mod SOS - Added by jaap over 10 years ago
Hi,
The pulse is created in stepper.cpp, part of the grbl code. There are relevant two routines:
set_step_pins(); // line 309 clear_all_step_pins(); // line 466
The time between the calling of those two in st_interrupt() determines the pulse width.
The comment on line 406 reads: clear the pins, assume that we spend enough CPU cycles in the previous statements for the steppers to react (>1usec)
. So much for "pulse timing" :-(
I suppose you could solve it by adding
wait_us(3)
just before line 406 (although adding a wait statement in interrupts is generally considered a Bad Thing)
RE: Stepper impulse width mod SOS - Added by minczer over 10 years ago
hi,
It's really a bad thing, but working!
Thanks!
1us wait enough for the stepper driver!