Skip to content

Commit

Permalink
Jyers Gets Linear Advance
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyers committed May 5, 2021
1 parent dc7fa7c commit ecb49cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 7 additions & 5 deletions Configuration Files/Jyers's Config/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE TMC2208_STANDALONE
#define E0_DRIVER_TYPE TMC2208
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
Expand All @@ -754,6 +754,8 @@
//#define E6_DRIVER_TYPE A4988
//#define E7_DRIVER_TYPE A4988

#define TMC_UART_PIN_E PA13

// Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
#define ENDSTOP_INTERRUPTS_FEATURE
Expand Down Expand Up @@ -800,7 +802,7 @@
* Override with M92
* X, Y, Z, E0 [, E1[, E2...]]
*/
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 100 }
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 104.5 }

/**
* Default Max Feed Rate (mm/s)
Expand Down Expand Up @@ -884,7 +886,7 @@
*
* See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained
*/
#define S_CURVE_ACCELERATION
//#define S_CURVE_ACCELERATION

//===========================================================================
//============================= Z Probe Options =============================
Expand Down Expand Up @@ -1056,7 +1058,7 @@
* | [-] |
* O-- FRONT --+
*/
#define NOZZLE_TO_PROBE_OFFSET { -45.5, -8,- 3.06 }
#define NOZZLE_TO_PROBE_OFFSET { -45.5, -8, -2.86 }

// Most probes should stay away from the edges of the bed, but
// with NOZZLE_AS_PROBE this can be negative for a wider probing area.
Expand Down Expand Up @@ -1482,7 +1484,7 @@
//#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh

#define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed
#define GRID_MAX_POINTS_X 15 // Don't use more than 15 points per axis, implementation limited.
#define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited.
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X

//#define UBL_HILBERT_CURVE // Use Hilbert distribution for less travel when probing multiple points
Expand Down
16 changes: 8 additions & 8 deletions Configuration Files/Jyers's Config/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@
*
* See https://marlinfw.org/docs/features/lin_advance.html for full instructions.
*/
//#define LIN_ADVANCE
#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
Expand Down Expand Up @@ -2407,7 +2407,7 @@
#define INTERPOLATE true

#if AXIS_IS_TMC(X)
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
#define X_CURRENT 850 // (mA) RMS current. Multiply by 1.414 for peak current.
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
#define X_MICROSTEPS 16 // 0..256
#define X_RSENSE 0.11
Expand All @@ -2425,7 +2425,7 @@
#endif

#if AXIS_IS_TMC(Y)
#define Y_CURRENT 800
#define Y_CURRENT 780
#define Y_CURRENT_HOME Y_CURRENT
#define Y_MICROSTEPS 16
#define Y_RSENSE 0.11
Expand All @@ -2443,7 +2443,7 @@
#endif

#if AXIS_IS_TMC(Z)
#define Z_CURRENT 800
#define Z_CURRENT 850
#define Z_CURRENT_HOME Z_CURRENT
#define Z_MICROSTEPS 16
#define Z_RSENSE 0.11
Expand Down Expand Up @@ -2487,7 +2487,7 @@
#endif

#if AXIS_IS_TMC(E1)
#define E1_CURRENT 800
#define E1_CURRENT 990
#define E1_MICROSTEPS E0_MICROSTEPS
#define E1_RSENSE 0.11
#define E1_CHAIN_POS -1
Expand Down Expand Up @@ -2616,7 +2616,7 @@
*/
#define STEALTHCHOP_XY
#define STEALTHCHOP_Z
#define STEALTHCHOP_E
//#define STEALTHCHOP_E

/**
* Optimize spreadCycle chopper parameters by using predefined parameter sets
Expand All @@ -2633,7 +2633,7 @@
* Define your own with:
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
*/
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
#define CHOPPER_TIMING CHOPPER_DEFAULT_24V // All axes (override below)
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
Expand Down Expand Up @@ -2759,7 +2759,7 @@
* Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting.
*/
//#define TMC_DEBUG
#define TMC_DEBUG

/**
* You can set your own advanced settings by filling in predefined functions.
Expand Down

39 comments on commit ecb49cb

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jyers

Is this commit related to the hardware mod that you have to solder a wire between extruder stepper driver pin and the microcontroller in order to work?

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether or not you need the mod depends on exactly which drivers your board came with. The TMC2209 doesn't need the mod. http://support.th3dstudio.com/hc/guides/community-guides/creality-v4-2-x-board-driver-codes/

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 4.2.7 is always TMC2225 I believe (different IC footprint, not interchangable), but my 4.2.2 came with TMC2209s

@msdossajo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy that's a very interesting information, my 4.2.2 is marked "B" and I was able to use LA without the MB modification (but the extruder stepper motor become very noisy). Now I've done the MB modification, still can use LA and the stepper motor is very quiet, however I get the "TMC Connection erro" and having a BMG clone extruder I had to double the steps to 796 (usually around 415), I believe that the driver changed from 16 to 32 steps.
I still have plans to hijack another pin to fix the "TMC connection error" probably I will remove one of the heatsinks to confirm the driver model.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether or not you need the mod depends on exactly which drivers your board came with. The TMC2209 doesn't need the mod. http://support.th3dstudio.com/hc/guides/community-guides/creality-v4-2-x-board-driver-codes/

And i wondered what the heck those pencil number on the SD card means. haha.
My 4.2.2 had TMC2209 but i toasted it.
Replaced with a 4.2.7 and it has the TMC2225.
So i should consider doing the mod.

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fact LA worked at all without modification + the B marking makes it certain that you have the TMC2209 @msdossajo - I wouldn't suggest removing the heatsinks, thermal epoxying them back on is a pain.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone has a detailed photo about the stepper driver pin that we must solder the wire ?

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modded my E TMC2225 into Spread Cycle mode with a tiny jumper wire and that let me use LA and have more consistent extrusion and higher torque, at the cost of some noise due to losing StealthChop.

For 4.2.2 board the pin to solder is
image
that was required for TMC2208

I didn't take a photo of my TMC2225 SpreadCycle mod apparently

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy
i supposed that the same applies for the 4.2.7 board. Right?

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 4.2.7 board is quite different, the TMC2225 package is a different footprint. I did not bother trying to get my TMC2225 into UART mode, I just put it into SpreadCycle as that's all I needed to change.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy
Wait... What do you mean by that? If you put it in SpreadCycle you dont need the mod?
And if yes What change do i have to make in the firmware ?

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The steppers are in standalone mode so you need to solder to get it into SpreadCycle mode. The original 4.2.2 TMC2208 mod puts the driver into UART mode where then the firmware can set it into SpreadCycle/hybrid mode and thus use LA.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy
ok i got it.
So in conclusion for the 4.2.7 board solder must be done. And i supposed that the pin must be the same.... To the R19 pull resistor.

@tome9111991
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngleV Yes, you need the mod for V4.2.2 or V4.2.7 (with TMC 2225). I never see a v4.2.7 with TMC 2209 for Ender3V2...

I have read with Klipper LA will work without mod

@Jyers
Copy link
Owner Author

@Jyers Jyers commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use that outdated mod, soldering directly onto that chip is a pain and not necessary. Check my post here for what I did: #707

@tome9111991 Klipper can brute force it because is uses the pi to do all the processing, Marlin doesn't have that luxury

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jyers

I know about the "free pins" in the SWDIO pin as a few months now i have use on of them to power off the extruder fan when temperature is below 50 degrees celsius.

#define E0_AUTO_FAN_PIN PA13

thanks anyway

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jyers

I know about the "free pins" in the SWDIO pin as a few months now i have use on of them to power off the extruder fan when temperature is below 50 degrees celsius.

#define E0_AUTO_FAN_PIN PA13

thanks anyway

Any chance that you can share your circuit design? I'm sure a lot of people would appreciate seeing how you did your mod?

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy
ok i got it.
So in conclusion for the 4.2.7 board solder must be done. And i supposed that the pin must be the same.... To the R19 pull resistor.

Not necessarily, if someone has managed to enable LA using the spread pin on the 4.2.2 TMC2209 board, then it should be possible to do the same on the TMC2225 as it has the same spread pin.

But interestingly, through information gained from the marlin discord, it might not even be necessary to enable spread cycle to achieve Linear Advance on any board that doesn't have TMC2208 chips, the reason LA doesn't work on 2208s in stealth mode is due to a design flaw, the other chips do not have this flaw, so in theory should work in stealth mode, it just needs LIN_ADVANCE defined in the configs and possibly S_CURVE_ACCELERATION commented out.

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 4.2.7 board is quite different, the TMC2225 package is a different footprint. I did not bother trying to get my TMC2225 into UART mode, I just put it into SpreadCycle as that's all I needed to change.

Could you share your method please? The more information we have, the more clearly we'll be able to see who needs to do a uart mod, or a spread pin mod and who doesn't to get Linear Advance.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jyers
I know about the "free pins" in the SWDIO pin as a few months now i have use on of them to power off the extruder fan when temperature is below 50 degrees celsius.
#define E0_AUTO_FAN_PIN PA13
thanks anyway

Any chance that you can share your circuit design? I'm sure a lot of people would appreciate seeing how you did your mod?

Of course.
In a few days i will provide a detailed information about the circuit and how i did it.
You can check the finished circuit that does the job
20201123_222349

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy
ok i got it.
So in conclusion for the 4.2.7 board solder must be done. And i supposed that the pin must be the same.... To the R19 pull resistor.

Not necessarily, if someone has managed to enable LA using the spread pin on the 4.2.2 TMC2209 board, then it should be possible to do the same on the TMC2225 as it has the same spread pin.

But interestingly, through information gained from the marlin discord, it might not even be necessary to enable spread cycle to achieve Linear Advance on any board that doesn't have TMC2208 chips, the reason LA doesn't work on 2208s in stealth mode is due to a design flaw, the other chips do not have this flaw, so in theory should work in stealth mode, it just needs LIN_ADVANCE defined in the configs and possibly S_CURVE_ACCELERATION commented out.

My board is 4.2.7 with TMC2225. I did the changes in configs files and it didnt work...
So i think soldering is one way solution.

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngleV Thank you for sharing your fan mod!! it looks like you're right, although you probably only have to tie the spread pin high/low, so it's probably much less hassle than any of the existing mods.

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is exactly what I did for my 4.2.7 with TMC2225 and it works great. Simple solder job, slightly noisier motor but more torque and runs cooler.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy

Forgive my ignorance but i am overwhelmed righr now with all this tech stuff.
I would appreciate it if you can gve us more details on how exactly you did it

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngleV
image

I soldered a tiny jumper wire from SPREAD (pin 19) to VCC_IO (pin 16) to switch it in Standalone mode from StealthChop to SpreadCycle

SPREAD and VCC_IO are on the side away from the board edge on the 4.2.7

Datasheet http://img.ekeic.com/ekeic/9981564407175.pdf

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t3chguy
Ok i got it now.
I suppose you must remove the heatsink to do the job easily.
Is that true?

@t3chguy
Copy link

@t3chguy t3chguy commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends, on one of my drivers the heatsink was so far off to the side it would have been fine, but in my case I did need to remove it

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok much appreciated!!!
Still i am waver if it worths to do it or not

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngleV Thermal glue is all you need to put the heatsink back on and it's cheap to buy, the 2225 chip is also much easier to solder to, as it has decent sized pins on it, it's still surface mount but way easier than soldering to the stm32F103 or the 2208/9 chips.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Reggi3

Any idea or advise how to remove the old thermal glue from the board to expose the driver's pins ?
Also which exactly changes should be made to the configs for this mod ?
All the above that Jyers has made or there is no reason ?

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Reggi3

Any idea or advise how to remove the old thermal glue from the board to expose the driver's pins ?
Also which exactly changes should be made to the configs for this mod ?
All the above that Jyers has made or there is no reason ?

to remove the old glue, I used a toothpick and tweezers, once you get the bulk of it off, you can use some alcohol to remove the rest.

And for the 'spread pin mod' you just need LIN_ADVANCE defined and S_CURVE_ACCELERATION undefined (commented out).

There's one more define that I'm not 100% certain on, whether it's used internally by marlin or whether it has to talk to the TMC chip and that's: #define CHOPPER_TIMING CHOPPER_DEFAULT_24V. iirc the original tmc uart mod didn't have that, that was something I changed after research (and the fact that we use 24v for our motors).

@nullstalgia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LEGEND

Now I don't have to edit a pins file randomly

This is the guide I was using in the past, just for posterity

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

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, i did the uart mod by connecting the PDN_UART to the SWCLK which is the PA14 pin.
i did all the changes to the configs and i get a TMC CONNECTION ERROR.
Anyone has an idea what could be wrong.
I am sure about the soldering by the way.

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, i did the uart mod by connecting the PDN_UART to the SWCLK which is the PA14 pin.
i did all the changes to the configs and i get a TMC CONNECTION ERROR.
Anyone has an idea what could be wrong.
I am sure about the soldering by the way.

Did you change this line to PA14?
#define TMC_UART_PIN_E PA14

You also might like to take a look at this, it looks like other people have already done this mod!!:
MarlinFirmware#16076 (comment)

The poster of that fix lifted a pin but it's probably easier, if you're brave enough, to cut the trace between the diag pin and the spread pin.

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Reggi3
Yes i change the pin to PA14.
I guess i have to separate the pin 17 and 18 that are tied together as the other guy said.
Last change for success ☺️

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that did the trick. By lifting the DIAG pin i got it finally working.

20210509_091749

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that did the trick. By lifting the DIAG pin i got it finally working.

20210509_091749

Perfect :-)

@AngleV
Copy link

@AngleV AngleV commented on ecb49cb May 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

little off topic but...

@Reggi3

As i promised.
Below you can find the schematics for the little custom pcb that controls the Cooling Fan.
It is just a TIP120 transistor that works as a gate, a transistors and a diode.
The principle is very simple.
As soon as the transistor gets the signal from the mcu pin (in my case the PA13) it gets saturated and allow the current to flow through.

Feel free to ask if you need further help.

EasyEDA-Standard-A-Simple-and-Powerful-Electronic-Circuit-Design-Tool_sheet
EasyEDA-Standard-A-Simple-and-Powerful-Electronic-Circuit-Design-Tool
184146189_763264690982880_7001712004221230894_n
184558961_219191726305384_2259467655798194855_n

You must change your Configuration_adv.h the line #define E0_AUTO_FAN_PIN -1 to #define E0_AUTO_FAN_PIN PA13 and #define EXTRUDER_AUTO_FAN_TEMPERATURE to the value that you want the fan to turn off. I set mine to 50 degrees.

@Reggi3
Copy link

@Reggi3 Reggi3 commented on ecb49cb May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngleV I think this is on very topic :-D I did the upgade to the original mod, hopefully to encourage the Ender 3 community to look at their hardware and make things better for themselves.

The mod is about Linear Advance but also hints at there being lots of extras that we could do if anyone wanted to try, also to get the community talking about how to affect these changes in hardware and software too.

Thank you for sharing @AngleV and thank you ALL in the thread for sharing too. Hopefully we can/will shed more light on the 4.2.x boards and features/mods we'd like to see in the future.

Please sign in to comment.