-
Notifications
You must be signed in to change notification settings - Fork 73
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
Wrong position when using moveTo on esp32? #60
Comments
Looks all ok. Could you please elaborate on how wrong the position is ? What I could recommend: Please try with the StepperDemo example using key commands via serial monitor. This should help to isolate the problem. |
Hi and thanks for your answer :) i ran the demo code and it passed on everything exept test 7 and 8? Test9 seems to go on forever? What is wrong?
|
Thanks for spending the time. I should add docu, what those tests do:
All those test have no internal test passed/failed criteria. I use them for automated tests with tests/simavr_based and even with tests/esp32_hw_based. One commonality: They should run smoothly without hiccups and return to start position.
|
In your case test sequence 08 is very interesting, because it shows, that running in negative direction the attached pulse counter does not match with the number of generated pulses. For two generated pulses, the pulse counter measures three. Test sequence 07 does not display any similar anomaly, but the timing is not ok. Perhaps can check again, if the esp32 comes out of reset. Here couple of questions:
|
Hi and thank you for your reply :). Edit: Changed from common gnd on the stepper to common 5.0v and used a logic converter for the lines from the esp32 to the stepper. Seems like this did the trick!
|
Happy to see, that you have identified and fixed the root cause. Why it works with common VCC, but not with common GND is interesting. From the data sheet, the outputs have to drive the LEDs of an opto coupler. Just this does not explain the direction pin dependent stray pulses with the funny ratio of approx. one stray per two regular pulses for negative direction, only. Anyway, if it works for you now, then this is OK. I personally would go back to the former failing version and try to understand, what the real issue is. But that's just me. At least I have added the test sequence description to the README, as I've written it down here. Perhaps someone else needs similar info, what those test sequences do, so it is now available. As the problem is resolved, the issue can be closed. |
Hi, here i used the UsageExample with some small modifications. Channel 0 : Step After Logic Converter.
Here is the measurments, im using Saleae Logic 1.2.18 To do the measurments, i also uploaded a csv of the measurments if it is of any use :) Software: https://www.saleae.com/downloads/ Measurements 24 MHz, 720 M Samples [7].zip |
Thanks for the investigation and the data file. Actually I prefer the csv-file, so I can analyze with some gawk script. And besides, that the ramp is done faster, there is no anomaly. Just checked on my hw and I cannot reproduce the problem using same step pin as yours. My device is an ESP-WROOM-32 Now some more questions:
still from the test seq 08 above, the pulse generation and pulse count by second counter do not match. This still indicates glitches, while on salea there are none to see. As the esp32 is a complex board, there may still be glitches inside the housing not visible to salea. |
Hi, csv file notet :). i woke up this morning, powered on my setup without touching anything and it ran normally, wierd, maybe it has something to do with my code or setup even thou the day before i uploaded the UsageExample and it still happened? i dont know? I haven't tried all of your last suggestion yet but il do as soon as i can reproduce the anomaly :) 1.I ran the motor 2-3 times before it happened and it always happened on the high side of dir, i also tried to power cycle the esp32 and stepper yesterday without luck. Is it possible that in some way my previous uploaded code was interfering with the timer the library uses? like pairing of the Bluetooth or the clock speed of Wire (Wire.setClock(1000000)? Which timer does the library use? Im going to test some more and se if i can reproduce it and get back to you, its most likely something with the esp32 im using maybe. Thanks so much for the fast response and help so far :) |
As stated in the readme for timer usage: This stepper driver uses mcpwm modules of the esp32: for the first three stepper motors mcpwm0, and mcpwm1 for the steppers four to six. In addition, the pulse counter module is used starting from unit_0 to unit_5. This driver uses the pcnt_isr_service, so unallocated modules can still be used by the application. Any update ? |
stalled, so close |
Had the same issue with a closed loop. Then I set driver_type for the stepperConnectToPin-method to DRIVER_RMT(1). Works like a charm now. |
Hi, im having issues with the stepper moving to wrong position when i run the example code, seems like it only moves wrong when going in reverse, to little. This is a awesome library if the position is correct :)
im not using the enable pin, its is connected to ground (on).
the stepper im using is a nema23 closed loop with the driver directly on top of it.
The text was updated successfully, but these errors were encountered: