I’ve been asked about this a few times, and it seemed appropriate to put together a quick post on the topic.
In my humble opinion, one of the most useful features of Marlin is the ability to save a bunch of settings to what is essentially a non-volatile area memory that exists on the Arduino board, which, of course, is the basis for nearly all the current generation of 3D printer controllers.
With Marlin’s EEPROM functions activated, a user can set, adjust, tweak or otherwise modify a printer’s settings until everything is just so, and then save them such that they will not only survive a reboot (or even a complete re-flash of the firmware), but they will also appear as the default settings every time the printer is turned on.
This, of course, is a whole lot faster, easier and more productive than making all these changes within the Configuration.h file.
In most cases, the EEPROM functions are disabled by default. The good news is that it is quite simple to activate them. Simply open up your Configuration.h file, and look for this section, which is going to be very near the “Additional Features” heading:
// The microcontroller can store settings in the EEPROM, e.g. max velocity...
// M500 - stores parameters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
//define this to enable EEPROM support
//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
// please keep turned on if you can.
Now, simply find these two lines:
And make them look like this:
Now save your changes and re-flash Marlin. Your EEPROM functions are now active, congratulations!
You can verify this via your LCD controller by entering the menu, then selecting Control. Inside the Control menu, you should see two new options:
Store Memory and
What they both do is fairly self-explanatory:
Store Memory stores the printer’s current values to EEPROM, which also effectively makes them the default settings at boot.
Load Memory retrieves the stored settings from EEPROM, and overwrites whatever is currently in the printer’s SRAM (working memory). Be careful with this: if you’ve been making adjustments and select this option, they will be lost in favor of whatever is already in storage.
There is also a third option, which has been there all along, which is related to the other two:
Restore failsafe will overwrite whatever is in SRAM with whatever values are specified in the Configuration.h file
What settings can be stored in EEPROM? Specifically:
In addition to setting these values via the LCD, you can save and load settings to/from the EEPROM using M-codes through a print control application such as Pronterface.
Back in your Configuration.h file, in the comments in the code segment where you activated your EEPROM functions, there is some good information explaining what M500, M501 and M502 do (just scroll up in this post, I’ve already quoted it). These commands correspond exactly to the Save Memory, Load Memory, and Restore Failsafe options on the LCD menu.
As an added bonus, the M501 command will also echo all of the settings stored in EEPROM, and as a nice extra touch, it also tells you what M-codes you would need to use in order to manually change any of the settings. Pretty cool, if you ask me!