Skip to content

WatchDogTimer issue #2377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rudydevolder opened this issue Aug 10, 2016 · 3 comments
Closed

WatchDogTimer issue #2377

rudydevolder opened this issue Aug 10, 2016 · 3 comments

Comments

@rudydevolder
Copy link

rudydevolder commented Aug 10, 2016

Hardware: ESP-12

Problem Description:

The Example below is adapted to work but WatchDogTimer Resets the board and dumps the stack when the delay-commands are removed or when you increase the amount of steps in myMotor->step(100)

Settings in IDE

Module: Feather Huzzah
Flash Size: 4MB
CPU Frequency: 80Mhz

Upload Using: SERIAL

Sketch


/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->   http://www.adafruit.com/products/1438
*/


#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
// My Mini stepper has 513 steps per revolution =>
Adafruit_StepperMotor *myMotor = AFMS.getStepper(513, 2);


void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");
  Serial.println("Stepper test!");

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz

  myMotor->setSpeed(10);  // 10 rpm   
}

void loop() {
  Serial.print("Single coil steps    : FORWARD ");
  myMotor->step(100, FORWARD, SINGLE); 
  Serial.println(", BACKWARD"); delay(1);
  myMotor->step(100, BACKWARD, SINGLE); 
  delay(1);

  Serial.print("Double coil steps    : FORWARD ");
  myMotor->step(100, FORWARD, DOUBLE); delay(1);
  Serial.println(", BACKWARD");
  myMotor->step(100, BACKWARD, DOUBLE);
  delay(1);

  Serial.print("Interleave coil steps: FORWARD ");
  myMotor->step(100, FORWARD, INTERLEAVE); delay(1);
  Serial.println(", BACKWARD");
  myMotor->step(100, BACKWARD, INTERLEAVE); 
  delay(1);

  //Serial.println("Microstep steps: FORWARD ");
  //myMotor->step(50, FORWARD, MICROSTEP); delay(1);
  //Serial.print(", BACKWARD");
  //myMotor->step(50, BACKWARD, MICROSTEP);
  Serial.println();
}

Debug Messages

Soft WDT reset

ctx: cont 
sp: 3ffef320 end: 3ffef550 offset: 01b0

>>>stack>>>
3ffef4d0:  00000002 00000009 3ffee3b8 402024fc  
3ffef4e0:  40107010 00002daf 0000005d 40202724  
3ffef4f0:  00000002 0000005d 00002daf 4020278c  
3ffef500:  00000001 feefeffe 3ffee504 40202be8  
3ffef510:  00000640 3ffee3d0 3ffee504 3ffee528  
3ffef520:  3ffe8478 3ffee368 3ffee504 40202125  
3ffef530:  3fffdad0 00000000 3ffee520 40202d9c  
3ffef540:  feefeffe feefeffe 3ffee530 40100114  
<<<stack<<<
@WereCatf
Copy link
Contributor

Working as intended: watchdog has to get to do its job.

https://github.com/esp8266/Arduino/blob/master/doc/reference.md#timing-and-delays

@rudydevolder
Copy link
Author

Thank you very much @WereCatf
I went looking in the sourcecode: "Adafruit Motorshield" for the step.command and added delay(0) => problem solved. ;)
Now I can run with any numbers of steps and without the delay command in my code.

@devyte
Copy link
Collaborator

devyte commented Oct 14, 2017

Closing as resolved.

@devyte devyte closed this as completed Oct 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants