uStepper S
Classes | Macros
uStepperDriver.h File Reference

Function prototypes and definitions for the TMC5130 motor driver. More...

#include <Arduino.h>
#include <uStepperS.h>
Include dependency graph for uStepperDriver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  uStepperDriver
 Prototype of class for the TMC5130 Driver. More...
 

Macros

#define GCONF   0x00
 
#define DIRECTION(n)   (((n)&0x1)<<4)
 
#define EN_PWM_MODE(n)   (((n)&0x1)<<2)
 
#define I_SCALE_ANALOG(n)   (((n)&0x1)<<0)
 
#define GSTAT   0x01
 
#define X_COMPARE   0x05
 
#define IHOLD_IRUN   0x10
 
#define TPOWERDOWN   0x11
 
#define TSTEP   0x12
 
#define TPWMTHRS   0x13
 
#define TCOOLTHRS   0x14
 
#define THIGH   0x15
 
#define RAMPMODE   0x20
 
#define XACTUAL   0x21
 
#define VACTUAL   0x22
 
#define VSTART_REG   0x23
 
#define A1_REG   0x24
 
#define V1_REG   0x25
 
#define AMAX_REG   0x26
 
#define VMAX_REG   0x27
 
#define DMAX_REG   0x28
 
#define D1_REG   0x2A
 
#define VSTOP_REG   0x2B
 
#define TZEROWAIT   0x2C
 
#define XTARGET   0x2D
 
#define VDCMIN   0x33
 
#define SW_MODE   0x34
 
#define SG_STOP(n)   (((n)&0x1)<<10)
 
#define RAMP_STAT   0x35
 
#define XLATCH   0x36
 
#define PWMCONF   0x70
 
#define FREEWHEEL(n)   (((n)&0x3UL)<<20)
 
#define PWM_AUTOSCALE(n)   (((n)&0x1UL)<<18)
 
#define PWM_FREQ(n)   (((n)&0x3UL)<<16)
 
#define PWM_GRAD(n)   (((n)&0xFF)<<8)
 
#define PWM_AMPL(n)   (((n)&0xFF)<<0)
 
#define CHOPCONF   0x6C
 
#define DISS2G(n)   (((n)&0x1UL)<<30)
 
#define DEDGE(n)   (((n)&0x1UL)<<29)
 
#define INTPOL(n)   (((n)&0x1UL)<<28)
 
#define MRES(n)   (((n)&0xFUL)<<24)
 
#define SYNC(n)   (((n)&0xFUL)<<20)
 
#define VHIGHCHM(n)   (((n)&0x1UL)<<19)
 
#define VHIGHFS(n)   (((n)&0x1UL)<<18)
 
#define VSENSE(n)   (((n)&0x1UL)<<17)
 
#define TBL(n)   (((n)&0x3UL)<<15)
 
#define CHM(n)   (((n)&0x1UL)<<14)
 
#define RNDTF(n)   (((n)&0x1)<<13)
 
#define DISFDCC(n)   (((n)&0x1)<<12)
 
#define TFD3(n)   (((n)&0x1)<<11)
 
#define HEND(n)   (((n)&0xF)<<7)
 
#define HSTRT_TFD(n)   (((n)&0x7)<<4)
 
#define TOFF(n)   (((n)&0xF)<<0)
 
#define COOLCONF   0x6D
 
#define SFILT(n)   (((n)&0x1UL)<<24)
 
#define SGT(n)   (((n)&0x7FUL)<<16)
 
#define SEIMIN(n)   (((n)&0x1UL)<<15)
 
#define SEDN(n)   (((n)&0x3)<<13)
 
#define SEMAX(n)   (((n)&0xF)<<8)
 
#define SEUP(n)   (((n)&0x3)<<5)
 
#define SEMIN(n)   (((n)&0xF)<<0)
 
#define DCCTRL   0x6E
 
#define DC_SG(n)   (((n)&0xFFUL)<<16)
 
#define DC_TIME(n)   (((n)&0x3FF)<<0)
 
#define DRV_STATUS   0x6F
 
#define IHOLDDELAY(n)   (((n)&0xFUL)<<16)
 
#define IRUN(n)   (((n)&0x1F)<<8)
 
#define IHOLD(n)   (((n)&0x1F)<<0)
 
#define WRITE_ACCESS   0x80
 
#define POSITIONING_MODE   0x00
 
#define VELOCITY_MODE_POS   0x01
 
#define VELOCITY_MODE_NEG   0x02
 
#define HOLD_MODE   0x03
 
#define DRIVER_STOP   0
 
#define DRIVER_VELOCITY   1
 
#define DRIVER_POSITION   2
 
#define ACCELERATIONCONVERSION   1.0/116.415321827
 
#define VELOCITYCONVERSION   1.0/0.953674316
 

Detailed Description

Function prototypes and definitions for the TMC5130 motor driver.

        This file contains class and function prototypes for the TMC5130 motor driver,
        as well as necessary constants and global variables.
Author
Thomas Hørring Olsen (thoma.nosp@m.s@us.nosp@m.teppe.nosp@m.r.co.nosp@m.m)

Definition in file uStepperDriver.h.

Macro Definition Documentation

◆ A1_REG

#define A1_REG   0x24

Please check datasheet for register description

Definition at line 57 of file uStepperDriver.h.

◆ ACCELERATIONCONVERSION

#define ACCELERATIONCONVERSION   1.0/116.415321827

page 74 datasheet

Definition at line 140 of file uStepperDriver.h.

◆ AMAX_REG

#define AMAX_REG   0x26

Please check datasheet for register description

Definition at line 59 of file uStepperDriver.h.

◆ CHM

#define CHM (   n)    (((n)&0x1UL)<<14)

Please check datasheet for register description

Definition at line 95 of file uStepperDriver.h.

◆ CHOPCONF

#define CHOPCONF   0x6C

Chopper and driver configuration Please check datasheet for register description

Definition at line 84 of file uStepperDriver.h.

◆ COOLCONF

#define COOLCONF   0x6D

Please check datasheet for register description

Definition at line 106 of file uStepperDriver.h.

◆ D1_REG

#define D1_REG   0x2A

Please check datasheet for register description

Definition at line 62 of file uStepperDriver.h.

◆ DC_SG

#define DC_SG (   n)    (((n)&0xFFUL)<<16)

Please check datasheet for register description

Definition at line 117 of file uStepperDriver.h.

◆ DC_TIME

#define DC_TIME (   n)    (((n)&0x3FF)<<0)

Please check datasheet for register description

Definition at line 118 of file uStepperDriver.h.

◆ DCCTRL

#define DCCTRL   0x6E

Please check datasheet for register description

Definition at line 116 of file uStepperDriver.h.

◆ DEDGE

#define DEDGE (   n)    (((n)&0x1UL)<<29)

Please check datasheet for register description

Definition at line 87 of file uStepperDriver.h.

◆ DIRECTION

#define DIRECTION (   n)    (((n)&0x1)<<4)

Please check datasheet for register description

Definition at line 39 of file uStepperDriver.h.

◆ DISFDCC

#define DISFDCC (   n)    (((n)&0x1)<<12)

Please check datasheet for register description

Definition at line 97 of file uStepperDriver.h.

◆ DISS2G

#define DISS2G (   n)    (((n)&0x1UL)<<30)

Please check datasheet for register description

Definition at line 86 of file uStepperDriver.h.

◆ DMAX_REG

#define DMAX_REG   0x28

Please check datasheet for register description

Definition at line 61 of file uStepperDriver.h.

◆ DRIVER_POSITION

#define DRIVER_POSITION   2

Define label for indicating driver is in position mode

Definition at line 138 of file uStepperDriver.h.

◆ DRIVER_STOP

#define DRIVER_STOP   0

Define label for indicating driver is in standstill mode

Definition at line 136 of file uStepperDriver.h.

◆ DRIVER_VELOCITY

#define DRIVER_VELOCITY   1

Define label for indicating driver is in velocity mode

Definition at line 137 of file uStepperDriver.h.

◆ DRV_STATUS

#define DRV_STATUS   0x6F

stallGuard2 value and driver error flags

Definition at line 120 of file uStepperDriver.h.

◆ EN_PWM_MODE

#define EN_PWM_MODE (   n)    (((n)&0x1)<<2)

Please check datasheet for register description

Definition at line 40 of file uStepperDriver.h.

◆ FREEWHEEL

#define FREEWHEEL (   n)    (((n)&0x3UL)<<20)

Please check datasheet for register description

Definition at line 75 of file uStepperDriver.h.

◆ GCONF

#define GCONF   0x00

Please check datasheet for register description

Definition at line 37 of file uStepperDriver.h.

◆ GSTAT

#define GSTAT   0x01

Please check datasheet for register description

Definition at line 43 of file uStepperDriver.h.

◆ HEND

#define HEND (   n)    (((n)&0xF)<<7)

Please check datasheet for register description

Definition at line 99 of file uStepperDriver.h.

◆ HOLD_MODE

#define HOLD_MODE   0x03

velocity remains unchanged, unless stop event occurs

Definition at line 134 of file uStepperDriver.h.

◆ HSTRT_TFD

#define HSTRT_TFD (   n)    (((n)&0x7)<<4)

Please check datasheet for register description

Definition at line 100 of file uStepperDriver.h.

◆ I_SCALE_ANALOG

#define I_SCALE_ANALOG (   n)    (((n)&0x1)<<0)

Please check datasheet for register description

Definition at line 41 of file uStepperDriver.h.

◆ IHOLD

#define IHOLD (   n)    (((n)&0x1F)<<0)

Please check datasheet for register description

Definition at line 124 of file uStepperDriver.h.

◆ IHOLD_IRUN

#define IHOLD_IRUN   0x10

Please check datasheet for register description

Definition at line 45 of file uStepperDriver.h.

◆ IHOLDDELAY

#define IHOLDDELAY (   n)    (((n)&0xFUL)<<16)

Please check datasheet for register description

Definition at line 122 of file uStepperDriver.h.

◆ INTPOL

#define INTPOL (   n)    (((n)&0x1UL)<<28)

Please check datasheet for register description

Definition at line 88 of file uStepperDriver.h.

◆ IRUN

#define IRUN (   n)    (((n)&0x1F)<<8)

Please check datasheet for register description

Definition at line 123 of file uStepperDriver.h.

◆ MRES

#define MRES (   n)    (((n)&0xFUL)<<24)

Please check datasheet for register description

Definition at line 89 of file uStepperDriver.h.

◆ POSITIONING_MODE

#define POSITIONING_MODE   0x00

Modes for RAMPMODE register using all A, D and V parameters)

Definition at line 131 of file uStepperDriver.h.

◆ PWM_AMPL

#define PWM_AMPL (   n)    (((n)&0xFF)<<0)

Please check datasheet for register description

Definition at line 79 of file uStepperDriver.h.

◆ PWM_AUTOSCALE

#define PWM_AUTOSCALE (   n)    (((n)&0x1UL)<<18)

Please check datasheet for register description

Definition at line 76 of file uStepperDriver.h.

◆ PWM_FREQ

#define PWM_FREQ (   n)    (((n)&0x3UL)<<16)

Please check datasheet for register description

Definition at line 77 of file uStepperDriver.h.

◆ PWM_GRAD

#define PWM_GRAD (   n)    (((n)&0xFF)<<8)

Please check datasheet for register description

Definition at line 78 of file uStepperDriver.h.

◆ PWMCONF

#define PWMCONF   0x70

Please check datasheet for register description

Definition at line 73 of file uStepperDriver.h.

◆ RAMP_STAT

#define RAMP_STAT   0x35

Please check datasheet for register description

Definition at line 69 of file uStepperDriver.h.

◆ RAMPMODE

#define RAMPMODE   0x20

Please check datasheet for register description

Definition at line 51 of file uStepperDriver.h.

◆ RNDTF

#define RNDTF (   n)    (((n)&0x1)<<13)

Please check datasheet for register description

Definition at line 96 of file uStepperDriver.h.

◆ SEDN

#define SEDN (   n)    (((n)&0x3)<<13)

Please check datasheet for register description

Definition at line 110 of file uStepperDriver.h.

◆ SEIMIN

#define SEIMIN (   n)    (((n)&0x1UL)<<15)

Please check datasheet for register description

Definition at line 109 of file uStepperDriver.h.

◆ SEMAX

#define SEMAX (   n)    (((n)&0xF)<<8)

Please check datasheet for register description

Definition at line 111 of file uStepperDriver.h.

◆ SEMIN

#define SEMIN (   n)    (((n)&0xF)<<0)

Please check datasheet for register description

Definition at line 113 of file uStepperDriver.h.

◆ SEUP

#define SEUP (   n)    (((n)&0x3)<<5)

Please check datasheet for register description

Definition at line 112 of file uStepperDriver.h.

◆ SFILT

#define SFILT (   n)    (((n)&0x1UL)<<24)

Please check datasheet for register description

Definition at line 107 of file uStepperDriver.h.

◆ SG_STOP

#define SG_STOP (   n)    (((n)&0x1)<<10)

Please check datasheet for register description

Definition at line 68 of file uStepperDriver.h.

◆ SGT

#define SGT (   n)    (((n)&0x7FUL)<<16)

Please check datasheet for register description

Definition at line 108 of file uStepperDriver.h.

◆ SW_MODE

#define SW_MODE   0x34

Please check datasheet for register description

Definition at line 67 of file uStepperDriver.h.

◆ SYNC

#define SYNC (   n)    (((n)&0xFUL)<<20)

Please check datasheet for register description

Definition at line 90 of file uStepperDriver.h.

◆ TBL

#define TBL (   n)    (((n)&0x3UL)<<15)

Please check datasheet for register description

Definition at line 94 of file uStepperDriver.h.

◆ TCOOLTHRS

#define TCOOLTHRS   0x14

Please check datasheet for register description

Definition at line 49 of file uStepperDriver.h.

◆ TFD3

#define TFD3 (   n)    (((n)&0x1)<<11)

Please check datasheet for register description

Definition at line 98 of file uStepperDriver.h.

◆ THIGH

#define THIGH   0x15

Please check datasheet for register description

Definition at line 50 of file uStepperDriver.h.

◆ TOFF

#define TOFF (   n)    (((n)&0xF)<<0)

Please check datasheet for register description

Definition at line 101 of file uStepperDriver.h.

◆ TPOWERDOWN

#define TPOWERDOWN   0x11

Please check datasheet for register description

Definition at line 46 of file uStepperDriver.h.

◆ TPWMTHRS

#define TPWMTHRS   0x13

Please check datasheet for register description

Definition at line 48 of file uStepperDriver.h.

◆ TSTEP

#define TSTEP   0x12

Definition at line 47 of file uStepperDriver.h.

◆ TZEROWAIT

#define TZEROWAIT   0x2C

Please check datasheet for register description

Definition at line 64 of file uStepperDriver.h.

◆ V1_REG

#define V1_REG   0x25

Please check datasheet for register description

Definition at line 58 of file uStepperDriver.h.

◆ VACTUAL

#define VACTUAL   0x22

Please check datasheet for register description

Definition at line 53 of file uStepperDriver.h.

◆ VDCMIN

#define VDCMIN   0x33

Please check datasheet for register description

Definition at line 66 of file uStepperDriver.h.

◆ VELOCITY_MODE_NEG

#define VELOCITY_MODE_NEG   0x02

negativ VMAX, using AMAX acceleration

Definition at line 133 of file uStepperDriver.h.

◆ VELOCITY_MODE_POS

#define VELOCITY_MODE_POS   0x01

positiv VMAX, using AMAX acceleration

Definition at line 132 of file uStepperDriver.h.

◆ VELOCITYCONVERSION

#define VELOCITYCONVERSION   1.0/0.953674316

page 74 datasheet

Definition at line 141 of file uStepperDriver.h.

◆ VHIGHCHM

#define VHIGHCHM (   n)    (((n)&0x1UL)<<19)

Please check datasheet for register description

Definition at line 91 of file uStepperDriver.h.

◆ VHIGHFS

#define VHIGHFS (   n)    (((n)&0x1UL)<<18)

Please check datasheet for register description

Definition at line 92 of file uStepperDriver.h.

◆ VMAX_REG

#define VMAX_REG   0x27

Please check datasheet for register description

Definition at line 60 of file uStepperDriver.h.

◆ VSENSE

#define VSENSE (   n)    (((n)&0x1UL)<<17)

Please check datasheet for register description

Definition at line 93 of file uStepperDriver.h.

◆ VSTART_REG

#define VSTART_REG   0x23

Ramp curves Please check datasheet for register description

Definition at line 56 of file uStepperDriver.h.

◆ VSTOP_REG

#define VSTOP_REG   0x2B

Please check datasheet for register description

Definition at line 63 of file uStepperDriver.h.

◆ WRITE_ACCESS

#define WRITE_ACCESS   0x80

Write access for spi communication

Definition at line 127 of file uStepperDriver.h.

◆ X_COMPARE

#define X_COMPARE   0x05

Please check datasheet for register description

Definition at line 44 of file uStepperDriver.h.

◆ XACTUAL

#define XACTUAL   0x21

Please check datasheet for register description

Definition at line 52 of file uStepperDriver.h.

◆ XLATCH

#define XLATCH   0x36

Please check datasheet for register description

Definition at line 70 of file uStepperDriver.h.

◆ XTARGET

#define XTARGET   0x2D

Please check datasheet for register description

Definition at line 65 of file uStepperDriver.h.