HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0::PowerStageParameters Struct Reference

Power stage parameters structure. More...

#include <tmc51x0_types.hpp>

Public Member Functions

 PowerStageParameters ()=default
 Default constructor.
 

Public Attributes

float mosfet_miller_charge_nc {10.0F}
 MOSFET Miller charge in nanocoulombs (used to calculate DRVSTRENGTH)
 
uint32_t bbm_time_ns {100}
 Break Before Make time in nanoseconds.
 
SenseFilterTime sense_filter {SenseFilterTime::T100ns}
 Sense amplifier filter time constant.
 
OverTempProtection over_temp_protection {OverTempProtection::Temp150C}
 Over-temperature protection level for bridge disable.
 
uint16_t s2vs_voltage_mv {0}
 Short to VS detector voltage threshold in millivolts.
 
uint16_t s2g_voltage_mv {0}
 Short to GND detector voltage threshold in millivolts.
 
uint8_t shortfilter {1}
 Spike filtering bandwidth for short detection (0-3)
 
uint8_t short_detection_delay_us_x10 {0}
 Short detection delay in microseconds (0.1µs resolution)
 

Detailed Description

Power stage parameters structure.

Configuration parameters for the power stage of the TMC51x0 driver. Uses user-friendly physical parameters that are automatically converted to register values during initialization.

Constructor & Destructor Documentation

◆ PowerStageParameters()

tmc51x0::PowerStageParameters::PowerStageParameters ( )
default

Default constructor.

Initializes with recommended default values:

  • MOSFET Miller charge: 10nC (typical for small MOSFETs)
  • BBM time: 100ns (typical minimum)
  • Sense filter: 100ns (reset default)
  • Over-temperature protection: Temp150C (150°C)
  • Short protection: s2vs_voltage_mv=0 (auto=625mV), s2g_voltage_mv=0 (auto=625mV), shortfilter=1, short_detection_delay_us_x10=0 (auto=0.85µs)
Note
Short detection retries 3 times before switching off motor continuously (ESD protection).
Once short detected, corresponding bridge (A or B) switches off and flag is set.
To restart after short: disable and re-enable driver.
Short protection cannot protect against all possible short events - short circuits should be avoided by design.

Member Data Documentation

◆ bbm_time_ns

uint32_t tmc51x0::PowerStageParameters::bbm_time_ns {100}

Break Before Make time in nanoseconds.

0 = auto-calculate from MOSFET Miller charge (100ns for small MOSFETs, lowest setting). Minimum: 75-100ns (BBMTIME=0, shortest, reset default).

BBMTIME register (bits 4..0, range 0-24):

  • BBMTIME=0: 75-100ns (shortest, typical 100ns)
  • BBMTIME=16: 200ns
  • BBMTIME=24: 375-500ns (longest, typical 375ns)
  • Formula: time[ns] ≈ 100ns * 32 / (32 - BBMTIME)
  • Used for times <= 200ns

BBMCLKS register (bits 11..8, range 0-15):

  • Digital BBM time in clock cycles (typ. 83ns per cycle at 12MHz)
  • Used for times > 200ns
  • The longer setting rules (BBMTIME vs. BBMCLKS)

Datasheet hint: Choose the lowest setting safely covering the switching event. Add roughly 30% headroom to cover production stray of MOSFETs and driver.

Typical values:

  • Fast MOSFETs: 100ns (lowest, BBMTIME=0)
  • Medium MOSFETs: 200ns (BBMTIME=16)
  • Large MOSFETs: 200-400ns (BBMCLKS)
Note
Constrained to valid range: >= 0

◆ mosfet_miller_charge_nc

float tmc51x0::PowerStageParameters::mosfet_miller_charge_nc {10.0F}

MOSFET Miller charge in nanocoulombs (used to calculate DRVSTRENGTH)

0 = auto-calculate from default (10nC for small MOSFETs). Based on datasheet table 3.3:

  • <10nC: DRVSTRENGTH = 0
  • 10-20nC: DRVSTRENGTH = 0 or 1
  • 20-40nC: DRVSTRENGTH = 1 or 2
  • 40-60nC: DRVSTRENGTH = 2 or 3
  • >60nC: DRVSTRENGTH = 3

Typical values:

  • Small MOSFETs (e.g., BSC072N08NS5): ~6nC
  • Medium MOSFETs: ~30nC
  • Large MOSFETs: ~50nC+
Note
Constrained to valid range: >= 0.0f

◆ over_temp_protection

OverTempProtection tmc51x0::PowerStageParameters::over_temp_protection {OverTempProtection::Temp150C}

Over-temperature protection level for bridge disable.

0 = 150°C (default) 1 = 143°C 2 = 136°C 3 = 120°C

◆ s2g_voltage_mv

uint16_t tmc51x0::PowerStageParameters::s2g_voltage_mv {0}

Short to GND detector voltage threshold in millivolts.

0 = auto-calculate to recommended default (625mV for VS<50V, equivalent to S2G_LEVEL=6). Detects voltage drop on high-side MOSFET (VS - VBM).

Datasheet voltage thresholds (typical values, depends on supply voltage):

  • S2G_LEVEL=6 (VS<50V): 460-625-800mV (recommended for normal operation)
  • S2G_LEVEL=15 (VS<52V): 1200-1560-1900mV
  • S2G_LEVEL=15 (VS<55V): 850mV (minimum for VS>52V to prevent false triggers)

Recommended: 460-800mV for normal operation (VS<50V). Minimum 1200mV if bridge supply voltage can exceed 52V (prevents false triggers at 55V).

Note
CHOPCONF.diss2g can disable this protection (handled in ChopperConfig).
Constrained to valid range: 0 (auto) or 400-2000mV
Register value (S2G_LEVEL) is automatically calculated from voltage threshold

◆ s2vs_voltage_mv

uint16_t tmc51x0::PowerStageParameters::s2vs_voltage_mv {0}

Short to VS detector voltage threshold in millivolts.

0 = auto-calculate to recommended default (625mV, equivalent to S2VS_LEVEL=6). Detects voltage drop in LS MOSFET and sense resistor (VBM).

Datasheet voltage thresholds (typical values):

  • S2VS_LEVEL=6: 550-625-700mV (recommended for normal operation)
  • S2VS_LEVEL=15: 1400-1560-1720mV (lowest sensitivity)

Can be set sensitively to detect overcurrent (150-200% of nominal peak current). Recommended: 550-700mV for normal operation, down to 400mV at low current scale.

Note
CHOPCONF.diss2vs can disable this protection (handled in ChopperConfig).
Constrained to valid range: 0 (auto) or 400-2000mV
Register value (S2VS_LEVEL) is automatically calculated from voltage threshold

◆ sense_filter

SenseFilterTime tmc51x0::PowerStageParameters::sense_filter {SenseFilterTime::T100ns}

Sense amplifier filter time constant.

0 = 100ns (default) 1 = 200ns 2 = 300ns 3 = 400ns

◆ short_detection_delay_us_x10

uint8_t tmc51x0::PowerStageParameters::short_detection_delay_us_x10 {0}

Short detection delay in microseconds (0.1µs resolution)

0 = auto-calculate to recommended default (0.85µs, equivalent to shortdelay=0). Total detection delay including 100ns filtering time. Should cover bridge switching time.

Datasheet timing (typical values):

  • shortdelay=0: 0.5-0.85-1.1µs (normal, recommended for most applications)
  • shortdelay=1: 1.1-1.6-2.2µs (high delay)

Recommended: 5-11 (0.5-1.1µs) for most applications. Stored as 0.1µs units (e.g., 8 = 0.8µs, 16 = 1.6µs).

Note
Constrained to valid range: 0 (auto) or 5-25 (0.5-2.5µs)
Register value (shortdelay bit) is automatically calculated from delay time

◆ shortfilter

uint8_t tmc51x0::PowerStageParameters::shortfilter {1}

Spike filtering bandwidth for short detection (0-3)

0 = lowest (100ns), 1 = 1µs (reset default), 2 = 2µs, 3 = 3µs. Good PCB layout allows setting 0, increase if erroneous detection occurs. Helps prevent spurious triggering from PCB layout or long motor cables.

Note
Constrained to valid range: 0-3

The documentation for this struct was generated from the following file: