usbcnc/grbl

step_pulse_time should be uint16_t instead of uint8_t

mstrens opened this issue · 1 comments

In file stepper.c, there is:
#ifndef WIN32
uint8_t step_pulse_time; // Step pulse reset time after step rise

For STM32, step_pulse_time is then filled with
#elif defined(STM32F103C8)
st.step_pulse_time = (settings.pulse_microseconds)*TICKS_PER_MICROSECOND;

As TICKS_PER_MICROSECOND = 72, it is not possible to assign more than 3 usec to the parameter pulse_microseconds because (settings.pulse_microseconds)*TICKS_PER_MICROSECOND would exceed 255.
To solve this, we should define step_pulse_time as uint16_t or we should apply a prescaler for the timer (for stm32F103).

Is not all operations do in 32-bit format? Wait for the hardware abstraction layer HAL runs 8bit in and out? or am I thinking about a different feature like the resolution of timers? grbl has a was to go in optimizations before it really makes much use of stm32 platforms tools like programmable clocks and direct memory access.