Module util

Module util 

Source
Expand description

Utility functions for TMC2209 calculations.

This module provides helper functions for common calculations like RMS current, velocity conversions, etc.

Constants§

DEFAULT_FCLK
Default TMC2209 internal clock frequency (12 MHz).
DEFAULT_RSENSE
Default sense resistor value in ohms (common value).
VREF
Internal voltage reference for current sensing (in volts).

Functions§

calculate_current_settings
Calculate CS and VSENSE for a target RMS current.
cs_to_current
Calculate the RMS current for a given CS value.
current_to_cs
Calculate the CS (current scale) value for a given RMS current.
optimal_vsense
Determine optimal VSENSE setting for a given RMS current.
tstep_to_velocity
Convert TSTEP register value to velocity in steps/second.
velocity_to_tpwmthrs
Calculate TPWMTHRS for a given velocity threshold.
velocity_to_vactual
Convert velocity in steps/second to VACTUAL register value.