Replies: 12 comments 11 replies
-
I have a similar setup and a similar problem! At some specific PWM frequencies the motor doesn't step. My scope indicates a problem with the duty cycle. I set it once for 50%, but when changing the frequency the duty cycle changes sometimes (not always) to a strange value, even 0% or 100%. I'm trying to figure out when and why. |
Beta Was this translation helpful? Give feedback.
-
Yes, it is with the ESP32 (one with 8 MB SPIRAM). Same script on the RP2 Pico does not show this behaviour. |
Beta Was this translation helpful? Give feedback.
-
Once a 'wrong' duty cycle appears is remains the same during the cycle. When changing the frequency it usually switches back to 50%. |
Beta Was this translation helpful? Give feedback.
-
In my tests I have seen wrong duty cycles when the frequency change caused an internal binary divider to change. The 'critical' changes were for instance 610->611Hz, 1220->1221Hz, 4882->4883Hz. With your list of frequencies, 320, 640, 1280 are next to these limits, and changing the frequency down will cross them. However, in my tests the change lasted only for a few periods, 1-2. So I wonder what causes the wrong cycle to be permanent and how Python code can change that behavior. |
Beta Was this translation helpful? Give feedback.
-
In my original setup I made frequency steps of about 106 Hz. With steps of 1 Hz I didn't see irregularities, but with steps of 8 Hz the wrong duty cycles appeared again. Until 152 Hz duty cycle was steady 50%. |
Beta Was this translation helpful? Give feedback.
-
I set the duty cycle with PWM.dutycycle_u16(32768) and by querying it after each frequency change (and a subsequent sleep of 1 PWM period) it reports most of the times 32678 as one would expect. But when I see on the scope a duty cycle of 100% it reports 65536 and when I see 25% it reports 16384. So it reports correctly the actual state! |
Beta Was this translation helpful? Give feedback.
-
Sorry, forgot to mention: |
Beta Was this translation helpful? Give feedback.
-
I cannot replicate that using a GENERC_SPIRAM module and a fresh build. There is a short glitch upon the transition between 152 and 160 Hz (or 128 to 154) in both directions, but nothing permanent.
|
Beta Was this translation helpful? Give feedback.
-
I cannot reproduce the problem with a simple PWM setup. Preliminary conclusion: the cause of the issue with the varying duty_cycle must lie in my stepper-motor driver. |
Beta Was this translation helpful? Give feedback.
-
My initial issue is apparently solved. |
Beta Was this translation helpful? Give feedback.
-
My stepper driver really needed removal of some proliferation! The stepper motor runs now without hick-ups. |
Beta Was this translation helpful? Give feedback.
-
I was trying the same thing with TMC2209v1.2 and NEMA17 stepper motor, after increasing the speed of stepper motor the circuit worked for some time and after the driver got heated it stopped generating current, and now it does not even work on the lower speed. Is there any solution to this or anything that I am missing? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to drive a JK42HM stepper motor with a TMC2209 and an ESP32 programmed with micropython. Sometimes it works, sometimes it doesn't... and I can't figure out what is the difference between the 2 states (an important pin left unconnected?)
When it doesn't work, the motor either just shake or the 12V power supply emits a warning because a short circuit is detected. When it works, well.. it turns as expected
Here is my schema and the test code I use
I've searched a lot on the web but couldn't find something usefull :(
I'm probably not looking in the right direction.
Can anyone plesae help me ?
Beta Was this translation helpful? Give feedback.
All reactions