-
Notifications
You must be signed in to change notification settings - Fork 13.3k
2.4.0 and stepper motor crash and strange things #4296
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
Comments
The stepper.h library is made for Arduino and is not adapted for ESP8266. There is a PR that you should try, but in any case I think this is not the best place. Take a look at Microstepping example
On the other hand, 1500 are not too many steps? |
First of all, thanks for the reply . I'll look at the exemple as soon as possible. About the number of steps, i just used the default in the example for this thread. Thuth be told I've used other values too, but it came out weirdly, or the stepper was turning slowly or faster or it didn't turn at all (but it was for too high values for sure). My point in this case is, if i set the speed (20 rpm) why the number of steps is influencing how fast the stepper spins? Another thing is i've found sites stating that the stepper i am using needs 4096 steps for a rotation, i was skeptical but even tryed that value tand it resulted in the stepper not being able to move and ticking. |
Speed and number of steps are relationated, in stepper.cpp with the variable named step_delay that is calculated with this:
Stepper move only if the appropriate delay has passed and the library uses a "while" command, AND THIS IS THE PROBLEM, because WDT occurs with a long time. ESP8266 is a bit special and it need to have control every so often, the library should be done with flags instead of a "while" (or similar method), to let the control to the ESP8266. One remedy is to use yield within that "while", for this, edit the file stepper.cpp search for line 196 and insert yield (); or use the previous PR that I told you and uncomment the lines 413 and 474, there you can see the yield too and a explanation. Returning to the issue of revolutions per minute, 1500steps/rev are too many ... it's 360/1500 = 0.24degrees per step. NEMA17 have 200steps or 1.8degrees. Tell us what stepper it is and I try to look for its characteristics. You don't need to declare the pins D1 or D2, because you are using the four pins declaration. Forgot what I tell you in my first comment about this. |
Closing as off topic. |
Hi to all.
I really hope you can help me find a solution.
Thanks in advance :)
Basic Infos
Hardware
Hardware: ESP-12E Module
Core Version: 2.4.0
Description
I've already read a bunch of threads:
#2558
https://github.com/esp8266/Arduino/pull/2533/files
#2083
... and more, but none solved my problem.
Using the stepper motor in general cause a crash. Even the example "stepper_oneRevolution." crashes while performing the counterclock rotation. Using delay(...) or yield() or system_soft_wdt_feed() is useless the problem persists ... mostly during the counterclock rotation a crash happens.
The strange thing is that after the crash if I "restart" (unplug and plug back in the usb port) the NoideMCU begins to work and stepper continuously turns without crashing, but the delay after the counterclock rotation i totally wrong.
Settings in IDE
Producer: AZ-Delivery
Module: NodeMCU ESP8266 V2.0 Amica
Flash Size: 4MB
CPU Frequency: 80Mhz
Upload Using: SERIAL
Here my code:
Sketch
And that's qhat the Serial monitor reports:
Debug Messages
I used "Exception Decoder" and it reported this;
Debug Messages
Have you some clue about it?
Lastly ... sorry for may bad english ^^"
The text was updated successfully, but these errors were encountered: