Make it more clear that stepper_load_next() has three separate code
paths - one for each of the optimized stepper_event_X() functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
In practice the host will not schedule any steps immediately after a
direction change (due to acceleration limits and the host
"step+dir+step filter"). However, there is also no harm in enforcing
a minimum duration in the mcu.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 8faed8d9 made it possible to utilize stepper_event_full() while
utilizing tmc "step on both edges" optimation. That commit would
ensure a minimum step pulse duration, but it did not ensure a minimum
duration between step pin and dir pin changes. Commits 0d27195f and
554ae78d optimized the gpio handling on stm32h7 chips, which could
potentially cause a very small amount of time between step pin and dir
pin changes.
Enforce a minimum time after a step pin update before updating the dir
pin.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move up the freeing of the stepper_move struct and setting of
s->position in stepper_load_next(). This simplifies the code and
will make it easier to add more logic to this function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Increase the internal nominal clock from 8Mhz to 12Mhz - this improves
support for higher chip frequencies.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The rp2040 operates at a fast internal clock with a relatively slow
external timer and dividing down could result in a too small delay.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There is no reason to use a higher internal PLL frequency. This
change also makes it possible to enable higher clock frequencies on
the stm32h723.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the helper functions to enable the peripheral clock instead of
directly manipulating the clock enable bits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add optimized gpio functions for stm32h7 - caching the ODR register
can notably improve the performance of the gpio_out_toggle() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
gpio reset calls are heavy.
gpio state are persistent between calls.
Drop useless calls.
Avoid calls if SDA does not changed.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
On fast MCU software spi may violate maximally supported by TMC driver rate.
Add dynamic limits to overcome that.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This reverts commit 8087200ffe2fbbe62265dd480ce8be67db8349eb.
The change can break the build on some versions of gcc.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support setting individual options instead of one global option (
WANT_BUTTONS, WANT_TMCUART, WANT_NEOPIXEL, WANT_PULSE_COUNTER,
WANT_HX71X).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This option seems to be confusing ld's region usage checks (builds
that could fit in small chips are being reported as not fitting). The
option was disabled back in commit 4e8674d5 because it showed worse
results. However, recent versions of gcc seem to produce the same
results even if this option is enabled, so change the build to avoid
disabling that option on newer versions of gcc (those that have the
-ffat-lto-objects option - which is needed to ensure
compile_time_requests sections can be extracted with objcopy).
The PRU build is dependent on -fuse-linker-plugin, so enable that
option explicitly in its build.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The i2c_delay() function did not properly handle counter rollovers.
It also performed an expensive run-time divide.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
It seems both ERRIE and LECIE must be enabled to get hardware error
interrupts. Without this, the rx_error and tx_error reports are
likely to always be zero.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>