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

StallGuard2 subsystem (COOLCONF/DRV_STATUS + SW_MODE interactions) More...

#include <tmc51x0.hpp>

Collaboration diagram for tmc51x0::TMC51x0< CommType >::StallGuard:
[legend]

Public Member Functions

 StallGuard (TMC51x0 &driver) noexcept
 
Result< uint16_t > GetStallGuard () noexcept
 Read StallGuard2 value (SG_RESULT)
 
Result< uint16_t > GetStallGuardResult () noexcept
 Read StallGuard2 result from DRV_STATUS (SG_RESULT)
 
Result< void > ConfigureStallGuard (const StallGuardConfig &config) noexcept
 Configure StallGuard2 parameters (COOLCONF)
 
Result< void > EnableStopOnStall (bool enable) noexcept
 Enable/disable stop-on-stall behavior.
 
Result< bool > IsStopOnStallEnabled () noexcept
 Check whether stop-on-stall is enabled.
 
Result< void > SetSoftStop (bool enable) noexcept
 Enable/disable soft-stop behavior (instead of hard stop)
 
Result< bool > IsSoftStopEnabled () noexcept
 Check whether soft-stop is enabled.
 
Result< void > ClearStallFlag () noexcept
 Clear stall event flag (RAMP_STAT)
 
Result< bool > IsStallDetected () noexcept
 Check if stall has been detected (RAMP_STAT)
 

Private Attributes

TMC51x0driver_
 Set StallGuard/CoolStep threshold velocity (TCOOLTHRS, unit-aware)
 

Detailed Description

template<typename CommType>
struct tmc51x0::TMC51x0< CommType >::StallGuard

StallGuard2 subsystem (COOLCONF/DRV_STATUS + SW_MODE interactions)

Owns StallGuard configuration and control signals that affect motion behavior (stop-on-stall, soft-stop), keeping diagnostics focused on monitoring.

Constructor & Destructor Documentation

◆ StallGuard()

template<typename CommType >
tmc51x0::TMC51x0< CommType >::StallGuard::StallGuard ( TMC51x0 & driver)
inlineexplicitnoexcept

Member Function Documentation

◆ ClearStallFlag()

template<typename CommType >
Result< void > tmc51x0::TMC51x0< CommType >::StallGuard::ClearStallFlag ( )
noexcept

Clear stall event flag (RAMP_STAT)

Returns
Result<void> indicating success or error

◆ ConfigureStallGuard()

template<typename CommType >
Result< void > tmc51x0::TMC51x0< CommType >::StallGuard::ConfigureStallGuard ( const StallGuardConfig & config)
noexcept

Configure StallGuard2 parameters (COOLCONF)

Parameters
configStallGuard configuration
Returns
Result<void> indicating success or error

◆ EnableStopOnStall()

template<typename CommType >
Result< void > tmc51x0::TMC51x0< CommType >::StallGuard::EnableStopOnStall ( bool enable)
noexcept

Enable/disable stop-on-stall behavior.

Parameters
enableTrue to enable stop on stall
Returns
Result<void> indicating success or error
Warning
Datasheet (SW_MODE): do not combine stop-on-stall (sg_stop) with soft-stop (en_softstop). This API returns INVALID_STATE if enabling sg_stop while soft-stop is enabled.

◆ GetStallGuard()

template<typename CommType >
Result< uint16_t > tmc51x0::TMC51x0< CommType >::StallGuard::GetStallGuard ( )
noexcept

Read StallGuard2 value (SG_RESULT)

Returns
Result<uint16_t> containing the value or error

◆ GetStallGuardResult()

template<typename CommType >
Result< uint16_t > tmc51x0::TMC51x0< CommType >::StallGuard::GetStallGuardResult ( )
noexcept

Read StallGuard2 result from DRV_STATUS (SG_RESULT)

Returns
Result<uint16_t> containing the value or error

◆ IsSoftStopEnabled()

template<typename CommType >
Result< bool > tmc51x0::TMC51x0< CommType >::StallGuard::IsSoftStopEnabled ( )
noexcept

Check whether soft-stop is enabled.

Returns
Result<bool> containing true if enabled, false otherwise

◆ IsStallDetected()

template<typename CommType >
Result< bool > tmc51x0::TMC51x0< CommType >::StallGuard::IsStallDetected ( )
noexcept

Check if stall has been detected (RAMP_STAT)

Returns
Result<bool> containing true if stall event is set

◆ IsStopOnStallEnabled()

template<typename CommType >
Result< bool > tmc51x0::TMC51x0< CommType >::StallGuard::IsStopOnStallEnabled ( )
noexcept

Check whether stop-on-stall is enabled.

Returns
Result<bool> containing true if enabled, false otherwise

◆ SetSoftStop()

template<typename CommType >
Result< void > tmc51x0::TMC51x0< CommType >::StallGuard::SetSoftStop ( bool enable)
noexcept

Enable/disable soft-stop behavior (instead of hard stop)

Parameters
enableTrue to enable soft stop
Returns
Result<void> indicating success or error
Warning
Datasheet (SW_MODE): do not combine soft-stop (en_softstop) with stop-on-stall (sg_stop). This API returns INVALID_STATE if enabling soft-stop while sg_stop is enabled.

Member Data Documentation

◆ driver_

template<typename CommType >
TMC51x0& tmc51x0::TMC51x0< CommType >::StallGuard::driver_
private

Set StallGuard/CoolStep threshold velocity (TCOOLTHRS, unit-aware)

Parameters
thresholdThreshold velocity
unitUnit of threshold
Returns
Result<void> indicating success or error

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