usbcnc / grbl

This is a port of GRBL 1.1 to STM32F103 target
https://github.com/usbcnc/grbl/wiki
Other
207 stars 73 forks source link

step_pulse_time should be uint16_t instead of uint8_t #49

Open mstrens opened 6 years ago

mstrens commented 6 years ago

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).

fenderrex commented 4 years ago

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.