Skip to content
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] Ramps/Re-Arm losing steps with DRV8825 (layer shifts) #11047

Closed
kAdonis opened this issue Jun 17, 2018 · 169 comments
Closed

[BUG] Ramps/Re-Arm losing steps with DRV8825 (layer shifts) #11047

kAdonis opened this issue Jun 17, 2018 · 169 comments

Comments

@kAdonis
Copy link
Contributor

kAdonis commented Jun 17, 2018

Hi there

With the current bugfix version I experience lost steps on all axes with 8825 Stepper drivers
I tried the versions from June 16. and June 14.
The bugfix version from june 3. works fine
I use a selfmade coreXY printer with 8825 drivers in 1/32 mode on X/Y and 1/16 mode on Z axis, after the update the X/Y motors made a strange noise and when I tried to move in X it also moves Y
I played around with parameters and tried MINIMUM_STEPPER_PULSE 4 which helped, but when printing there are layer shifts on every layer.
I tried different MINIMUM_STEPPER_PULSE values in combination with MAXIMUM_STEPPER_RATE down to 65000 with no luck.
Disabling Linear-Advance helps also, but there are still layer shifts.
Disabling Adaptive Step Smoothing does not change anything

I changed the 8825 Drivers with spare A4988 in 1/16 mode and it prints fine again, but now i could see that the z axis with 8825 drivers also loses steps.

I keep Investigating, but I need help
Thanks in advance

configs.zip

@Bob-the-Kuhn Bob-the-Kuhn changed the title [bugfix-2.0.X] Ramps/Re-Arm losing steps with DRV8825 [bugfix-2.0.X] Ramps/Re-Arm losing steps with DRV8825 (layer shifts) Jun 17, 2018
@Bob-the-Kuhn
Copy link
Contributor

There's a possibility that this is related to the layer shift problem we've been having for a long time. I've changed the title so that people from that thread will look at this one.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 17, 2018

Its possible that it is related, but I didn't had this problem before yesterday.
The Firmware from June 3. is working fine

img_2429
Two testprints with the current firmware

img_2430
the same gcode as above with Bugfix 2.0 from june 3. printed after the parts above, so I know the drivers are still working

@italocjs
Copy link
Contributor

if you are sure that it isnt related to the mechanics / drivers, Try looking at the feedrates, max accelerations and jerk configs, maybe there is something different there

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 17, 2018

I checked feedrate, acceleration and jerk
I can print without problems using the same settings on the unchanged hardware if I upload the firmware from june 3.
The layer shifts also occur when printing very slowly

@p3p
Copy link
Member

p3p commented Jun 17, 2018

Do you have the hardware to check how long the step pulse is? I'l try to get time to look into this, lots has changed in the planner/step generation recently, but I'm not sure what, if anything, has since the 3rd.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 17, 2018

I'm sorry I dont have the hardware for this
And I dont know much about coding, but there are several commits that changed stepper timing since the 3rd
I have time, just tell me what I could test (without special equipment)

@Bergerac56
Copy link

Could it be that the current of the drivers is just too low or too near the limit ? When playing with new versions of Bugfix and 8825's, I experienced also once a "skip" of steps (but not on all axes) and I had to increase it a bit. To test that, I issued G1 on X, Y or Z to move the head along an axe and put a "light" hand in the way of the head to increase a bit the resistance. If skipping steps, I increased a bit the current of this drive.

Perhaps nothing to do with your issue but who knows...

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 18, 2018

I checked the drivers Vref and it is 0.5V, exactly what it should be. This gives me 1A max current for 1,5A motors (67%)
The A4988 drivers I tested with, were also adjusted to 1A and the motors were running fine.

@Bergerac56
Copy link

It was the case for me too. Nevertheless, I had to increase a bit my X and Y axes after the little test explained above.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 18, 2018

Okay, I tried to stop the carriage with my finger with no effect. The motors have a lot of torque.
So the current in fine, but thank you Bergerac

I still suspect the stepper timing is off just a little bit.
The z axis is driven by 3 motors each is connected to its own 8825 driver on an extra board.
All 3 drivers get their Step, Dir and Enable Signals from shared Pins
After some up and down of the z axis, the bed is tilted a little bit, this never happened before.
So the 8825 are individual susceptible to the (supposed) signal error
It might be that the actual step pulse duration is lets say 1.8 us, which is okay for driver 1 but driver 2 catches maybe only 99% of the pulses.
But this is just a guess.
I tried to understand the code in stepper.cpp but I had to give up

@ejtagle
Copy link
Contributor

ejtagle commented Jun 19, 2018

@kAdonis : Try to increase pulse width a bit.
How long are the cables between the main board and the stepper extra board ?... You are probably running into signal integrity issues.... Or ground issues...

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 19, 2018

I tried to increase pulse width up to 5us with no effect.
The cables to the extra board are 10cm long, but the extra board is only for the z-axis. The X/Y drivers are on the RAMPS as usual.
I will try to connect the z motors to only 1 driver directly on the RAMPS and test again.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 19, 2018

Okay, 3 motors are probably too much for one 8825 driver and 12V, so I tested with dual z drivers directly on RAMPS
The issue is still there with pulse width 2us and max stepper rate 250000
I will test with higher pulse width

@ejtagle
Copy link
Contributor

ejtagle commented Jun 19, 2018

Humm...
How many pulses per mm are you using for each of your Z axis ?
I had problems when using 12v and fast step rates. 12v are just insufficient for fast moves...

@italocjs
Copy link
Contributor

ejtagle, noob question, If i use 24v will i be allowed to go faster before the motor stop? I'm trying to increase my 400x400 printer speed, the first step was the volcano hotend, but now i'm looking into faster motion.

@ejtagle
Copy link
Contributor

ejtagle commented Jun 19, 2018

24v allows more precise control of motor coil currents. But, you must be very careful, as most RAMPs do not tolerate such increase of voltage, and if they do, then the problem could be the arduino itself, as it also powers its 5v regulator from that voltage.

The drivers themselves have no problem going up to 30...40volts

@ejtagle
Copy link
Contributor

ejtagle commented Jun 19, 2018

In case of RAMPS/REARM, i dont know, but if the board tolerates being powered from 24v, then i would certainly recommend it.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 19, 2018

On my z axis I have 1600 steps/mm but only 4mm/s max speed, 6400 steps/s, much lower than x and y.
But I have layer shifts even when printing with 30mm/s
With older Marlin versions I could print with 70mm/s, so 12V is not ideal but it works.

@ejtagle
Copy link
Contributor

ejtagle commented Jun 19, 2018

I had reliability problems when moving my Z axis at more than 1mm/s. I have 4000 pulses per mm.
And it is not software. It is hw related.

One of the problems we have now is that the old firmware placed a hidden limitation on the maximum pulse speed ... We removed that limitation (because Arduino is able to keep up without problems at higher speeds. But that seems to be triggering hw problems...

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 19, 2018

I'll reduce the steps/mm on z axis and do more test tomorrow
but X and Y axes are more important

@ejtagle
Copy link
Contributor

ejtagle commented Jun 19, 2018

I have learned that deducing the maximum feedrate for an axis is very complex... It is not enough to test a plain move.
The first step is always to raise the driver current, but then several printing tests must be done to be sure.

@p3p
Copy link
Member

p3p commented Jun 20, 2018

If, as @kAdonis says, it is possible to go back to the June 3rd build and have no problems with the same configuration then we must have changed something that is either reducing the maximum rate he can drive the axis, creating a pulse train his drivers do not like, .. or running the axis harder at the same specified rate. When it's reproducible like that I can't see it just being the hardware even if lowering speeds fixes it.

@ejtagle
Copy link
Contributor

ejtagle commented Jun 20, 2018

I think there was a change... After June 3rd stepper pulse period was fixed. Previously, the pulse period was 8x larger than the desired configured one. That IS a change - The bug only triggered when doing double/quad stepping...

@ruggb
Copy link

ruggb commented Jun 20, 2018

For what it is worth, I have a similar arrangement with high current motors and 8825s. Some time ago I stumbled upon some flyback diode boards on AliExpress, They were cheap so I decided to try them.
I absolutely could not believe the change. At that point I realized much of my artifacts on the prints were a result of missing steps. No more missing steps and noise decrease significantly.
Everybody should use them.

@teemuatlut
Copy link
Member

@ejtagle Were you able to scope the pulse width when making the changes? Because if you didn't I can take a quick look.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 20, 2018

update:
The printer prints fine with pulse width set to 5us and a max stepper rate of 140000 kHz( dont know if this rate makes sense)
I tried 4us pulse width and had again layer shifts.
8825 Drivers on X/Y and z axis
z axis still powered by dual z drivers on RAMPS
I think I could identify the "worst" (of 5) drivers and dont use it at the moment.
Initially (see first post) 5us didnt work, but this test included the "worst" driver.

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 20, 2018

I dont wanted to give up my extra board easily, because (I think) its cleaner to use one driver per motor.
So I tried again with three A4988 Drivers for the z axis installed on the extra board to be save from step losses.
Still using 8825 driver in 1/32 mode for X/Y
I used again a pulse width setting of 5us and and a max stepper rate of 140000 kHz
It prints fine!
So there are no signal integrity or ground issues, at least not obvious.

I'm really curious how long the pulse actually is?

Update : There are still layer shifts

@ejtagle
Copy link
Contributor

ejtagle commented Jun 20, 2018

@teemuatlut : I didn't scope the pulse width yet. I have the hardware required to do it, but as printig was and is working pretty well (using 2uS pulses on DRV8845) so i didn´t do it.

kAdonis: Try the following: Use a HEAVY copper wire (2.5mm^2 or even more) to join the ground of your external board with the ground of RAMPS/ReARM.

Also, place 2 capacitors in parallel between GND and +V of your external board, AT the external board connector. One of the capacitors should be 1000uF/25v (or more), the other one should be 100nF ceramic disc

@kAdonis
Copy link
Contributor Author

kAdonis commented Jun 20, 2018

@ejtagle Thank you for the advice with the capacitors
But I need 5us pulse width even with the external board disconnected
Do you mean 8845 drivers or 8825?
Are yours from Pololu? My 8825 are cheap chinese ones

@Matou25
Copy link

Matou25 commented Oct 6, 2019

Hi,

I mount my news tmc2130 with external board
Now wall are straight no more layer shift. so my issue is marlin's DRV8825 management.

@karabas2011
Copy link

The same problem with sbase
defalt settings 250000 2us

@Stephane-80
Copy link

+1

@ruggb
Copy link

ruggb commented Oct 9, 2019

I'm curious, has anyone with this problem tried installing the flyback diodes???

@italocjs
Copy link
Contributor

italocjs commented Oct 9, 2019

@ruggb i did, it did not help. both with 4 and 8 diodes versions.

@Matou25
Copy link

Matou25 commented Oct 9, 2019

I'm curious, has anyone with this problem tried installing the flyback diodes???

HI,

i try flyback diodesbut it was the same result
I tweak my mks board to enable fast decay on DRV8825 but no change

with smoothieware no pb with or without diode and fast decay

@ruggb
Copy link

ruggb commented Oct 9, 2019

interesting since it worked on my ramps board with 8825 drivers. What could the difference be? I do have some powerful steppers, about 70 (whatever that is, I only remember the number at this point).

@boelle
Copy link
Contributor

boelle commented Nov 3, 2019

@kAdonis many updates have passed, is this still an issue on latest 2.0.x?

@petermccracken
Copy link

Yes, it is still an issue, it would seem the only way to eliminate it is to use the settings above from kadonis....

"The printer prints fine with pulse width set to 5us and a max stepper rate of 140000 kHz( dont know if this rate makes sense)"

... I implemented those settings in the advanced config and the issue instantly disappeared. I am using MKS SBASE 1.2.

Thanks!

@boelle
Copy link
Contributor

boelle commented Nov 12, 2019

"The printer prints fine with pulse width set to 5us and a max stepper rate of 140000 kHz( dont know if this rate makes sense)"

I implemented those settings in the advanced config and the issue instantly disappeared

the above seems to fix the issue, hence its more a config issue and not firmware issue

@boelle boelle closed this as completed Nov 12, 2019
@p3p
Copy link
Member

p3p commented Nov 12, 2019

hence its more a config issue and not firmware issue

Well .. it is a firmware issue in that the default config value doesn't work, but 32bit timing issues in the stepper ISR are an ongoing investigation so setting higher pulse duration is currently the best solution even though 2us(+abit) should be the correct setting for DRV8825.

The timing discrepancy should only be in the ns range though so why people seem to need to go as high as 5us I don't know, unless the drivers don't actually work close to the minimum pulse duration the datasheet says.

@kAdonis
Copy link
Contributor Author

kAdonis commented Nov 12, 2019

I think this should be reopened
The bug is still there, there's only a workaround found

@boelle
Copy link
Contributor

boelle commented Nov 12, 2019

we need to figure out if its a bug as such or if default config is wrong

and there is also the problem if the drivers work with the pulse the datasheet says, how can we make a default if datasheets are not true?

@kAdonis
Copy link
Contributor Author

kAdonis commented Nov 12, 2019

The Problem here is, that under some circumstances, the actual step pulse duration is shorter than the configured step pulse time. p3p (and me) measured step pulse times as low as 1690ns with configured step pulse time of 2000ns, this is too low for the DRV8825 drivers to work reliably.
So you have to manually override the (theoretically correct) default setting, with longer Step pulse settings to get correct actual step pulse times
The datasheets are fine but marlin code is not

@boelle
Copy link
Contributor

boelle commented Nov 12, 2019

i agree, if we can trust the default config actually ouput 2000ns then there is a problem

@shitcreek or @thinkyhead should look at this

@boelle boelle reopened this Nov 12, 2019
@Bergerac56
Copy link

Having the feeling that issue #11205 is related, I retested with a step pulse of 2us to 5us
In the case S_CURVE_ACCELERATION, JUNCTION_DEVIATION (or the new setup for this option), ADAPTIVE_STEP_SMOOTHING and LIN_ADVANCE_ are activated (or at least more than 2 of those functions), the results are wrong with a stepper pulse of 2us and correct with a stepper pulse of 3us or above.
In my case, the correct value is between 2us and 3us. As we cannot input floating point values for stepper pulse, 3us is the adequate value on my MKS SBASE. No need to go to 4us or above. This goes in the direction of what @p3p said above ("so setting higher pulse duration is currently the best solution even though 2us(+abit)") and the fact that the issue is the way marlin is handling this.

@sjasonsmith
Copy link
Contributor

@kAdonis, I just posted a link on issue #11205 to a branch with an experimental change to resolve the short pulses. It isn't a fully complete solution. More work will be needed to make it acceptable across all devices, but it could be worth trying. If it does resolve the issue that could inform possible fixes for this.

@p3p and I were discussing this issue earlier. The pulse lengths are actually much worse than have already been mentioned in this issue. I saw pulses as low as 856ns when a 2us pulse was intended.

@boelle boelle changed the title [BUG] [bugfix-2.0.X] Ramps/Re-Arm losing steps with DRV8825 (layer shifts) [BUG] Ramps/Re-Arm losing steps with DRV8825 (layer shifts) Dec 5, 2019
@dark184
Copy link

dark184 commented Dec 15, 2019

Hello. I apologize for my English. I seem to have encountered the same bug on MKS sBase v1.3. I print through OctoPrint, connected directly to the AUX1 connector. Printserver Octoprint is installed on OrangePi PC+. On advice sjasonsmith (#16218 (comment)) i configured MINIMUM_STEPPER_PULSE 4. The seal more less normalized. Does this mean that I faced the same bug in the firmware?
If this is indeed the case, do you need any help to fix this bug? Since I program only at the initial level, I can only help in testing fixes on hardware. I just need instructions on what to do.
I have a BigTreeTech SKR v1.3 Board with drv8825 stepper motor drivers. There is also a working MKS TFT and MKS sBase v1.3 installed on the printer. There's also a Logic Analyzer that works with 3.3 volt levels. I do not have a debugger for LPC1768, there is only STlink v2.
My configuration for Marlin 2.0.x
MarlinConfig.zip

@sjasonsmith
Copy link
Contributor

@dark184, at this point I don't need any help with debugging, but as I make edits to PR #16128 help verifying the changes would be welcome. I expect to spend more time improving that PR in the next few days.

@sjasonsmith
Copy link
Contributor

PR #16128 has been merged into bugfix-2.0.x. This definitely fixed timing issues impacting 8825 drivers on 32-bit controllers, but probably fixes sporadic issues elsewhere as well.

It would be great for people to test the latest bugfix-2.0.x to see if issues remain. I recommend you remove any custom MINIMUM_STEPPER_PULSE or MAXIMUM_STEPPER_RATE to be sure you are testing the fix, and not working around issues in other ways.

@Bergerac56
Copy link

@sjasonsmith Wel done Jason !
Based on the last bugfix (e3b0275) and removing all work arrounds, I made 2 test prints with all the options creating issues in #11205. No problem. Test modules are just as expected.

Thanks a lot

@kAdonis
Copy link
Contributor Author

kAdonis commented Dec 20, 2019

I dont have the hardware to test myself, but the issue seems solved
Thanks to all contributors, I will close this now

@kAdonis kAdonis closed this as completed Dec 20, 2019
@github-actions
Copy link

github-actions bot commented Jul 3, 2020

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests