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] Linear Advance K Calibration Print stops extruding #16076

Closed
stantond opened this issue Dec 2, 2019 · 164 comments
Closed

[BUG] Linear Advance K Calibration Print stops extruding #16076

stantond opened this issue Dec 2, 2019 · 164 comments

Comments

@stantond
Copy link

stantond commented Dec 2, 2019

Bug Description

Using Marlin 1.1.9-bugfix on an Ender 3 Pro with Creality 1.1.5 board.
Created GCODE for calibrating Linear Advance 1.5 using http://marlinfw.org/tools/lin_advance/k-factor.html
The first test line prints, then the extruder stops.

==========The following text is additional information the Marlin Team did not want to get lost ==============

When using StealthChop, the motion should not start with a high frequency,
but the stepper motor has to accelerate softly. A high frequency start and
subsequent stop will lead to:

  1. Current regulated up to a high value, as a high back EMF is anticipated.

  2. When stopping the motor again (no further pulses) the high current is kept
    for some time. This can lead to motor overcurrent and the dnver thus disabling.

To solve:
Accelerate the motor slowly. The first and last step pulses of a motion
therefore have to have a higher distance.

The TMC drivers have a step filter (per default enabled by GCONF.8) to cope
with uneven step pulses occurring as bursts of 2-4 steps generated by
software pulse generators, but the filter needs roughly 32 microsteps to
(fully) adapt to the initial velocity of a ramp.

Follow up questions:

Q: Would it be right to think that the motor supply voltage, motor coil
resistance and motor coil inductance will all affect whether the overcurrent
condition occurs?

A: Yes.

Q: How do VREF and IHOLD_IRUN affect things? e.g. will a lower current setpoint
make it more likely that the over-current condition will be triggered?

A: A higher current setting (as controlled by IRUN and VREF) will make it
more likely to trigger overcurrent detection in case of the fast step pulses.

Q: What register/flag could we read from the UART to find out whether this
overcurrent condition has occurred? e.g. would it be something like the
s2vsa, s2vsb, s2ga or s2gb flags in DRV_STATUS?

A: Correct, a short condition will be signalled in DRV_STATUS and in GSTAT.

My Configurations

Required: Please include a ZIP file containing your Configuration.h and Configuration_adv.h files.

Linear Advance 0 to 2 kfactor.txt .gcode

Configuration.txt .h

Configuration_adv.txt .h

Steps to Reproduce

  1. Generate GCODE using the online tool
  2. Print it
  3. Watch the extruder

Expected behavior: [What you expect to happen]

The extruder extrudes and the full print prints.

Actual behavior: [What actually happens]

The first test line (K=0) prints.
The plastic thins out over the next two lines to nothing, and the extruder stops turning entirely.

  • Provide pictures or links to videos that clearly demonstrate the issue.

IMG_20191202_153924

@Grogyan
Copy link
Contributor

Grogyan commented Dec 2, 2019

Please try Marlin 2.0

@shitcreek
Copy link
Contributor

shitcreek commented Dec 2, 2019

Marlin 1.1.9 is no longer actively worked on. Please try 2.0.

I don't see anything that stands out in your config and gcode files. Has the bed been leveled? How exactly does it stop? Like does it continue to try and complete the job except with zero extrusion or does it end the job after the 3rd line? Have you tried doing 0.1 K factor stepping and see if it will produce more lines? Try enabling LA_DEBUG and check the outputs.

@stantond
Copy link
Author

stantond commented Dec 2, 2019

The bed is pretty level as it is, but there's also a G29 in the print GCODE.

It continues and completes the print job, but it stops extruding and doesn't continue. The photo shows a "finished" print.

I can try 0.1 stepping tomorrow, although I suspect it stops as soon as K >0.

How do I use LA_DEBUG? I usually use with Octoprint.

@shitcreek
Copy link
Contributor

I haven't used Octoprint so I don't know with that. You need to connect to the machine via USB. You could use repetier, adruino ide or whathaveyou. LA_DEBUG must be enabled in your configuration first and your machine reflashed - you might as well upgrade to 2.0 :D

@boelle
Copy link
Contributor

boelle commented Dec 3, 2019

@stantond did you try 2.0.x ?

@Strahler85
Copy link

Could it be, that the 1.1.5 creality board is the silent board with the tmc 2208 on all axis in standalone and stealthchop mode?
As far as a I know, LA does not work with tmc 2208 standalone at Extruder Motor in stealthchop Mode.

@thisiskeithb
Copy link
Member

How do I use LA_DEBUG? I usually use with Octoprint.

There's a terminal tab in OctoPrint which is where you'll watch/send commands:
image

@boelle
Copy link
Contributor

boelle commented Dec 4, 2019

closing this one until we hear back from @stantond

as said above 1.1.9 is no longer active worked on, please use 2.0.x

@boelle boelle closed this as completed Dec 4, 2019
@stantond
Copy link
Author

stantond commented Dec 4, 2019

As far as a I know, LA does not work with tmc 2208 standalone at Extruder Motor in stealthchop Mode.

@Strahler85 I'm using the Creality 1.1.5 board, and I believe it does use 2208 drivers in stealthchop mode for all motors. Do you know of there's a way to change the mode for the E driver?

@boelle of the above is true, this issue will affect any version of Marlin using this board

@boelle boelle reopened this Dec 5, 2019
@shitcreek
Copy link
Contributor

In 2.0, you can disable stealthchop for each stepper in configuration_adv.h ie #define STEALTHCHOP_E

@boelle boelle changed the title [BUG] Linear Advance K Calibration Print stops extruding - Marlin 1.1.9-bugfix [BUG] Linear Advance K Calibration Print stops extruding Dec 6, 2019
@boelle
Copy link
Contributor

boelle commented Dec 7, 2019

i cant reproduce and i think the difference is that i dont use stealthchop on the extruder

https://github.com/boelle/Marlin/tree/Mendel90

i use drv8825 for the extruder and that is why i know, for everything else i use tmc2100

will close this one as it most likely a config issue and not a bug as such

@boelle boelle closed this as completed Dec 7, 2019
@stantond
Copy link
Author

stantond commented Dec 7, 2019

Hopefully I'll have time to do some more testing on this next week. Looks like M569 was introduced in Marlin 2.0, so I'll start there.

I'd suggest that if it is a configuration issue, it's a "bug" in the documentation - if it's a known and understood issue that can be resolved with a config change, adding it to the docs so that the next poor sod to get stuck can find a fix rather than spend hours messing about and trawling closed issues would be a useful "fix", right?

@boelle boelle reopened this Dec 7, 2019
@boelle
Copy link
Contributor

boelle commented Dec 7, 2019

that's an arguement i can use, so yes, documentation should be improved if it turns out that you cant use stealthchop on the extruder

@Vertabreak
Copy link
Contributor

i have tmc2208 in stand alone running marlin 2.0 and linear advance function perfectly i ran the calibration 10x yesterday and i use linear advance daily.

@stantond
Copy link
Author

stantond commented Dec 12, 2019

I've just installed Marlin 2.0, with almost identical settings.

M569 isn't working (Unknown command: "M569"), so I've obviously missed something. I've subsequently installed the TMCStepper library as specified here, but I've been staring at the page for a good few minutes and can't figure out what setting I need to enable to include the library when compiling to get M569 working. Which settings do I need?

@thisiskeithb
Copy link
Member

I've just installed Marlin 2.0, with almost identical settings.

Can you post updated configs? Just zip them up into a single .zip and attach it and we can verify your settings. I'm guessing you didn't enable TMC2130 for the driver type, so M569 isn't enabled.

Also, PlatformIO should download TMC libraries for you without having to install anything if you're using VSCode.

@stantond
Copy link
Author

I tried defining some Stepper Drivers as TMC2208 and got compiler errors (using Arduino IDE, no idea what PlatformIO is).

Files attached.
Marlin.zip

@boelle
Copy link
Contributor

boelle commented Dec 13, 2019

no idea what PlatformIO is

try it

@stantond
Copy link
Author

no idea what PlatformIO is

try it

I'm sure it's great, but I'd rather fix what I can without adding more variables to the mix. Maybe when this issue is resolved.

I tried defining some Stepper Drivers as TMC2208 and got compiler errors

Changed to TMC2208_STANDALONE and it compiles OK. I get the feeling that the Creality board is fixed in standalone mode for all drivers, as they would have just dropped in the new drivers to replace the old rather than design and manufacture a new PCB. Will test this over the weekend.

@thisiskeithb
Copy link
Member

I get the feeling that the Creality board is fixed in standalone mode

You are correct.

@stantond
Copy link
Author

Having set the drivers to "TMC2208_STANDALONE", M569 still doesn't work. Is that expected?

@stantond
Copy link
Author

Tested K calibration print again, now on Marlin 2.0 with drivers set to TMC2208_STANDALONE, which is the only option for TMC drivers on the Creality/Melzi "Silent" boards v1.1.4 and v1.1.5.

Same result. Prints the first line where K=0, then extruder stepper stops, but print tries to continue as normal, unaware of the failure.

@ManuelMcLure
Copy link
Contributor

M569 depends on a UART or SPI connection to the driver to change stepping mode, so there's no way for it to work with a ''TMCXXXX_STANDALONE`` driver. I think if your 2208s are soldered to the board you're out of luck and will be unable to change them to SpreadCycle.

@stantond
Copy link
Author

The problem isn't M569 - it's just a means to an end. I'm trying to establish whether or not Linear Advance is compatible with StealthChop. At this point, I suspect not, and recommend the docs be updated, unless anyone else is able to further test this.

@WireBe
Copy link

WireBe commented Dec 16, 2019

@stantond I would try this:

/**

  • Beta feature!
  • Create a 50/50 square wave step pulse optimal for stepper drivers.
    */
    #define SQUARE_WAVE_STEPPING

/**

  • Enable M122 debugging command for TMC stepper drivers.
  • M122 S0/1 will enable continous reporting.
    */
    #define TMC_DEBUG

@darkyp
Copy link

darkyp commented Apr 10, 2021

Sharing some info for anyone that might be using the Creality v4.2.7 board...

After submitting #21463 I did further testing. At some time I got the E stepper stopping. So I decided to follow https://drive.google.com/file/d/15cUf10lMxW4NUHE9qVAlamXmULdrOJxz/view and try to apply it to my Creality v4.2.7 board, the hardware path. I must have omitted the fact that the v4.2.7 uses TMC2225. I was successful in making the driver switch away from StealthChop - soldered a wire from PA3 (software RX and TX UART) to the closer to the driver end of R52. Yes, R19 is another pulling resistor as opposed to the v4.2.2 board. However, while the driver was accepting the settings, I got the TMC COMMUNICATION ERROR. I removed the heatsink from the driver and that is when I remembered I read somewhere it was a TMC2225. It turns out pin 17 (UART) and pin 18 (DIAG) are shorted together (via a trace) and pulled high via R52. Not sure why Creality did it that way. DIAG is an output, why pull it up? So I lifted pin 18 whose signal is not used anyway and then I got the stepper communicating properly and I'm happy using linear advance now. Another alternative to lifting pin 18 is to cut the PCB trace that connects pin 17 to pin 18.
I had to adjust the current from 650mA to 850mA (from the Ender 3 Pro LCD menu) as occasionally (without linear advance) I got some missing steps, still this might be due to my current setup.

Another point to mention - TMC2225 has a pin 19 (SPREAD) that toggles the chopper mode selection. It is pulled low on the v4.2.7 board via R48. So removing R48 and pulling pin 19 high should also work for disabling StealthChop.

Reggi3 referenced this issue in Jyers/Marlin May 9, 2021
@MicroDoser
Copy link

Arrived here after finding this issue with my CR10S Pro V2 although for me initially the prints seemed to work without a problem with all lines being printed (K0-2 step 0.2), and it was only when fine-tuning (steps<0.2) that the printer stopped extruding. After reading the thread, it seems that a hardware hack is the fix to the problem. Doesn't seem difficult, but I'll leave that until it becomes necessary.

@corecell
Copy link

https://drive.google.com/file/d/15cUf10lMxW4NUHE9qVAlamXmULdrOJxz/view

There's actually a nice guide on how to enable UART on E stepper for Ender board v4.2.2 I've found on Reddit here.

UPD: Just applied to my Ender 3 V2. Works like a charm with latest Marlin.

I tried this mod today, but something wrong with code. If i change driver type from TMC2209_STANDALONE to TMC2209 for extruder, device stuck with blank screen, no logo, only backlight and working fans. -DHAVE_SW_SERIAL appended, UART pins assigned. I have stlink, but i don't have time to debug :(

Ender 5 Pro, STM32F103RET6 board V4.2.2, Marlin 2.0.9.2

@Alyxxik
Copy link

Alyxxik commented Jan 28, 2022

Another point to mention - TMC2225 has a pin 19 (SPREAD) that toggles the chopper mode selection. It is pulled low on the v4.2.7 board via R48. So removing R48 and pulling pin 19 high should also work for disabling StealthChop.

probably incorrect thread and all since i use Klipper.
But you saying there is a chance, i can use this to switch drivers to SpreadCycle and make the board usable with CoreXY kinematics? (StealthChop is for Corexy pure pain in the ass for me so far, SKR 1.4, TMC2209 and StealhChop is louder then SpreadCycle, with 4.2.7. moves over 120 mm/s are not-good-sounding)

I have 4.2.7. schematics (random find), and this "simple" mod would save me purchase of a new board.
Screw the UART for know (its benefits are nice, but make fast moves is now my goal) my Ender 5+ worked without it before switch to CoreXY, it would work after that... But that SpreadCycle is basically a must at this point.

@masterxq
Copy link

masterxq commented Feb 15, 2022

https://drive.google.com/file/d/15cUf10lMxW4NUHE9qVAlamXmULdrOJxz/view
There's actually a nice guide on how to enable UART on E stepper for Ender board v4.2.2 I've found on Reddit here.
UPD: Just applied to my Ender 3 V2. Works like a charm with latest Marlin.

I tried this mod today, but something wrong with code. If i change driver type from TMC2209_STANDALONE to TMC2209 for extruder, device stuck with blank screen, no logo, only backlight and working fans. -DHAVE_SW_SERIAL appended, UART pins assigned. I have stlink, but i don't have time to debug :(

Ender 5 Pro, STM32F103RET6 board V4.2.2, Marlin 2.0.9.2

I think this is related to this bug. Had the same Problem. Compiling with libmaple works. Maybe it causes other issues, but can not say much about this...
#22905

For sharing my experience:
I have the Ender 5 Pro with creality v4.2.2 Mainboard.
Using Marlin v2.0.9.3
I did the Hardware hack (PA3 RX+TX <-> TMC2208).
It reports back: stealthChop false
The calibration print of linear advanced completed without issues.
But the Extruder is loosing steps and has not much power on normal prints. Nothing is getting hot or even warm. My setting for the E0 current is: 940. Tried values between 800 and 940 mA.

It is still possibly that I have some problems in my configuration.

M122
                E
Enabled         true
Set current     930
RMS current     917
MAX current     1293
Run current     29/31
Hold current    14/31
CS actual       14/31
PWM scale
vsense          1=.18
stealthChop     false
msteps          32
interp          true
tstep           max
PWM thresh.
[mm/s]
OT prewarn      false
triggered
 OTP            false
pwm scale sum   16
pwm scale auto  0
pwm offset auto 36
pwm grad auto   14
off time        4
blank time      24
hysteresis
 -end           2
 -start         1
Stallguard thrs
uStep count     276
DRVSTATUS       E
sg_result
stst
olb
ola
s2gb
s2ga
otpw
ot
157C
150C
143C
120C
s2vsa
s2vsb
Driver registers:
                E       0x80:0E:00:00

I have no idea why my extruder is missing steps. It just feels like it not working on the set current limitation (nothing is warm, but I think it should with 940 mA)...

What I did:

  • Checked the nozzle
  • Check if extruder gets warm
  • Run M911 (No alert)
  • Calibrated the extrusion
  • Scaled the extrusion down
  • Checked M122 while printing
  • Setting K value in the slicers start code

What I really wonder about: Even with downscaled extrusion and many lost steps I still get a complete print. But I triple checked the extrusion amount. But I will do again... I don't get it...
Retry done:
If I go scale down the flow to 50% I kinda stop losing steps and get a valid print result. But if I move E0 by 100 mm filament moves just 50 mm... I did set microsteps to 16 to avoid issues when the mode switches silently, so this is not what happen there...

I also tried to solder PB2 with 1K resistor as my TX pin. After this I could not read status from TMC driver. Maybe I need pins on the same port, the problem can be in marlin, the 10K pull resistor still activ, maybe there is a problem with the signal level (22K recommended in the datasheet of TMC2208) or it is not working because it's the boot1 pin (what should not care much). I don't know.
The connection has been checked with a multimeter (997 Ω)… I did not test other pins.

Possibly some of you can answer some of my questions:

  • Why am I getting a report from the driver with a single wire interface. Is the SW UART pin just changing direction after sending some data? Do we risk conflicting signals?
  • After a restart of the printer the ID of the stepper changes. Is this randomly generated or are there problems in the communication? (Eg: 0x80:0E:00:00 -> 0x80:1D:00:C0)
  • Are all values of the M122 report coming over the UART connection or does it also show predefined values from the configuration? (Which possibly are not synchronized correctly)
  • Why does the PB2 as SW UART TX not work?
  • Any thought why I am losing these steps? (Could trace it back to the CURA slicer)
  • Is the initiation in UART mode complete and do I need to activate it somewhere in the Marlin firmware?
  • What does the hysteresis do? In other outputs I read somewhere END value was smaller than START value.
  • Are there issues with libmaple and stm32f1?
  • As long as I understood I can set the mode of the drivers permanently in the OTP using a temporally UART connection or alternative set the mode with the UART in runtime until the next power cycle applies (as I'm trying). Is this correct?
  • Any other thoughts?

Edit:
After some work, the printer is now able to print without losing many steps. It was mainly the slicer that was responsible for the lost steps. It is still losing some few steps, possibly this is caused by bad filament.
The correction effect on the corners is not that good as I expected sadly. But it still has fixed a problem I didn't want to address: In the past there has been holes in the object sometimes in areas where the head could move fast. This has been fixed completely with the linear advanced feature. The printer will now go back into production again and the quality will be evaluated over time.

Regards!

@rubberduck09
Copy link

Why closing this issue? Is it fixed?

@thinkyhead
Copy link
Member

🤷🏻 This issue is stale.

Please test the bugfix-2.0.x branch to see where it stands. If the issue isn't resolved yet, then someone may investigate further.

@thisiskeithb
Copy link
Member

thisiskeithb commented Apr 21, 2022

TMC2225/TMC2208s shutdown with LA enabled and this hasn’t been fixed yet.

It’s a long-standing issue with these drivers.

I’ve also seen this issue manifest itself with 5160s on a recent build.

@thisiskeithb thisiskeithb reopened this Apr 21, 2022
@tiagofreire-pt
Copy link

TMC2225/TMC2208s shutdown with LA enabled and this hasn’t been fixed yet.

It’s a long-standing issue with these drivers.

I’ve also seen this issue manifest itself with 5160s on a recent build.

I'm facing the same issue with my Ender 3 S1 (STM32F4).

Even with K value set to 0 in the firmware.

@thisiskeithb
Copy link
Member

Our Linear Advance woes with TMC2208s/TMC2225s may finally be over.

Please test #24533 and report your hardware config + findings in that PR.

@github-actions
Copy link

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 Sep 20, 2022
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