adi,tmc50xx (on spi bus)

Description

Analog Devices TMC50XX Stepper Motor Controller

Example:

  &spi0 {
      /* SPI bus options here, not shown */

      /* Dual controller/driver for up to two 2-phase bipolar stepper motors */
      tmc50xx: tmc50xx@0 {
          compatible = "adi,tmc50xx";
          reg = <0>;
          spi-max-frequency = <DT_FREQ_M(8)>; /* Maximum SPI bus frequency */

          poscmp-enable; test-mode; lock-gconf; /* ADI TMC Global configuration flags */
          clock-frequency = <DT_FREQ_M(16)>; /* Internal/External Clock frequency */

          tmc50xx_0_stepper_driver: tmc50xx_0_stepper_driver {
            idx = <0>;
            compatible = "adi,tmc50xx-stepper-drv";
            micro-step-res = <256>;
            /* ADI TMC stallguard settings specific to TMC50XX */
            stallguard2-threshold=<30>;
          };

          tmc50xx_0_motion_controller: tmc50xx_0_motion_controller {
            idx = <0>;
            compatible = "adi,tmc50xx-stepper";
            vstart = <1000>;
            vstop = <10>;
            a1 = <10000>;
            v1 = <50000>;
            d1 = <14000>;
            vmax = <900000>;
            amax = <50000>;
            dmax = <7000>;
            tzerowait = <100>;
            vhigh = <900000>;
            vcoolthrs = <900000>;
            ihold = <1>;
            irun = <10>;
            iholddelay = <1>;
            activate-stallguard2;
            stallguard-velocity-check-interval-ms=<1000>;
            stallguard-threshold-velocity=<200000>;
          };
      };
  };

Properties

Top level properties

These property descriptions apply to “adi,tmc50xx” nodes themselves. This page also describes child node properties in the following sections.

Properties not inherited from the base binding file.

Name

Type

Details

clock-frequency

int

The frequency of the clock signal provided to the TMC50XX.
This is used for real world conversion.

Hint: µstep velocity v[Hz] µsteps / s v[Hz] = v[50xx] * ( fCLK[Hz]/2 / 2^23 )
      where v[50xx] is the value written to the TMC50XX.

This property is required.

shaft1

boolean

Inverse motor 1 direction

shaft2

boolean

Inverse motor 2 direction

spi-max-frequency

int

Maximum clock frequency of device's SPI interface in Hz

This property is required.

duplex

int

Duplex mode, full or half. By default it's always full duplex thus 0
as this is, by far, the most common mode.
Use the macros not the actual enum value, here is the concordance
list (see dt-bindings/spi/spi.h)
  0    SPI_FULL_DUPLEX
  2048 SPI_HALF_DUPLEX

Legal values: 0, 2048

frame-format

int

Motorola or TI frame format. By default it's always Motorola's,
thus 0 as this is, by far, the most common format.
Use the macros not the actual enum value, here is the concordance
list (see dt-bindings/spi/spi.h)
  0     SPI_FRAME_FORMAT_MOTOROLA
  32768 SPI_FRAME_FORMAT_TI

Legal values: 0, 32768

spi-cpol

boolean

SPI clock polarity which indicates the clock idle state.
If it is used, the clock idle state is logic high; otherwise, low.

spi-cpha

boolean

SPI clock phase that indicates on which edge data is sampled.
If it is used, data is sampled on the second edge; otherwise, on the first edge.

spi-lsb-first

boolean

The device requires least significant bit first data mode.

spi-hold-cs

boolean

In some cases, it is necessary for the master to manage SPI chip select
under software control, so that multiple spi transactions can be performed
without releasing it. A typical use case is variable length SPI packets
where the first spi transaction reads the length and the second spi transaction
reads length bytes.

spi-cs-high

boolean

The device requires the chip select to be active high.

spi-interframe-delay-ns

int

Delay in nanoseconds between SPI words.
Default of 0 is special value which will assume to mean half of the SCK period.

spi-cs-setup-delay-ns

int

Delay in nanoseconds to be introduced by the controller after CS is asserted.
Also known as enable lead time.

spi-cs-hold-delay-ns

int

Delay in nanoseconds to be introduced by the controller before the CS is de-asserted.
 Also known as enable lag time.

supply-gpios

phandle-array

GPIO specifier that controls power to the device.

This property should be provided when the device has a dedicated
switch that controls power to the device.  The supply state is
entirely the responsibility of the device driver.

Contrast with vin-supply.

vin-supply

phandle

Reference to the regulator that controls power to the device.
The referenced devicetree node must have a regulator compatible.

This property should be provided when device power is supplied
by a shared regulator.  The supply state is dependent on the
request status of all devices fed by the regulator.

Contrast with supply-gpios.  If both properties are provided
then the regulator must be requested before the supply GPIOS is
set to an active state, and the supply GPIOS must be set to an
inactive state before releasing the regulator.

poscmp-enable

boolean

Enable position compare feature
0: Outputs INT and PP are tristated.
1: Position compare pulse (PP) and interrupt output (INT) are available

Attention – do not leave the outputs floating in tristate condition, provide an external
pull-up or set poscmp-enable=1

test-mode

boolean

Enable test mode
0: Normal operation
1: Enable analog test output on pin REFR2
TEST_SEL selects the function of REFR2: 0…4: T120, DAC1, VDDH1, DAC2, VDDH2

Attention: Not for user, set to 0 for normal operation!

lock-gconf

boolean

1: GCONF is locked against further write access.

Child node properties

Name

Type

Details

reg

array

Information used to address the device. The value is specific to
the device (i.e. is different depending on the compatible
property).

The "reg" property is typically a sequence of (address, length) pairs.
Each pair is called a "register block". Values are
conventionally written in hex.

For details, see "2.3.6 reg" in Devicetree Specification v0.4.

See Important properties for more information.