Jump to content
Ultimaker Community of 3D Printing Experts

Problem with Accel and Jerk settings for Marlin

Recommended Posts

Using Cura 2.5 and 2.6, my printer is set up as a custom printer using GCode flavor "RepRap (Marlin/Sprinter)".

In Cura I have these as my settings:

Print Accel: 800

Travel Accel: 850

Print Jerk: 10

Travel Jerk: 15

According to documentation (http://marlinfw.org/docs/gcode/M204.html and http://marlinfw.org/docs/gcode/M205.html) this should produce the following Gcode:

M204 P800 T850

M205 X10 Y10

What I find in the GCode instead is:

M204 S850

M205 X15

M204 S800

M205 X10

Using Cura I set both accelerations to 800 and both Jerk to 10.  Then I pulled the settings from the firmware using M503 and this is what I got:

Recv: echo:Acceleration (units/s2): P R T

Recv: echo:  M204 P800.00 R1000.00 T800.00

Recv: echo:Advanced: S T B X Z E

Recv: echo:  M205 S0.00 T0.00 B20000 X10.00 Y20.00 Z2.70 E5.00

So clearly Cura is not setting Y jerk and not interpreting the M205 reading correctly.  How could I fix this?

Edited by Guest

Share this post

Link to post
Share on other sites

According to this:


You can't set the Y jerk differently than the X jerk with Marlin and Sprinter (other firmwares let you). So you will have to use the lower jerk value for the 2 axes.

There is a reason for this. Jerk is not the derivative of acceleration in Marlin. Instead it should be called "instant velocity change" or some other name. Jerk is a bad name. Marlin uses jerk only to determine the max velocity allowed at each junction. so if you are printing a circle and the cad made it a 10 sided circle and you are approaching the next line segment to print it looks at the two velocity vectors before and after that intersection. Then it subtract the 2 vel vectors to get the instantaneous velocity change at that corner. Then it gets the magnitude (speed change) of that vector. Then if that speed is > than the "jerk" speed it reduces the speed for that junction by the ratio you are over the jerk speed.

Real example: print speed is 100mm/sec. printing the corner of a cube (90 degree corner). The magnitude of speed change is 140mm/sec. If jerk is 10mm/sec then it will divide the speed by 14 and you get 7mm/sec max junction speed at the corner.

This is a crappy algorithm if the two speeds going into and out of the corner are different but if speeds are the same then it works most of the time. It does not allow a different jerk speed for Y versus X.

Share this post

Link to post
Share on other sites

The current Marlin source does expect M205 to have separate X and Y values. It used to only take an X value which it then used for both X and Y as the reprap wiki describes. I can't see that adding the Y value will break old Marlin's so I have submitted a PR to make the M205 have both the X and Y values (which will be the same value) and it should work for both old and new Marlins. We will see...

Share this post

Link to post
Share on other sites

Aside from the M205 X10 Y10 issue (which will only work with the most current version of Marlin firmware), I believe Cura is behaving properly:

This is setting the parameters before a Travel Move:

M204 S850

M205 X15

These are setting the parameters before Print Moves:

M204 S800

M205 X10

The above setting match your requests in Cura, it is just send these commands before each Travel or Print moves instead of what you are expecting with the M204 command. I believe Cura is adhering to the Lowest Common Denominator when generating gCode so that it can remain compatible with as many variations and versions of Firmware for 3D Printers as possible.

Also, the M503 only reports what is in the Firmware or EEPROM. Note that the above M204 and M205 do not alter EEPROM and Firmware is, well, firm...it cannot be changed without burning new firmware. So what is being currently used may not be what M503 reports.

If you want to have your Accel & Jerk settings set as the default, and EEPROM writing is enabled on your Firmware, you need to use the M500 command to save them in EEPROM and then DON'T change them during printing with the M204 and M205 commands (ie: disable Accel & Jerk settings in Cura)

Hope this helps.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Our picks

    • How to 3D print with reinforced engineering materials
      Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
      • 0 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 replies

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!