---
tag: m0917
title: L6474 Overcurrent Warning Test
brief: Find L6474 minimum current thresholds
author: shitcreek

group: L6474
requires: MONITOR_L6470_DRIVER_STATUS

codes: [ M917 ]
related: [ M916, M918 ]

notes:
- Requires `MONITOR_L6470_DRIVER_STATUS`.
- All tests assume each axis uses matching driver chips.

parameters:

- tag: J
  optional: true
  description: Select which driver(s) to monitor on multi-driver axis.
  values:
  - tag: 0
    description: (default) Monitor all drivers on the axis or E0.
  - tag: 1
    description: Monitor only X, Y, Z, E1.
  - tag: 2
    description: Monitor only X2, Y2, Z2, E2.
  - tag: 3
    description: Monitor only Z3, E3
  - tag: 4
    description: Monitor only Z4, E4
  - tag: 5
    description: Monitor only Z5, E5
  - tag: 6
    description: Monitor only Z6, E6
  - tag: 7
    description: Monitor only Z7, E7

- tag: X
  optional: true
  description: Monitor X with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: Y
  optional: true
  description: Monitor Y with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: Z
  optional: true
  description: Monitor Z with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: A
  optional: true
  since: 2.0.9
  requires: I_DRIVER_TYPE, AXIS4_NAME 'A'
  description: Monitor A with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: B
  optional: true
  since: 2.0.9
  requires: J_DRIVER_TYPE, AXIS5_NAME 'B'
  description: Monitor B with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: C
  optional: true
  since: 2.0.9
  requires: K_DRIVER_TYPE, AXIS6_NAME 'C'
  description: Monitor C with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: U
  optional: true
  since: 2.1
  requires: U_DRIVER_TYPE, AXIS7_NAME 'U'
  description: Monitor U with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: V
  optional: true
  since: 2.1
  requires: V_DRIVER_TYPE, AXIS8_NAME 'V'
  description: Monitor V with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: W
  optional: true
  since: 2.1
  requires: W_DRIVER_TYPE, AXIS9_NAME 'W'
  description: Monitor W with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: E
  optional: true
  description: Monitor E with the given displacement (1 - 255mm) on either side of the current position.
  values:
  - type: mm

- tag: F
  optional: true
  description: Feedrate for the moves. If unspecified, uses the max feedrate.
  values:
  - tag: feedrate
    type: int

- tag: I
  optional: true
  description: Starting overcurrent threshold. Report current value from driver if not specified. If there are multiple drivers on the axis then all will be set the same.
  values:
  - tag: current
    type: int

- tag: T
  optional: true
  description: Current (mA) setting for TVAL (0 - 4A in 31.25mA increments, rounds down) - L6474 only. Report current value from driver if not specified.
  values:
  - tag: current
    type: int

- tag: K
  optional: true
  description: Value for KVAL_HOLD (0 - 255) (ignored for L6474). Report current value from driver if not specified
  values:
  - tag: Kvalue
    type: int

---

The `M917` command runs a test procedure to find the minimum stepper current thresholds.
- Decrease OCD current until overcurrent error
- Increase OCD until overcurrent error goes away
- Decrease stall threshold until stall (not done on L6474)
- Increase stall until stall error goes away (not done on L6474)
