Skip to content

drivers:stepper Step-Dir Pin toggle Frequency to High #87698

@jbehrensnx

Description

@jbehrensnx

Describe the bug

The current step-dir implementation in step_dir_stepper_common toggles in single_edge mode the step pin twice as fast as it can. For some board and stepper controller combinations (for example Teensy 4.0 board with a TI drv8424 stepper controller) this causes the pin to be toggled to fast and thus erroneous behavior - e.g. the motor not stepping.

To Reproduce

  1. Connect a drv8424 stepper controller with a Teensy 4.0 board and use the counter timing source (didn't test work queue timing)
  2. Test the driver via the shell, using microstep resolution of 1 and a microstep interval of 5000000 - i.e. 200 steps/s
  3. Observe the motor

Expected behavior

The motor should step correctly.

Possible solutions

One possible solution is to use a 50% duty cycle of the step signal - like the drv8424 driver before the step-dir generalization. This requires an internal doubling of the step signal frequency and step counting only on every second interrupt. In addition, the step signal needs to be explicitly set to low when stopping, possibly after a short delay after stopping the timing source.
These changes are only needed for single_edge mode. dual_step mode can remain like it is.

That said, this is only one possible solution and I am interested if there are other ideas on how to solve this.

Metadata

Metadata

Assignees

Labels

area: StepperbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions