How to flash Marlin firmware: SD card, USB and EEPROM backup

marlin_firmware_installation-1758984477199

Flashing Marlin means putting a firmware file built for your exact control board onto the printer. How you install it depends on the board. Most 32-bit boards (STM32 or LPC176x chips, such as the BigTreeTech SKR Mini E3 or Creality 4.2.x boards) update from the SD card: copy the .bin file to the card, power on, and the board’s bootloader installs it. Older 8-bit AVR boards take a .hex file uploaded over USB, which only works if a bootloader is present.

Two steps save most of the trouble. Before flashing, send M503 and save the output, because it lists your current steps/mm, PID values and probe offset. After flashing, send M502 then M500. Marlin’s documentation says settings saved in EEPROM can survive a flash and override your new configuration, so it tells you to do this every time. The details below come from the Marlin docs and the BigTreeTech and Creality update instructions, linked at the end.

Affiliate · Featured hardware Snapmaker U1 5X More Speed. 5X Less Waste.

The consumer toolchanger 3D printer: the SnapSwap 4-toolhead system swaps heads in 5 seconds for true multi-color and multi-material printing, with smart calibration and auto filament loading.

  • 4 toolheads · 5 s swap
  • Up to 500 mm/s · 20,000 mm/s²
  • 270 mm cube build volume
  • Multi-color & multi-material
See the Snapmaker U1 →
Snapmaker U1

Marlin update in 8 steps

  1. Find the exact board model, which is printed on the board itself, and download the vendor’s stock firmware as a fallback.
  2. Connect over USB, send M503 and save the full reply to a text file.
  3. Download Marlin and the matching example configuration for your printer.
  4. Check MOTHERBOARD, the thermistor types, the driver types and the bed size in Configuration.h.
  5. Build in VS Code with the Auto Build Marlin extension.
  6. Install: firmware.bin on the SD card for 32-bit boards, or Upload over USB for 8-bit boards.
  7. Send M502 and M500, then reboot.
  8. Check temperatures, homing and motor directions, then re-enter or re-calibrate your saved values.

Which flashing method your board uses

An SD card update on a 32-bit board is still done by a bootloader. The bootloader checks the card at power-on and writes the new file to flash. Marlin’s M997 page says the same: on LPC176x, STM32 and STM32F1 boards, the command restarts the board so the bootloader can install a binary already on the card. On 8-bit boards, the bootloader is what makes USB uploads possible.

Board typeFileHow to installWatch out for
32-bit STM32 or LPC176x (SKR Mini E3, Creality 4.2.x and similar)firmware.bin or the vendor’s .binCopy to the root of the SD card and power on with the card insertedBigTreeTech: the file must be named exactly firmware.bin. Creality: format the card with a 4096 allocation unit size.
8-bit AVR with a bootloader (RAMPS and other Mega-based boards).hexUpload over USB from PlatformIO or Arduino IDEClose Cura, Repetier Host, Pronterface or OctoPrint first, or the upload times out
8-bit AVR without a bootloader.hexAn ISP programmer or a spare ArduinoMarlin recommends burning a bootloader first, then using normal USB uploads
Vendor or pre-built binary, no compiling.bin or .hexSD card for BIN files; Cura, Repetier Host or XLoader (Windows) for HEX filesSome TFT touch screens need their own firmware update to work with mainline Marlin

For a common printer you may not need to compile at all: Marlin publishes pre-built binaries (2.1.3 and later) for its example configurations in the Marlin Builds repository. Compile your own when you change hardware, such as a probe, drivers or the board.

Back up your settings and stock firmware first

Black open-frame 3D printer on a desk next to a laptop and a blue USB stick under a desk lamp
  • Save the M503 report. Connect with a serial terminal (Pronterface, OctoPrint’s terminal or similar) and copy the whole reply into a file. Marlin notes that M503 shows the settings currently in memory, which can differ from what is stored in EEPROM. If you changed anything without saving, send M501 first to load the stored values.
  • Keep the old configuration. If you built the current firmware yourself, keep its Configuration.h and Configuration_adv.h. On firmware built with CONFIGURATION_EMBEDDING (Marlin 2.0.9.3 and later), M503 C saves the embedded configuration as a ZIP file on the SD card.
  • Download the stock firmware from the printer or board vendor. If your build misbehaves, flashing it gets you back to a working printer.
  • Write down the board model as printed on the board, not just the printer name. The same printer model has shipped with different boards.

Configuration basics: the settings that matter

Marlin is configured in two files, Configuration.h and Configuration_adv.h. Start from the example configuration that matches your printer (in the MarlinFirmware Configurations repository) rather than from the generic defaults. Settings are C #define lines: remove the leading // to enable an option and add it back to disable one. Marlin 2.1.3 and later also accept a short Config.h containing only your changes. These are the settings worth checking before every build:

SettingWhat it doesWhat Marlin’s docs say
MOTHERBOARDMaps pins to your boardThe most important setting; a wrong value gives unpredictable results. Use the IDs in boards.h, e.g. BOARD_CREALITY_V422 or BOARD_BTT_SKR_MINI_E3_V3_0.
SERIAL_PORT, BAUDRATEHost connectionPort -1 is the USB-emulated port where available. 115200 baud is a good balance for most setups; allowed values go up to 250000.
TEMP_SENSOR_0, TEMP_SENSOR_BEDThermistor typeMatch your sensor by brand and model; if none fits, use the generic type 1. A wrong type gives wrong temperatures.
THERMAL_PROTECTION_HOTENDS, _BEDShuts heaters off if a reading goes wrongOne of the most vital safety features. Leave it enabled.
X_DRIVER_TYPE etc.Stepper driver modelMust match the fitted drivers, e.g. A4988 or a TMC type.
INVERT_X_DIR etc.Motor directionFlip it if an axis moves the wrong way.
X_BED_SIZE, Y_BED_SIZEPrintable areaSet to your bed; travel limits are based on these.
EEPROM_SETTINGSStores tuned values across rebootsDisabled by default but highly recommended.
STRING_CONFIG_H_AUTHORLabel in the startup messageUse it to identify your own build, so you can tell whether a flash actually took.

Moving an old configuration to a new Marlin version. Marlin suggests dropping your old files into the new source, updating CONFIGURATION_H_VERSION and CONFIGURATION_ADV_H_VERSION, and building; the errors name each outdated option. Adding a probe? Our BLTouch and CR Touch setup guide covers the probe-specific settings and Z-offset.

Building the firmware in VS Code

Marlin currently recommends PlatformIO with the Auto Build Marlin extension. Arduino IDE can only build for AVR, Due and Teensy++ 2.0 boards, so 32-bit STM32 and LPC boards need PlatformIO.

  1. Install Visual Studio Code, open Extensions, search for “Marlin” and install Auto Build Marlin. PlatformIO is installed with it.
  2. Open the downloaded Marlin project folder, not the Marlin folder inside it.
  3. Open the Auto Build Marlin panel. It reads your MOTHERBOARD setting and lists the matching build environments; if there are several, pick one.
  4. Click Build. Marlin’s sanity checks flag outdated or conflicting options at this point.
  5. For USB-flashed boards, click Upload. For SD-flashed boards, take the .bin file from the environment’s folder under .pio/build in the project.

Flashing a 32-bit board from the SD card

  1. Prepare the card. Creality’s instructions say to format the TF card with a 4096 allocation unit size. Use a card with nothing else on it.
  2. Copy the file to the root of the card, not into a folder. On BigTreeTech SKR Mini E3 V3.0 boards the name must be exactly firmware.bin, and BTT’s own pre-built files have to be renamed to that. Creality’s stock files keep their long names.
  3. Power off, insert the card into the board’s slot, then power on.
  4. Wait. BTT’s manual says the update takes about 10 seconds, with the status LED blinking red. Do not switch off during the update.
  5. Remove the card and delete the .bin file, as Creality’s instructions say.
  6. Confirm the new version. Send M115 or look at the startup message for your STRING_CONFIG_H_AUTHOR label.

If the printer keeps booting the old version, many Creality 4.2.x owners report that the bootloader ignores a file with the same name as the one it last flashed. Renaming the file (for example firmware2.bin) is a common fix. This comes from user reports, not from Creality’s documentation, and it does not apply to BTT boards, which need the exact name.

Flashing over USB and boards without a bootloader

Bare electronics board with green screw terminals connected by cables to a laptop showing code

For AVR boards, connect USB, close every program that might hold the serial port, and use Upload. If you only get timeouts even with the port free, the board may have no bootloader. You then need an ISP programmer or a spare Arduino: Arduino IDE’s Burn Bootloader function writes one, and after that normal USB uploads work. If the build is too large for the chip, disable features; Marlin’s SLIM_LCD_MENUS option exists to save space.

After flashing: reset EEPROM and restore settings

  1. Reset: send M502 (load the defaults from your configuration), then M500 (write them to EEPROM), then reboot. BTT’s firmware notes give the same instruction via the LCD: Configuration, Restore defaults, then Store settings.
  2. Check temperatures at room temperature. Both readings should look like the room, not a MINTEMP or MAXTEMP error.
  3. Home each axis with a hand near the power switch, and jog the extruder with the hotend hot.
  4. Restore tuned values from your M503 file only where the hardware is unchanged: steps/mm (M92), PID (M301, M304), probe offset (M851). Save with M500. After a hardware change, re-tune instead: run M303 PID autotune for the hotend and bed, and re-check extruder calibration.

Common Marlin flashing failures and fixes

SymptomLikely causeFix
Printer boots the old firmware after an SD updateFile not found: wrong name, not in the root, card formatExact firmware.bin on BTT boards, file in the root, card formatted per vendor; on Creality try a new file name
EEPROM datasize error or CRC mismatchThe stored EEPROM layout doesn’t match the new versionM502, M500, reboot. EEPROM_AUTO_INIT resets it automatically when the layout changes.
New configuration values seem ignoredValues saved in EEPROM override the configuration filesM502 then M500
“Heating failed” or “Thermal runaway” soon after upgradingUntuned PID, wrong sensor type, or a fan blowing on the heater blockCheck TEMP_SENSOR_*, run M303. Marlin suggests relaxing WATCH_TEMP_PERIOD to 40–60 s during setup, never disabling protection.
MINTEMP or MAXTEMP errorThermistor shorted, broken, or wrong type selectedCheck wiring and the TEMP_SENSOR value
Graphical LCD blank or glitchyLCD timing, or a TFT that needs its own firmwareMarlin’s troubleshooting page lists ST7920_DELAY values to try; check the TFT vendor’s README
USB upload times outAnother program holds the port, or no bootloaderClose host software; otherwise burn a bootloader
Axis moves the wrong way or grinds at the endDirection or endstop settingsFlip INVERT_*_DIR; check endstop configuration
Strange PlatformIO build errorsCorrupted PlatformIO installDelete the .pio folder in the project and .platformio in your user folder, then reinstall

For more error messages from the update itself, see common firmware update errors and how to fix them.

Common mistakes and when to consider Klipper

  • Setting the board by printer name. An Ender-3 can have one of several boards. Read the model off the board.
  • Skipping M502/M500. Old EEPROM values then override the new build, and a correct configuration looks broken.
  • Turning off thermal protection to stop an error. The error is doing its job. Fix the sensor, fan or PID instead.

If you are updating to get input shaping, pressure advance tuning or a web interface, compare this with moving to Klipper. Klipper runs on a separate computer such as a Raspberry Pi and is configured in a text file, so you don’t recompile for every change. Our guide to migrating from Marlin to Klipper walks through that switch.

Frequently asked questions

Will updating Marlin erase my printer settings?

Not necessarily, and that is the problem. Marlin says EEPROM contents are only kept reliably when you flash a near-identical version with the same EEPROM layout; otherwise you may see EEPROM errors or stale values. Save the M503 output before flashing, then run M502 and M500 afterwards and restore the values you still need.

Can I install Marlin without compiling it?

Yes. Marlin publishes pre-built binaries for its example configurations from version 2.1.3, and many vendors provide stock firmware files. A BIN file goes on the SD card; a HEX file can be uploaded with Cura, Repetier Host or XLoader. You only need to compile when your hardware differs from an existing configuration.

Why does my printer ignore firmware.bin on the SD card?

Check that the file is in the root of the card, that the card is formatted the way the vendor specifies, and that the name matches what the bootloader expects. BigTreeTech SKR Mini E3 V3.0 boards require exactly firmware.bin. On Creality 4.2.x boards, users report that renaming the file to something new helps.

Do I need to re-run PID tuning after flashing Marlin?

If the hotend, heater, thermistor and fan are unchanged, restoring your saved M301 and M304 values is usually enough. After any heater or sensor change, or if you get “Heating failed” errors, run M303 autotune for the hotend and the bed and save with M500.

Sources