Skip to content

Struct sstep_ctx

ClassList > sstep_ctx

Driver state behind the opaque sstep .More...

  • #include <sstep_internal.h>

Public Attributes

Type Name
struct sstep_gain adc_i
Current per ADC count [pu].
struct sstep_gain adc_v
Bus voltage per ADC count [pu].
uint16_t adv
Angle increments applied since the hand-off.
sstep_angle_t angle_offset
Electrical angle of position 0.
uint8_t angle_shift
14 - log2(microsteps).
struct sstep_config cfg
Copy of the configuration.
uint16_t compare
Last compare values.
struct sstep_setpoint cur
Setpoint in use.
sstep_integ_t emf
Filtered back-EMF, d and q axis [pu V].
struct sstep_gain emf_a
L / Ts + R / 2 [pu V / pu A].
struct sstep_gain emf_alpha
Ts / tau of the back-EMF filter.
struct sstep_gain emf_b
L / Ts - R / 2 [pu V / pu A].
int64_t emf_off
Mean back-EMF at rest, d and q [mV * 2^16].
volatile uint16_t faults
Active faults.
sstep_real_t ff_cmd
Back-EMF of vel_cmd [pu V].
struct sstep_gain ff_gain
Feed-forward per microstep/s [pu].
bool hold_active
Hold current applied.
uint32_t hold_ticks
Slow periods at standstill before hold.
sstep_real_t i_hold
Hold current [pu].
sstep_real_t i_meas
Last measured phase currents [pu].
sstep_real_t i_prev
Phase currents of the previous period [pu].
sstep_real_t i_run
Run current [pu].
uint16_t i_trip_counts
Overcurrent trip [ADC counts from zero].
sstep_integ_t integ
PI integrators [pu V].
struct sstep_gain inv_vbus
Last V_base / bus voltage.
struct sstep_gain kb
Anti-windup gain Ts / Tt.
struct sstep_gain ki
Integral gain per fast loop period.
struct sstep_gain kp
Proportional gain [pu V / pu A].
struct sstep_motion mo
Motion generator.
struct sstep_gain r_pu
Phase resistance [pu] (voltage drive).
uint16_t ratio
Fast loop periods per slow loop period.
uint32_t ready
SSTEP_READY after a successful sstep_init() .
struct sstep_setpoint sp
Setpoints; the fast loop owns sp[sp_active].
volatile uint8_t sp_active
Buffer in use by the fast loop.
volatile uint8_t sp_pending
1: sp[1 - sp_active] is complete and new.
uint32_t stall_count
Stall detector up/down counter.
int32_t stall_emf_mv
Back-EMF of stall_speed [mV].
uint32_t stall_hold
Slow periods the condition stays true after a reversal.
uint32_t stall_ticks
Slow periods of stall to trip; 0 = detection off.
enum sstep_state state
Driver state.
uint32_t still
Slow periods at standstill.
sstep_acc_t v_hist
Applied phase voltages computed 1 and 2 periods ago [pu V].
uint16_t vbus_max_raw
Overvoltage trip [ADC counts], 0 = off.
uint16_t vbus_min_raw
Undervoltage trip [ADC counts], 0 = off.
volatile uint16_t vbus_raw
Last bus voltage [ADC counts].
int32_t vel_cmd
Commanded velocity of the period in use [microsteps/s].

Detailed Description

Its layout may change in any release.

Public Attributes Documentation

variable adc_i

Current per ADC count [pu].

struct sstep_gain sstep_ctx::adc_i;


variable adc_v

Bus voltage per ADC count [pu].

struct sstep_gain sstep_ctx::adc_v;


variable adv

Angle increments applied since the hand-off.

uint16_t sstep_ctx::adv;


variable angle_offset

Electrical angle of position 0.

sstep_angle_t sstep_ctx::angle_offset;


variable angle_shift

14 - log2(microsteps).

uint8_t sstep_ctx::angle_shift;


variable cfg

Copy of the configuration.

struct sstep_config sstep_ctx::cfg;


variable compare

Last compare values.

uint16_t sstep_ctx::compare[SSTEP_LEGS_MAX];


variable cur

Setpoint in use.

struct sstep_setpoint sstep_ctx::cur;


variable emf

Filtered back-EMF, d and q axis [pu V].

sstep_integ_t sstep_ctx::emf[2];


variable emf_a

L / Ts + R / 2 [pu V / pu A].

struct sstep_gain sstep_ctx::emf_a;


variable emf_alpha

Ts / tau of the back-EMF filter.

struct sstep_gain sstep_ctx::emf_alpha;


variable emf_b

L / Ts - R / 2 [pu V / pu A].

struct sstep_gain sstep_ctx::emf_b;


variable emf_off

Mean back-EMF at rest, d and q [mV * 2^16].

int64_t sstep_ctx::emf_off[2];


variable faults

Active faults.

volatile uint16_t sstep_ctx::faults;


variable ff_cmd

Back-EMF of vel_cmd [pu V].

sstep_real_t sstep_ctx::ff_cmd;


variable ff_gain

Feed-forward per microstep/s [pu].

struct sstep_gain sstep_ctx::ff_gain;


variable hold_active

Hold current applied.

bool sstep_ctx::hold_active;


variable hold_ticks

Slow periods at standstill before hold.

uint32_t sstep_ctx::hold_ticks;


variable i_hold

Hold current [pu].

sstep_real_t sstep_ctx::i_hold;


variable i_meas

Last measured phase currents [pu].

sstep_real_t sstep_ctx::i_meas[2];


variable i_prev

Phase currents of the previous period [pu].

sstep_real_t sstep_ctx::i_prev[2];


variable i_run

Run current [pu].

sstep_real_t sstep_ctx::i_run;


variable i_trip_counts

Overcurrent trip [ADC counts from zero].

uint16_t sstep_ctx::i_trip_counts;


variable integ

PI integrators [pu V].

sstep_integ_t sstep_ctx::integ[2];


variable inv_vbus

Last V_base / bus voltage.

struct sstep_gain sstep_ctx::inv_vbus;


variable kb

Anti-windup gain Ts / Tt.

struct sstep_gain sstep_ctx::kb;


variable ki

Integral gain per fast loop period.

struct sstep_gain sstep_ctx::ki;


variable kp

Proportional gain [pu V / pu A].

struct sstep_gain sstep_ctx::kp;


variable mo

Motion generator.

struct sstep_motion sstep_ctx::mo;


variable r_pu

Phase resistance [pu] (voltage drive).

struct sstep_gain sstep_ctx::r_pu;


variable ratio

Fast loop periods per slow loop period.

uint16_t sstep_ctx::ratio;


variable ready

SSTEP_READY after a successful sstep_init() .

uint32_t sstep_ctx::ready;


variable sp

Setpoints; the fast loop owns sp[sp_active].

struct sstep_setpoint sstep_ctx::sp[2];


variable sp_active

Buffer in use by the fast loop.

volatile uint8_t sstep_ctx::sp_active;


variable sp_pending

1: sp[1 - sp_active] is complete and new.

volatile uint8_t sstep_ctx::sp_pending;


variable stall_count

Stall detector up/down counter.

uint32_t sstep_ctx::stall_count;


variable stall_emf_mv

Back-EMF of stall_speed [mV].

int32_t sstep_ctx::stall_emf_mv;


variable stall_hold

Slow periods the condition stays true after a reversal.

uint32_t sstep_ctx::stall_hold;


variable stall_ticks

Slow periods of stall to trip; 0 = detection off.

uint32_t sstep_ctx::stall_ticks;


variable state

Driver state.

enum sstep_state sstep_ctx::state;


variable still

Slow periods at standstill.

uint32_t sstep_ctx::still;


variable v_hist

Applied phase voltages computed 1 and 2 periods ago [pu V].

sstep_acc_t sstep_ctx::v_hist[2][2];


variable vbus_max_raw

Overvoltage trip [ADC counts], 0 = off.

uint16_t sstep_ctx::vbus_max_raw;


variable vbus_min_raw

Undervoltage trip [ADC counts], 0 = off.

uint16_t sstep_ctx::vbus_min_raw;


variable vbus_raw

Last bus voltage [ADC counts].

volatile uint16_t sstep_ctx::vbus_raw;


variable vel_cmd

Commanded velocity of the period in use [microsteps/s].

int32_t sstep_ctx::vel_cmd;



The documentation for this class was generated from the following file src/sstep_internal.h