-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
[BUG] 2.0.9.3 causes loss of stepper motor control/power on Ultimaker/A4988/pololu #23454
Comments
Would you be able to test some The strategy is to find a commit from some point in the "distant" past where the feature works. Then, test a commit from halfway between that date and today…. And then you keep going to the commit half-way in between your "known to work" commit and your "known to be broken" commit until you find the exact day where it broke. If you started from a point 256 commits in the past, it would take no more than 8 tests to find the exact commit that broke it. |
I wonder if this is related to that controllers method of setting stepper driver current #define MOTOR_CURRENT_PWM_XY_PIN 44
#define MOTOR_CURRENT_PWM_Z_PIN 45
#define MOTOR_CURRENT_PWM_E_PIN 46
// Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
#ifndef MOTOR_CURRENT_PWM_RANGE
#define MOTOR_CURRENT_PWM_RANGE 2000
#endif
#define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250}
Perhaps this no longer functions after recent pwm changes? |
So… you are suggesting this is a case where pins are sharing a PWM timing, but due to changes related to #define FAST_PWM_FAN // Increase the fan PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
#if ENABLED(FAST_PWM_FAN)
//#define FAST_PWM_FAN_FREQUENCY 31400 // Define here to override the defaults below
//#define USE_OCR2A_AS_TOP
#ifndef FAST_PWM_FAN_FREQUENCY
#ifdef __AVR__
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1))
#else
#define FAST_PWM_FAN_FREQUENCY 1000U
#endif
#endif
#endif Looking at #23331 the only change was to relocate I see also one small change to the - #define E0_AUTO_FAN_PIN 77
+ #define E0_AUTO_FAN_PIN 69 …but I don't see any overlaps with that pin. However, for those upgrading from older Marlin and using this default pin there is bound to be some effect. |
There could be a timer overlap, simply use SOFT_FAN_PWM to see if that the ballpark area. |
What connectors are the part and extruder cooling fan on? |
I think you may be onto a possibility. The pins_ULTIMAKER_2 PWM sets are not matching the schematics connections. PL5 40 -> X Vref The schematic would require the following mapping: #define MOTOR_CURRENT_PWM_XY_PIN 40 |
@thinkyhead, all, I tested past bugfix commits and narrowed the breaking change down to #23048 The previous commit #23050 is working and starting with #23048, the stepper motor issue occurs. |
The extruder cooling fan is attached to PJ6 (J34 connector) in the Ultimaker 2+. I actually have Ultimainboard v2.1.4 that came with the Ultimaker Original+ and is shared by UMO+, UM2, and UM2+ models. From what I have read, the v2.1.1 controller board differs in that the part cooling fan is always on versus controllable in the v2.1.4. UM2+ extrusion upgrade on UMO+ overview Ultimainboard V2.1.4 schematics.PDF |
I tried setting the ultimain2 board pins as you listed for Marlin project state at #23048 and checked the schematic as well. I get the same stepper motor issues with the pin changes. |
Be sure to load defaults in the EEPROM firmware if not already done. |
I believe the issue is related to frequency. The call to set duty for the motor current pin was previously analogwrite() which always defaults to 1000HZ. There is a comment in the area that claims to set the prescaler to 1 but I'm not certain that's working. To isolate this issue please edit the following line, compile and test.
|
@descipher @thinkyhead I took another look at the pin mapping for the Ultimain2 board and the original pin values are actually correct.
The Arduino pin mapping assignment is different from the Atmega2560 pin number for the pins in question. The PJ6 pin mapping that I added in a past pull request does not have an Arduino pin equivalent and I have directly activated PJ6 inside previous contributed code to temp.cpp so I can fix this in my next contribution (ready to push) that improves upon the Ultimaker 2 LCD controller functionality. |
Very good! Right I should have realized the schematic is not using the Arduino pin numbering abstraction. I will put the 2560 on the scope and see what our actual frequency output is and then come up with a proper solution. |
Ok, there is actually three issues here.
PR to resolve these issues is now started. |
@ansonl R you good for testing this? |
@descipher Just tested the commit you posted. The stepper motors move normally now, however there is a loud distinct whine whenever each of the stepper motor axes is powered on even when stopped. Each X Y Z stepper motor makes a buzzing whine when any of them are powered on individually and the sound goes away when "disable steppers" is selected in the menu. I attached video of homing and the sound coming from the controller board. In the video you get to hear 1-2-3 whining sounds overlayed on each other. |
@ansonl Have had exactly that problem on my MKS Robin Lite Board, had to experiment with: To get it working... Asked on the Discord also, but seems like not many know how to calculate the values needed, most people have potmeter on their A4988... So had to guess, no one could explain how to find / calculate "CURRENT_PWM_RANGE" (65535/10/3.3) @descipher Mabye you can explain the process? Both DEFAULT_PWM_MOTOR_CURRENT and MOTOR_CURRENT_PWM_RANGE would be great... |
Odd, that is a 1kHz ringing I think it would be better to default to 31400 for this feature. |
Done. Please retry. |
@descipher Tried the new frequency. Same symptoms and sound. |
Each board will have its own RC charge pump design so those calcs will not apply to the ULTIMAIN2 board.
The circuit formula is shown, 1300 is in mA 1300 * 255 / 2000 = the PWM duty required. |
I think something else is happening, the scope reports 62.5% @ 31kHz using Ramps/ATMega2560 1.4 board. |
@descipher Anyway to contact you directly, cause my question is not related to the Ultimaker 2, but another printer... And would like to do the calculations correct instead of guessing... Have board Schematic + Stepper Specs... So mabye I could ask your expertice? |
Ok, found the issue, it's a conditional. NEEDS_HARDWARE_PWM does not get set. Should have it does later tonight. |
So if it looks like this it is not set right? Can I find that part in the Schematic for the Board, and where to look at it then? BTW have send you an mail.... |
Please retest. |
This may help you see how it works. You can play with the values to see how it is calculated https://www.falstad.com/circuit/ Its a simple voltage divider net that is charged by the PWM signal. |
@descipher Tested the latest change. The stepper motors appear to move normally but I haven't tested a print on it just yet. |
This is the PWM output, this will not be audible. Perhaps there are other reasons, like the PWM duty previously was less accurate and did not drive the motors with the calculated power of X 1300mA,Y 1300mA, Z 1250mA. Notwithstanding that, without the actual device there is no way for me to resolve it further other than what I have done here by validating the required output for the design. |
I previously tested with 1200mA, 1200mA, 1250mA and tried again with X 1300mA,Y 1300mA, Z 1250mA. The noise decreased 1dB on both 2.0.9.2 and your patch. Still louder on the patched code. The latest current values for the Ultimaker should be 1200mA, 1200mA, 1250mA based on this commit from Ultimaker. Does this mean that the frequency code needs to be re-calculated for every future stepper driver power change with the new code versus the previous Arduino |
The altium file may have been opened and saved at a later date, but the ULTIMAIN_2 v2.1.4 was last revised in 2014 on the last schematic page listing revisions. Translated with google: Revisions: |
@descipher So this is the part I'm looking for? Values is this: How to find:
|
I have searched all of 1.1.x in the upstream, I do not see any change to the default value in pins_ULTIMAIN_2. So maybe it was never updated by Ultimaker, you could certainly use the lower current setting they used in 1.x.x. It will be a little slower. |
What driver is it? |
HR4988 |
|
@descipher Like this? If you need the whole Schematic for the board, or the stepper I can mail it to you... |
3.3 v makes more sense now. |
I can't read Chinese, however the typical Polulu 4988 clone has a max peek current of 2A if you have a good head sink you could run 1.3A max but to be safe I would use 2400 as the range. that will be a vRef of about 1.75v which is typical and should result in about 1.1A max |
I was unable to consistently reproduce the increased whine volume so I would consider this fixed for now after incorporating #23463 . Thanks. |
Shouldn't the logic levels of PL3,PL4,PL5 be 5V at high? Some math shows that VREF max (at 100% duty cycle of the aforementioned pins) with a 5V logic high input is 1.16V-suggesting that the theoretical maximum current of the stepper driver can go as high as 2.9A which is absurdly high. A 3.3V input gives a VREF maximum 0.765V which gives a much more reasonable max current of 1.9125A. But at least according to the schematics, the MEGA2560 on the UltimainBoard 2.1.4 is running at 5V-unless I'm missing some magic where it can output 3.3V logic while operating at 5V. |
Correct for the 2560, but the user who posted the question on calc’s is not using the 2560 his board is 3.3v. |
That makes sense now. But it now appears there is a mismatch on the max current range defined in Marlin vs the hardware definition (by the resistors on the Vref and Sense pins) of 2A vs 2.9A. This would cause the drivers to output more current than what the controller thinks (Which would explain why I noticed the steppers are running hotter after I started building Marlin from source over using the Ultimaker's default builds). |
Are you aware that ultimaker reduced the current to 1200mA in their stock builds. They originally used 1300mA. Also the 3.3v guy has a completely different circuit design, his question was off topic. Ultimaker has not updated the Marlin upstream, or at least I have not found one. There is nothing wrong with running faster, just need slightly better cooling than what is on the stock board. |
I was also going off topic and I didn't intend to refer to the 3.3v guy in anyway whatsoever in my previous comment. Yes I was aware that 1200mA was what was originally used, but anecdotally even when I set the 1200mA current in the V2 firmware builds I noticed the steppers were running hotter than before-quite toasty to the touch. I even experimented as going low as ~800mA on the XY steppers to get the motors to run as cool as before. |
Interesting, do you have the most current bug fix-2.0.x? I can certainly recheck those PWM waveforms. What was the version of stock firmware that you observed cooler running A4988’s? |
I'm currently using a 2.0.9.2 (non-bugfix branch) build of Marlin for the ultimain2 board in question. The stock firmware I was referring to is the one for UMO+ https://github.com/Ultimaker/Marlin/tree/Marlin_UM_Original_Plus. I believe that the temperature differences I'm talking about is a symptom of a different issue altogether, it's just that your earlier discussions/posts here confirms my suspicions of the temperature differences. |
@thisiskeithb This one can be closed. :) |
closing @descipher request |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Did you test the latest
bugfix-2.0.x
code?Yes, and the problem still exists.
Bug Description
When compiling a previously working configuration with release 2.0.9.3 and the bugfix-2.0.x on Ultimaker Original Plus (with Ultimaker 2+ extrusion and LCD upgrade), stepper motors have jerky, weak movement and are unusable.
This affects extruder gantry and feeder motors. When homing the stepper motors will barely have enough power/steps to move the extruder head slowly and will sometimes stall in one place resulting in a homing failure (reset). the feeder motor will grind against itself and not move if under tension resistancewith the filament.
I have tested the below configuration files (just need to change the version number) with release 2.0.9.2 and 2.0.9.1 and the printer works fine with the previous release. Only starting with 2.0.9.3 does the stepper motor issue occur.
I am using stock Ulticontroller v2 and UMO+ motors on the printer. According to the Ultimaker schematic the controller uses A4988SETTR-T stepper driver
For example, the feeder motor model is SY42STH38-1684A in the attached spec sheet and the exact same motor performs normally when reverted to Marlin 2.0.9.2.
I recorded a video clip of the printer autohoming on both 2.0.9.2 and 2.0.9.3 so you can see the visible and audible differences.
Marlin 2.0.9.2 - https://youtu.be/vopTKNTfs9E
Marlin 2.0.9.3 - https://youtu.be/rIAoPvyVy4g
Bug Timeline
New bug in 2.0.9.3
Expected behavior
Motors work normally.
Actual behavior
Motors stutter and barely move.
Steps to Reproduce
Use existing configuration on 2.0.9.3
Version of Marlin Firmware
2.0.9.3
Printer model
Ultimaker Original+
Electronics
Ulticontroller v2
Add-ons
Ultimaker 2+ extrusion and LCD upgrade
Bed Leveling
No response
Your Slicer
No response
Host Software
No response
Additional information & file uploads
Configuration.zip
SY42STH38-1684A.pdf
The text was updated successfully, but these errors were encountered: