Giter Site home page Giter Site logo

gin66 / fastaccelstepper Goto Github PK

View Code? Open in Web Editor NEW
265.0 20.0 63.0 1.91 MB

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3 and Atmel SAM Due

License: MIT License

C++ 77.79% C 9.72% Makefile 8.64% Shell 2.65% Awk 0.86% CMake 0.03% Nix 0.03% Python 0.29%
arduino atmega328 nano acceleration driver-ic highspeed tested stepper motor a4988

fastaccelstepper's People

Contributors

clazarowitz avatar daawesomep avatar gagank1 avatar garmischwg avatar gin66 avatar heldereis avatar ixil avatar justinong avatar turley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastaccelstepper's Issues

setCurrentPosition(0) does not reset moveTo(##), moveTo(##) still remembers old positon

We are at the point now where we're relating the pulse counter and stepper position both the physical world. We are able to reset both counters to 0, with the marker in the physical world, but using commands such as moveTo/move() we are running into limitations or we are not using it correctly where it seems to remember the original position even though we reset the pulse and position counters to 0. The construct for the stepper are not being reset even though the position counter is reset.

In the code below we are setting moveTo(-25599). As the motor is running to position -25599, we are setting the stepper position and pulse counter to 0. Although in the output the pulse counter and stepper position counters reset to 0 the moveTo/move(-25599) functions do not reset to zero and continues to remember the old position.
As a result the stepper moves -25599 steps instead of moving -25599 from the point the stepper position and counter has been set to 0.

void runStepperMotor()
{


  stepper->enableOutputs();
  stepper->moveTo(-25599);
  
  while(!((stepper->readPulseCounter() - 1) == (-25600))){
//  Serial.print(" -> PULSE COUNTER -1: ");
//  Serial.print(stepper->readPulseCounter() - 1);

  currentMillis = millis();
  if (stepper->pulseCounterAttached()) {
      Serial.print(" -> Pulse Counter: [");
      Serial.print(stepper->readPulseCounter());
      Serial.print(']');
      Serial.print(" -> Stepper Positon: [");
      Serial.print(stepper->getCurrentPosition());
      Serial.println(']');
      
//      Serial.print("TIME MILLIS: ");
//      Serial.print(currentMillis);
      }

  if(Serial.available()>0){
     if (Serial.read() == 'C') {
            Serial.print("Clear Counter");
            stepper->clearPulseCounter();
            stepper->setCurrentPosition(0);
        }
   }
    
    } //end of while loop
  
  Serial.print("Done Counting");
  stepper->clearPulseCounter();
  stepper->setCurrentPosition(0);

}

Too many steps created

M1 A100000 V40 R1000 M2 A100000 V40 R1000

yields in simavr 1010 steps.

While M1 A100000 V40 R1000 yields as expected 1000 steps

With two steppers only speeds lower than ~430us work:
M1 A100000 V430 R1000 M2 A100000 V430 R1000

Too much time in ISR

Time measurement with simavr has revealed critical timing under high speed with two or three parallel steppers.

Two steppers: 3720us spent in ISR, while repetition rate is 4096us

Three steppers: 3806us spent in ISR, while repetition rate is 4096us

At 25kSteps/s within 4096us, there will be 102 stepper interrupt/s created for one stepper and 306 stepper interrupts for three steppers. With max. 6us per Interrupt, during 4096us approx 1836us will be spent in the stepper interrupt.

Possible improvement:
1.) Update README to ensure not all steppers are running simultaneously at high speed
2.) Reduce time spent in stepper interrupt
3.) Reduce time spent in fill queue ISR
4.) Reduce max. step rate for 2560
5.) Reduce max. step rate dynamically from amount of steppers used.

Ramping stopped working at 4000 and 8000 counts/rev

Report from issue #44

Interestingly, at 4000 and 8000 counts/rev the ramping stopped working: hard reversals; hard stops; hard velocity changes. But also, at 8000, after some commands, speed stops responding to encoder turn or monitor commands.---The program seems to lose its way.

Moving a set distance or angle.

Do you by chance have an example showing how to implament this for distance movement's?

I have a prety smart hybrid driver and a high torque stepper from Novotech. This library seems to work well with that combination although I am trying to split out the encoder signals so I can also get the positioning of the shaft rather then rely on limit switches.

in my case I am using micro 3200 steps on the driver. The project I have only needs to motor to turn one rotation forward and backward however I need to do this as fast as possible. Essentially thats 8.888 steps per degree.

I would like to be able to vary the velocity and speed of the movement over the 360 degree's of rotation but not quie sure how to implament this based on the examples.

Thanks in advance for any advice.
Andrew

Stepper is not running smooth at slower rpm

When comparing the stepper motor movement between Arduino Nano using the Accelstepper library and the use of ESP32 with the FastAccelStepper library the motor does not run as smooth with the FastAccelStepper library. Is this because this library is optimized for use with faster speeds? We plan to use speeds between 1-5rpm.

Issue on moveTo() to exactly same target after a completion of stopMove()

If one issues any moveTo i.e. "moveTo(9999);" then, while on the way, issue a "stopMove()" and wait for a full stop, a re-issue of "moveTo(9999);" will NOT move the motor, any other value but previous one (9999) will work just fine. If the re-issue of the same "moveTo(9999);" occurs while the stepper is still moving (deceleration phase) everything runs fine. A current workaround this issue is to double call moveTo() with +1 value, i.e. "moveTo(value + 1);" followed by "moveTo(value);"

Test sequence lead to motor not moving

Start test sequence t M1 02 R. While motor is running, issue 02

Result is, that motor is stuck in RED state. Issuance of another 02 resumes function:

[00:42:22:431] Select stepper 1
[00:42:22:433] Select test_seq_02
[00:42:22:434] Run tests
[00:42:22:435] M1: @0 M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:22:523] M1: @1 => 0 QueueEnd=0/22400us MANU M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:22:623] M1: @1 => 0 QueueEnd=0/22400us MANU M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:22:723] M1: @4 => 0 QueueEnd=3/11200us ACC   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:22:823] M1: @3 => 7 QueueEnd=4/11200us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:22:923] M1: @3 => 0 QueueEnd=3/11200us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:023] M1: @4 => 10 QueueEnd=5/9984us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:123] M1: @10 => 0 QueueEnd=9/15808us ACC   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:223] M1: @1 => 0 QueueEnd=1/15808us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:323] M1: @8 => 13 QueueEnd=9/9984us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:423] M1: @11 => 0 QueueEnd=9/9088us ACC   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:523] M1: @1 => 0 QueueEnd=1/15808us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:623] M1: @9 => 17 QueueEnd=10/7904us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:723] M1: @17 => 0 QueueEnd=17/0us ACC   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:770] Select test_seq_02
[00:42:23:771] Run tests
[00:42:23:823] M1: @6 => 1 QueueEnd=5/11200us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:23:923] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:023] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:123] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:223] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:323] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:423] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:523] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:623] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 
[00:42:24:723] M1: @1 => 0 QueueEnd=1/0us RED   M2: @0 M3: @0 M4: @0 M5: @0 M6: @0 

Long step times are less accurate than short ones

If step time is longer than 65536 ticks, the actual step time is not tick accurate. The longer the step time the less accurate it gets. This is because the step time is approximated using a period time and a repetition count. In most cases this is not an issue since the error is small compared to the step time.
However in some cases tick accurate steps are needed (e.g. in my case, a barn door star tracker), otherwise the error accumulates and significant drift is introduced.

An alternative solution is to compose the step time using N fixed periods (each 65536-2*MIN_DELTA_TICKS long) plus any remaining ticks. I have implemented this solution for the AVR but have no idea how to do it for esp32 (so I cannot do a PR).

The downside to this is that the maximum step time is somewhat shorter (in the case of 16MHz AVR 1.034 instead of 1.044 seconds)

Steppers 4-6 issue

The steppers 4-6 do not work properly.

Try: M1 A10000 V300 f M4 A10000 V300 f

M4 runs slower than M1 and M4 makes more noise

An issue of M4 A10000 f or M4 V300 f makes stepper 4 slow down/speed up and M1 too makes noise. An issue of M4 f has no effect.

setAutoEnable() funcitonality

@gin66 Thank you very much for this library. This is the best stepper library I have used so far. I can drive stepper motors really fast using an ESP32 thanks to this. However, there is a slight issue on the auto enable function while using the setCurrentPosition().
For example, if I try this code:

homeAxis();

fastStepper.init();
axisStepper = fastStepper.stepperConnectToPin(AXIS_MOTOR_STEP_PIN);

if( axisStepper ) {
    axisStepper->setDirectionPin(AXIS_MOTOR_DIRECTION_PIN);
    axisStepper->setEnablePin(AXIS_MOTOR_ENABLE_PIN);
    axisStepper->setAutoEnable(true);
}
else {
    ESP.restart();
}

axisStepper->setCurrentPosition(0);

delay(1500);
axisStepper->setSpeed(30);
axisStepper->setAcceleration(5000);
axisStepper->moveTo(550400);

It homes the steppers using directly turning on and off the pins and then it sets the position to 0. After that, it moves to a given position which it can't reach correctly. It always misses it with some margin. I think this is due to starting driving the motors as soon as you enable them, because some drivers takes some time to adjust before actually pushing steps. If I change the code like this:

if( axisStepper ) {
    axisStepper->setDirectionPin(AXIS_MOTOR_DIRECTION_PIN);
    axisStepper->setEnablePin(AXIS_MOTOR_ENABLE_PIN);
    //axisStepper->setAutoEnable(true); <-Commented this line
}
else {
    ESP.restart();
}

axisStepper->enableOutputs(); //Manually enabling the outputs and waiting a little after that
delay(200);
axisStepper->setCurrentPosition(0);

delay(1500);
axisStepper->setSpeed(30);
axisStepper->setAcceleration(5000);
axisStepper->moveTo(550400);

it works without a problem. I think you need to give some time to the drivers before actually pushing steps to them. I don't know if you'd have the same issue with other drivers, but this is the case with my HPD-HBS57 closed loop stepper driver. It never misses any step due to its closed loop nature, however it misses steps with autoEnable turned on. I think you should wait a little before disabling the stepper motors between the commands and wait a little before starting them. This way they can have some time to adjust, and they wouldn't get turned on and off when there isn't any command in the queue immediately.

Thank you

ESP8266 ?

Hi,

is there a way to use this Prject on an ESP8266 ?

Best Regards

Andreas

Interrupt other PCNT

Hi ,

Use 3 PCNT for Quadrature Encoder with ISR for overflow. (run ISR Overflow OK)

Use your LIB with succes for 2 steppers and 1 frequency module.

Lost somes Interrupts on PCNT encoders overflow when FastAccelStepper -> engine.stepperConnectToPin

Howto fix it ?
(change priority or insert the ISR Quadrature Encoder in your LIB )

Thanks JF

Typo, bad paste & copy or forgotten ?

FastAccelStepper.c, line 484

_enablePinHighActive && _enablePinHighActive ?

  if ((_enablePinHighActive == PIN_UNDEFINED) &&
      (_enablePinHighActive == PIN_UNDEFINED)) {
    _externalEnableCall = NULL;
  }

Deceleration in applySpeedAcceleration() don't work.

I'm working with a potentiometer, setSpeed and applySpeedAcceleration. While the acceleration works perfect (by adding speed), there isn't an existing deceleration when decreasing the speed. It's jerky and jumpy getting slower.
With the methods "runForward" and "runBackward" it decelerates perfectly. Is it meant to be like that or isn't it implemented yet?

Problems with motors 4-6 on ESP32

Found your library and mostly its working great for me. Super glad to see a few today too!

I'm using an ESP32 (NodeMCU) and I cannot get the last 3 motors working. I've verified my wiring by switching positions (last 3 -> first 3, vice-versa) in the config array. Not real sure whats up, so I thought I'd reach out for help. Entirely possible I'm doing something dumb.

This is happening in my sketch (which only otherwise uses https://github.com/plapointe6/EspMQTTClient) and in the stepper demo sketch.

Config:

const struct stepper_config_s stepper_config[6] = {
    {
      step : 4,
      enable_low_active : 32,
      enable_high_active : PIN_UNDEFINED,
      direction : 5,
      direction_high_count_up : true,
      auto_enable : true,
      on_delay_us : 5000,
      off_delay_ms : 10
    },
    {
      step : 12,
      enable_low_active : 32,
      enable_high_active : PIN_UNDEFINED,
      direction : 13,
      direction_high_count_up : true,
      auto_enable : true,
      on_delay_us : 5000,
      off_delay_ms : 10
    },
    {
      step : 14,
      enable_low_active : 32,
      enable_high_active : PIN_UNDEFINED,
      direction : 15,
      direction_high_count_up : true,
      auto_enable : true,
      on_delay_us : 5000,
      off_delay_ms : 10
    },
    {
      step : 17,
      enable_low_active : 32,
      enable_high_active : PIN_UNDEFINED,
      direction : 18,
      direction_high_count_up : true,
      auto_enable : true,
      on_delay_us : 5000,
      off_delay_ms : 10
    },
    {
      step : 19,
      enable_low_active : 32,
      enable_high_active : PIN_UNDEFINED,
      direction : 21,
      direction_high_count_up : true,
      auto_enable : true,
      on_delay_us : 5000,
      off_delay_ms : 10
    },
    {
      step : 22,
      enable_low_active : 32,
      enable_high_active : PIN_UNDEFINED,
      direction : 23,
      direction_high_count_up : true,
      auto_enable : true,
      on_delay_us : 5000,
      off_delay_ms : 10
    },
    
};

Glitches at some speeds

Hi,
Thank you very much for this code. I am a newbie. I am testing it on a Clearpath motor:
https://www.teknic.com/model-info/CPM-SDSK-N0563P-RLN/?model_voltage=230VAC3ph .
It has integrated power supply + driver; it accepts standard step/dir or Quad A/B inputs.

I'm using an Arduino Uno 16bit, and attached a digital encoder knob.
The code takes speed commands from the knob and from monitor input.
The motor currently runs at 1000 steps/rev. I am testing at 0-1000rpm.
Motor accelerates to various speeds and reverses elegantly with decel/accel as commanded.
Knob is set to 20rpm increments per tick (count).

Problem: When adjusting speed with knob, at a few speed transitions the motor jolts (glitches) but recovers; motor software MSP warns "torque saturation" condition. Perhaps a rapid stop/start event? Something in the frequency timing comes to mind, but I have no experience.

Examples (at 1000 steps/rev):
Encoder cnt: 27, from 520--540rpm, speedInUs: 111
Encoder cnt: 37, from 720--740rpm, speedInUs: 81
Encoder cnt: 47, from 920--940rpm, speedInUs: 64

Tested: In MSP software, I changed the steps per rev from 1000 to 4000: there still were glitches but at different speeds than before.

I would like to know if someone else has experienced such glitches? And what may be the cause? Thanks.

esp32: Pulses lost with high speed

Version 0.18.2, commit b862e2e
Use this sequence in StepperDemo M1 p6 t 04 R

  1. Attach pulse counter M1 p7
  2. Test mode t
  3. run sequence 04 R

All ok.

Then x and M2 p7 t 04 R

Yields (sometimes) -2 for pulse counter, while position is 0

Comment to my HW: M1 and M2 share direction pin.

Using M3, which has not a shared direction, haven't seen this issue

How can we use library without setAcceleration?

Hi Gin66,
The motor does not run without setAcceleration defined but we do not require acceleration for our project.
Is this set acceleration required?
What is the maximum value we can set the acceleration to so the motor run immediately to the desired speed (1 to 3rev/min)?
We are trying to run the motor precisely 1 revolution in 60seconds, at a very low rpm and we find that there is very small discrepancy (0.1degrees) error with acceleration set so we are trying to remove the acceleration as a possible source of error.

esp32: time adherence measurements yields anomally

Measurements by log from CuteCom line timestamps:
M1 N A100000 V100 R600000
...runs for 60s, OK
M1 N A100000 V1000 R60000
...runs for 60s,OK
M1 N A100000 V4000 R15000
...runs for 60s, OK
For speed >= 4096us additional pauses are added.
M1 N A100000 V4100 R14634
...runs for 30s ???
M1 N A100000 V5000 R12000
...runs for 30s ???
M1 N A100000 V10000 R6000
...runs for 25s ???
M1 N A100000 V12000 R5000
...runs for 20,5s ???
M1 N A100000 V15000 R4000
...runs for 32,8s ???
M1 N A100000 V20000 R3000
...runs for 37s ???
M1 N A100000 V100000 R600
...runs for 56s ???
M1 N A100000 V100000 R600
...runs for ~59,5s

All should yield 60s running time.

Stepper runs with V4100 much faster compared to V4000

Problem with ESP32_DEVKIT V4 WROOM & StepperDemo

Hello,
I want to run a single stepper (200 steps per turn; 1A current spec) using an DRV8824 powered at 12V for the motor (DRV8824 trimpot adjusted).
I am using a win10 laptop and an Arduino environment.
When using an Arduino mega2560 hooked to a RAMPS card with A DRV8824, I get correct motion of the motor using a StepperDriver library (with acceleration/deceleration capability)

I want now to use a and an ESP32_DEVKIT V4 WROOM , and my goal is to use 6 steppers at 200 steps/turn, to rotate concurently each with an eventual different speed in the range 20RPM-800RPM

I have started to test only one motor; I am encountering problems; and would be happy to find a way to fix the problem:
I am using the "StepperDemo" from FastAccelStepper
I have used GPIO5 for stepping, GPIO27 for enable (enable_low_active), GPIO32 for direction; also I have hooked up a led in series with a 200 ohm resistance between pin GPIO5 and ground, so as to monitor step activity.

Here is what I get on the console:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Demo Stepper
F_CPU=40000000
TICKS_PER_S=16000000
Enter commands separated by space, carriage return or newline:
M1/M2/.. ... to select stepper
A ... Set selected stepper's acceleration
V ... Set selected stepper's speed
U ... Update selected stepper's speed/acceleration while running
P ... Move selected stepper to position (can be negative)
R ... Move selected stepper by n steps (can be negative)
K ... Keep selected stepper running in current direction
@ ... Set selected stepper to position (can be negative)
E ... Set selected stepper's delay from enable to steps
D ... Set selected stepper's delay from steps to disable
N ... Turn selected stepper output on (disable auto enable)
F ... Turn selected stepper output off (disable auto enable)
O ... Put selected stepper into auto enable mode
S ... Stop selected stepper with deceleration
X ... Immediately stop motor and set zero position
I ... Toggle motor info, while any motor is running
W ... Blocking wait until selected motor is stopped (will deadlock if the motor will never stop)
+ ... Perform one step forward of the selected motor
- ... Perform one step backward of the selected motor
T ... Test selected motor with direct port access
Q ... Toggle print usage on motor stop
? ... Print this usage

M1: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
Select stepper 1
Set acceleration to 1000
Set speed (us) to 1000
Output driver on {>>> here the axis of the motor is not anymore free to rotate , which is OK}
Move to position 100
returncode=0
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=0 QueueEnd=1/0us Target=100 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
E (168457) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (168457) task_wdt: - IDLE0 (CPU 0)
E (168457) task_wdt: Tasks currently running:
E (168457) task_wdt: CPU 0: StepperTask
E (168457) task_wdt: CPU 1: loopTask
E (168457) task_wdt: Aborting.
abort() was called at PC 0x400d5147 on core 0

Backtrace: 0x4008b820:0x3ffbe170 0x4008ba4d:0x3ffbe190 0x400d5147:0x3ffbe1b0 0x4008486d:0x3ffbe1d0 0x400d267d:0x3ffb86b0 0x400d18fe:0x3ffb86d0 0x400d1c1c:0x3ffb86f0 0x400d1db4:0x3ffb8720 0x400d1ebe:0x3ffb8760 0x400d1ed5:0x3ffb8780 0x400884d5:0x3ffb87a0

Rebooting...
ets Jun 8 2016 00:22:57


When the ESP32 boots , I can hear some noise from the motor1 ( vibration from the motor 1 but no net rotation, and the led on the GPIO5 is emitting light); this noise lasts for about 2 seconds ; then stops.
For the console output above,
I have typed the following commands:
M1
A1000
V1000
N
P100
The Move 100 is not associated with any activity on the GPIO5; The axis of the motor is not free to rotate until the errors encounter; then the program exits/reboots


I tried then a motion of larger amplitude:
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Demo Stepper
F_CPU=40000000
TICKS_PER_S=16000000
Enter commands separated by space, carriage return or newline:
M1/M2/.. ... to select stepper
A ... Set selected stepper's acceleration
V ... Set selected stepper's speed
U ... Update selected stepper's speed/acceleration while running
P ... Move selected stepper to position (can be negative)
R ... Move selected stepper by n steps (can be negative)
K ... Keep selected stepper running in current direction
@ ... Set selected stepper to position (can be negative)
E ... Set selected stepper's delay from enable to steps
D ... Set selected stepper's delay from steps to disable
N ... Turn selected stepper output on (disable auto enable)
F ... Turn selected stepper output off (disable auto enable)
O ... Put selected stepper into auto enable mode
S ... Stop selected stepper with deceleration
X ... Immediately stop motor and set zero position
I ... Toggle motor info, while any motor is running
W ... Blocking wait until selected motor is stopped (will deadlock if the motor will never stop)
+ ... Perform one step forward of the selected motor
- ... Perform one step backward of the selected motor
T ... Test selected motor with direct port access
Q ... Toggle print usage on motor stop
? ... Print this usage

M1: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
Select stepper 1
Set acceleration to 1000
Set speed (us) to 1000
Output driver on
Move to position 1000
returncode=0
M1: AUTO Curr=0 QueueEnd=0/0us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
(.......)
(.......)
(.......)
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
M1: AUTO Curr=1 QueueEnd=5/9984us Target=1000 RUN ACC M2: MANU Curr=0 QueueEnd=0/0us Target=0 STOP IDLE
ets Jun 8 2016 00:22:57


Similarly the led on GPIO5 is NOT turned on at all (no led activity)
I also tested the "T" command: it does apparently nothing that I could detect (axis of motor free to rotate or not, eventual noise of the motor, led on, etc...); Upon typing "T" and hitting return, I just get "nothing", and no feedback on the console either.

Direct control of the acceleration independent of speed and position

Can the interface to the stepper driver be expanded so it become possible to directly control the acceleration of the motor independent of it's speed and position.

This will enable to use the steppers as acceleration devices (like DC-motors), which is used in many closed loop control systems.

Reduce acceleration in unidirectional mode will lead to restart

Using M1 A1000 V100 P100 w300 A100 U.

The expectation is, that the motor will overshoot the position 100 and then stops, because it cannot reverse the direction. The overshoot is normal, because the acceleration has been reduced during ramp down.

Issue is, that the motor starts after stop to "reverse" in the same direction, because there is no direction pin connected. Second problem is, that the position even reduces to 100, which is totally wrong.

Even more weird is M1 A1000 V100 P100 w300 A100 U W P0, which according to the log returns to position 0.

Using setSpeed() quickly while the stepper is moving causes position loss/incorrect position

(I am using a TTGO T-Display ESP32 and a TMC5160 SilentStepStick v1.5)

Below is the relevant code that triggers the issue; it just moves the stepper back and forth between 0 and a set position "StepsToNext" when I have a button pressed (the code is in the main loop). When "UseSpeedSwitcher" is on, it changes the speed every 100 milliseconds which causes the position loss. When the speed isn't changed, the stepper returns to the correct position each time.

if (analogRead(BUTTON_2) < 1000)
{
  if(!B2Pressed)
    Serial.println("b2 pressed!");
  B2Pressed = true;
  if (millis() > LastMoveToMillis + TimeToNext*1000)
  {
    LastMoveToMillis = millis();
    Serial.println("movespeedmicros: " + String(MoveSpeedMicros));
    Serial.println("movespeed: " + String(MoveSpeed));
    Serial.println("movespeedMax: " + String(MoveSpeedMax));
    MovingToZero = !MovingToZero;
    if (MovingToZero)
    {
      FAS->moveTo(0);
    }
    else
    {
      FAS->moveTo(StepsToNext);
    }
  }
  if (millis() > LastSpeedSwitchMillis + 100 && UseSpeedSwitcher)
  {
    LastSpeedSwitchMillis = millis();
    SwitchedSpeed = !SwitchedSpeed;
    SpeedSwitchedTimes++;
    if (SwitchedSpeed)
      FAS->setSpeed(MoveSpeedMicros*0.9);
    else
      FAS->setSpeed(MoveSpeedMicros);
  }
}

setPinsInverted() support for different modules

Hello, are you going to add setPinsInverted() support in the future? This might help the usage with different drivers or different connection configurations. This property exists in the AccelStepper library like so:
stepper.setPinsInverted(false, false, true);

Thanks in advance.

Question on Demo/Test Program to Use to Verify FastAccelStepper Running on ESP32 to Operate A STAC6 Stepper Driver

Hi:

Just FYI background. We've been using the ESP32 MCU with the Easy Driver stepper driver till now. We have had some good results, but not perfect. The Easy Driver stepper driver modelues were just for the lab setup to develop our code, and now we're trying the FastAccelStepper out on a true industrial stepper driver (the STAC6-QE stepper driver) with a NEMA 34 1841 oz-in torque step motor.

A application is straight forward (I'll leave the encoder out of things on this question for simplicity, just interested in running the STAC6 stepper 6 correctly and smoothly for this industrial large NEMA 34 step motor on this question).

Just need FastAccelStepper to run on an inductrialized ESP32 MCU (Using Industrial Shields hardware as a ESP32 based PLC to control a stepper driver and step motor).

What is a good demo to test sketch to verify FastAccelStepper functionality and the set-up with a STAC6-QE stepper driver using FastAccelStepper running on an ESP32 using the Arduino IDE for the PLC code? Sorry, I don't see a "question" designation on here.

https://github.com/gin66/FastAccelStepper/tree/master/examples

Thanks for your help and time.

ESP32 forceStopAndNewPosition

often forceStopAndNewPosition(0) does not set position to 0. In that cases also something breaks and library stop to respond on moveTo function. Need more testing.

Synchronise steppers

Howto synchronise multiple steppers ?
For start move 2 steppers
send a command wait Extern volatile int Synch ?

JF

Real Time System Latency

Hi,
This is very nice and seems that very powerfull. I want to use this library on my realtime motion simulation project. I am currently processing commands from pc and generating pulses with arduino with interrupt timers, like you. But I dont have acceleration / decc routines, and I am very happy to found your library. Also nano/uno is not enought mcu power for 4 stepper. So ESP32 is also very vital for me.

My question is latency. I am asking only latency of library after run command. On docs, I saw 4ms for ATMEGA and 10ms for ESP, but I am not sure.

Thanks for help.

Stop and SetCurrentPosition methods

Hi Gin66,

Great library that you have here.

Do you have an update on when the SetCurrentPosition method will be done and do you have plans of having a Stop method in place to stop all current operations for the queue?

These operations are important when it comes to homing processes to find end of travel limits.
I am using the library with a nano (atmega328p)

Kind regards,
Jarryd

Can't use pins after ESP.restart()

I didn't wanted to open a new issue for this, but I gotta ask. Do you know why I can't drive a stepper manually after I use the ESP.restart() function? Do the pins stuck attached to something after restart? What I mean is digitalWrite functionality doesn't work on those pins. Maybe the library also gets broken, idk.

Error compiling example in Arduino IDE

Hi,
I get an error when trying to compile the simple avr example in Arduino IDE.
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Nano, ATmega328P"
In file included from C:\Users\joerg\Documents\Arduino\sketch_sep07c\sketch_sep07c.ino:1:0:
C:\Users\joerg\Documents\Arduino\libraries\FastAccelStepper\src/FastAccelStepper.h:188:39: error: conversion from 'FastAccelStepper*' to non-scalar type 'FastAccelStepper' requested
#define stepperA() stepperConnectToPin(9)
C:\Users\joerg\Documents\Arduino\sketch_sep07c\sketch_sep07c.ino:8:40: note: in expansion of macro 'stepperA'
FastAccelStepper stepperA = fas_engine.stepperA();
^~~~~~~~
C:\Users\joerg\Documents\Arduino\sketch_sep07c\sketch_sep07c.ino: In function 'void setup()':
sketch_sep07c:13:12: error: base operand of '->' has non-pointer type 'FastAccelStepper'
stepperA->setDirectionPin(dirPinStepperA);
^~
sketch_sep07c:15:12: error: base operand of '->' has non-pointer type 'FastAccelStepper'
stepperA->setEnablePin(enablePinStepperA);
^~
sketch_sep07c:16:12: error: base operand of '->' has non-pointer type 'FastAccelStepper'
stepperA->setAutoEnable(true);
^~
sketch_sep07c:18:12: error: base operand of '->' has non-pointer type 'FastAccelStepper'
stepperA->setSpeed(1000); // the parameter is us/step !!!
^~
sketch_sep07c:19:12: error: base operand of '->' has non-pointer type 'FastAccelStepper'
stepperA->setAcceleration(100);
^~
sketch_sep07c:20:12: error: base operand of '->' has non-pointer type 'FastAccelStepper'
stepperA->move(1000);
^~

exit status 1
base operand of '->' has non-pointer type 'FastAccelStepper'

CODE

#include "FastAccelStepper.h"

#define dirPinStepperA 5
#define enablePinStepperA 6
//#define stepPinStepperA 9 // OC1A

FastAccelStepperEngine fas_engine = FastAccelStepperEngine();
FastAccelStepper stepperA = fas_engine.stepperA();
//FastAccelStepper stepperB = fas_engine.stepperB();

void setup() {
fas_engine.init();
stepperA->setDirectionPin(dirPinStepperA);

stepperA->setEnablePin(enablePinStepperA);
stepperA->setAutoEnable(true);

stepperA->setSpeed(1000); // the parameter is us/step !!!
stepperA->setAcceleration(100);
stepperA->move(1000);
}

void loop() {
}

(suggestion) Include setDelayToEnable and setDelayToDisable in usage example to fix TMC5160/etc. not moving

I am using a TTGO T-Display ESP32 and a TMC5160 SilentStepStick v1.5.

It took me a while before I found out what was making the StepperDemo example work while the usage example didn't (it would enable the driver but the motor did not move).

The answer was actually right under the usage example, but I missed it:

Some drivers need time to e.g. stabilize voltages until stepping should start. For this the start on delay has been added. See issue #5.

While trying to find the problem, I found that getCurrentPosition() would stay at 0 after a move() command when I didn't have the enable delays set. After adding

stepper->setDelayToEnable(50);
stepper->setDelayToDisable(1000);

to the usage example, everything worked as expected. I think it'd be good to add this to the usage example so it will work with more stepper drivers without needing modification.

It was confusing when getCurrentPosition() stayed at 0 because it seems like the ESP32 was actually aware that the driver didn't move the motor, but I thought that this shouldn't be possible since the driver doesn't send any information back to the ESP32 (at least not to FastAccelStepper, I should also mention that I'm using TMCStepper with software SPI).

Idea: add forwardStep() and backwardStep() functions for homing

As far as I can tell, the library does not include a stop function which would stop the stepper immediately without deceleration. However, this is needed for homing purposes in very precise devices. The homing function runs the stepper step by step until it hits an end stop or triggers a sensor. As soon as the end stop detected, the controller needs to stop the motor in order to get a very accurate position. It doesn't seem to be possible right now to do this using the library(Correct me if I'm wrong please). In fact I am doing it manually by toggling the step pin. What I'm suggesting is maybe we can add forwardStep() and backwardStep() functions to move the motor one step at a time to be able to check the sensor status at each step. What do you think about this? Thanks in advance.

Usage example code not doing anything?

I didn't know where else to post this. I've tried using the example code on the Readme, and it doesn't do anything, but does seem to activate the stepper motor.

#include "FastAccelStepper.h"

#define dirPinStepper    2
#define enablePinStepper 4
#define stepPinStepper   3  // OC1A in case of AVR

FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;

void setup() {
   engine.init();
   stepper = engine.stepperConnectToPin(stepPinStepper);
   if (stepper) {
      stepper->setDirectionPin(dirPinStepper);
      stepper->setEnablePin(enablePinStepper);
      stepper->setAutoEnable(true);

      stepper->setSpeed(1000);       // the parameter is us/step !!!
      stepper->setAcceleration(100);
   }
}

void loop() {
    stepper->moveTo(1000);
}

Does the FastAccelstepper library have some kind of stepper.run() function like accelstepper does?

I'm interested in using this library for a robotics project. It would be great to have a simple sweep code to begin with (stepper move clockwise.. stop. Stepper move anti-clockwise. Stop)

Motor stops running runBackard/runForward after executing forceStopAndNewPosition

Hi gin66,

Using executing runBackward() method a few times the motor stops running and does not respond to runBackward().

To explain our code:
We have a while loop and a timer for 30seconds.
Every time I enter a command to Start the motor, the motor will runBackward() for 30seconds and then stop (forceStopAndNewPosition) and wait for the next command again.
I will enter "Start" command again and the motor will run for 30seconds again and stop.

The problem is that after I "Start" the motor after the 2nd or 3rd time the motor will not run.
The timer is still running as expected and other parts of code are working as expected.
runBackward or runForward do not respond after 2nd/3rd time calling the method.

getCurrentPosition causes a block

It seems that using getCurrentPosition() causes the program to freeze/block. This is the code I am using:

#include "FastAccelStepper.h"

// As in StepperDemo for Motor 1 on AVR
#define dirPinStepper    9
#define enablePinStepper 10
#define stepPinStepper   8  // OC1A in case of AVR

// As in StepperDemo for Motor 1 on ESP32
//#define dirPinStepper 18
//#define enablePinStepper 26
//#define stepPinStepper 17

FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;

void setup() {
 engine.init();
 stepper = engine.stepperConnectToPin(stepPinStepper);
 if (stepper) {
   stepper->setDirectionPin(dirPinStepper);
   stepper->setEnablePin(enablePinStepper);
   stepper->setAutoEnable(true);

   stepper->setSpeed(1000);  // the parameter is us/step !!!
   stepper->setAcceleration(10000);
   //stepper->move(7000);
   stepper->runForward();
 }
 Serial.begin(115200);
 Serial.print("    F_CPU=");
 Serial.println(F_CPU);
 Serial.print("    TICKS_PER_S=");
 Serial.println(TICKS_PER_S);  
}

void loop() 
{ 
   delayMicroseconds(100);
   if (stepper->isRunning()) 
   {
     Serial.print("@");
     Serial.print(stepper->getCurrentPosition());
   } 
}

Any idea why this might be happening?

Why Timer4 only for Arduino Mega2560?

Hi! It is clearly stated in doc that for Arduino Mega2560 we can use only pins 6,7,8 (Timer4). But what is the reason? Can it be improved? In my project I have connected lcd display on mega2560, and these pins are used for display. I want to switch to Timer5 (pins 44,45,46), but it does not work :(

setAcceleration cause wrong deceleration calculation (overshoot)

loop
{
stepper->setSpeed(variableSpeed);
//stepper->setAcceleration(9999); // uncomment this cause motor position will be over than target and motor have to go backward (same in both direction). In most bad cases it act like drunk car driver to chive target position in waves-like motion.
//stepper->setAcceleration(variableAcceleration); //same situation

long target = analogRead(A0)*5;
stepper->moveTo(target);
}

I test on ESP32. tested this on v0.18.11 , v0.18.02

Compiler flag for other Timers

Hello, I've been using the library for a project at my Uni - and forked it to so I can use the TIMER4 on a MEGA2560. At the moment it is only functionally I just use sed -i -f regexes.sed ./src/*ISR_avr.cpp to do so. See ixil/FastAccelStepper. (The other difference were just when I was testing it).

Would you be interested/would it be possible to use some preprocessor magic (or better, modern c++) so I do not need to follow your fork?
Thanks for the useful library

How many steppers can you control with acceleration?

I have been working on a motion control system using accelstepper for many months. The obvious drawback is that I can only control one stepper while implementing acceleration control. Can your library control two or more steppers with at least common acceleration values ? If so which board would you recommend. I am currently working with the RF-Nano

Very high acceleration value e.g. 10.000.000 and high speed

Very high acceleration value e.g. 10.000.000 and high speed may be silently not executed, if the high speed in us is smaller than MIN_CMD_TICKS. This corresponds to 2500 steps/s for avr and 5000 steps/s.
=> Fix this, because problem occurs only, if the first command has only one step

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.