# Y-axis layer shifts with recent Marlin on Ender 3

Since upgrading from the manufacturer's firmare to recent Marlin (first 1.1.9, then 2.0.x git HEAD), I've been having significant model-dependent (didn't happen for first few things I tried to print; other prints reproduce it reliably) layer shifting on the Y axis. It's always in the positive Y direction, usually by 1-3 mm at a time.

I first suspected mechanical problems (see: Ender 3 has developed a tendancy to skip Y steps), but reverting the firmware confirmed that it's a firmware problem.

A number of bug tracker entries for Marlin indicate that there are significant ongoing layer shift problems:

But most end up getting closed. Some people say reverting to 1.1.9 from 2.0.x helped; others say 1.1.9 is EOL and to use 2.0.x. Is there a solution? How do I get a working version of Marlin (new enough to have Linear Advance 1.5, which was my motivation for upgrading) on Ender 3?

Buried in a bug tracker entry for a seemingly unrelated issue, I found what seems to be the solution:

@johanmga, I've discovered the velocity jumps here come from using "classic jerk" computations, and happen whether or not s-curve acceleration is enabled.

Try uncommenting //#define JUNCTION_DEVIATION in Configuration_adv.h; that will disable classic jerk and use the junction deviation math instead.

Also for reference, issue #12403 is actively tracking the layer shift issue (please comment there too if you have more information on problems/solutions), and #12540 is has more information on classic jerk vs. junction deviation.

https://github.com/MarlinFirmware/Marlin/issues/12491#issuecomment-443464603

It seems that the "classic jerk" code no longer works and produces erroneous motion to the steppers under some conditions (dependent on G-code contents), whereas the Ender 3 default configuration file is still using it.

With the default JUNCTION_DEVIATION_MM of 0.02, things worked right away, but printing was so slow that I could plausibly attribute it working just to the slowness. But increasing it up to 0.1 via the menus got the speed closer to what I'm used to, and it's still printing with no layer shifts.

I've posted my results in the tracker in hopes that they'll lead to discovery of the root cause: https://github.com/MarlinFirmware/Marlin/issues/12403#issuecomment-519305409

Another issue on the tracker seems to have more detail:

https://github.com/MarlinFirmware/Marlin/issues/12540#issuecomment-442793326

• No more layer shifts since rebuilding with junction deviation, so I'm accepting this self-answer. – R.. GitHub STOP HELPING ICE Aug 10 '19 at 0:01