Backup 3d printer firmware
How to Flash & Upgrade 3D Printer Firmware – Simple Guide – 3D Printerly
After getting into 3D printing, I came across terms such as firmware, Marlin, flashing, and upgrading which was pretty confusing at first. I did some research about 3D printer firmware and found out what it all means, so I wrote an article about it to assist other people.
This article will discuss firmware-related topics such as what firmware is, how to flash and upgrade the firmware on your 3D printer, and more, so stay tuned for some useful info.
What is Firmware in 3D Printing? Marlin, RepRap, Klipper, Repetier
Firmware in 3D printing is a specific program that controls the functioning of your 3D printer by reading G-code instructions from the sliced model. It is located on the printer’s mainboard, and comes in many types, such as Marlin and RepRap that each have their own set of features and perks.
The most fundamental actions of your 3D printer, such as the movement of the stepper motors, the heaters switching on, and even how fast your 3D printer prints requires millions of calculations that only the firmware can make.
Without firmware, your 3D printer wouldn’t know what to do and how to do it. For example, consider a G-code command “M109 S200.”
Once you enter it in your G-code terminal, it’s the firmware of your 3D printer that will recognize it and know what to do. In this case, it will set the target temperature for the hot end to 200°C.
That was just a basic explanation, but the firmware, in truth, is capable of handling G-code commands far more complex than that. It’s basically how it runs your 3D printer and makes those magical prints as we know them.
There are many 3D printer firmware out there that people usually use to 3D print with. Let’ take a look at some of the most common ones below.
What is Marlin Firmware?
Marlin is the most famous 3D printer firmware that the majority of the community is currently using on their unit. Most 3D printers ship with Marlin as their default firmware, although you may want to update it as time goes on.
Marlin is popular because it has a number of desirable features that other firmware does not have. First off, it is highly customizable, meaning that you can add your own features to Marlin easily.
In addition, it has excellent documentation and great community support. This means that setting up Marlin is easy with a large number of guides and tutorials available online, and since most people use Marlin, it’s painless to find like-minded people to help you on your 3D printing journey.
Marlin is a reliable firmware and is recommended to all those who have just started out with 3D printing because of its ease of use.
What is RepRap Firmware
The RepRap firmware is another big name in the world of 3D printing that originally came out for the 32-bit Duet control board, which is an advanced and expensive motherboard with several premium features.
Many people prefer RepRap over Marlin because of how it’s so easy to configure. There’s a dedicated web configuration tool that connects to your firmware and allows you to modify it very easily. This isn’t something that Marlin can do.
However, RepRap isn’t as widely compatible as Marlin and only works on 32-bit boards whereas Marlin can also be used on 8-bit boards.
What is Klipper Firmware?
Klipper is a relatively new 3D printer firmware that’s best known for its high calculation speeds. This, in turn, makes the 3D printer print faster, hitting speeds no less than 70-100 mm/s.
This firmware uses another single-board computer, such as the Raspberry Pi, and offloads the intensive calculations to it. Doing so helps the firmware print faster and with better quality using highly accurate stepper motor movements.
Klipper firmware is also supported by most Cartesian and Delta 3D printers and can work on 8-bit boards, unlike RepRap firmware. It’s easy to use but doesn’t have the same level of support as Marlin.
What is Repetier Firmware?
Repetier is another great option if you’re looking for a reliable, high-quality firmware with loads of features. It’s widely compatible and has support for most boards out there, and can be easily customized to your preferences.
Like RepRap, Repetier also has a web-based configuration tool so you can make modifications to the firmware with ease and comfort. There’s also a slicer from the developer of Repetier called Repetier-Host.
The combined usage of the Repetier firmware and Repetier-Host attributes to an efficient printing experience with fewer errors. It’s also an open-source firmware that gets regular updates, and newer features from the developer consistently.
How to Change/Flash/Upgrade the Firmware on Your 3D Printer
To upgrade the firmware on your 3D printer, you will first need to download the latest Marlin release and open it in the Arduino software, which is a platform for upgrading 3D printer firmware. After connecting your printer with the computer, you’ll simply verify and upload the firmware using a few easy steps.
If you’re a newcomer to 3D printing, flashing the firmware on your 3D printer may seem like a difficult task at first, but doing so is definitely worth it to get all the latest features for your printer, and print more reliably and consistently.
The following steps are going to explain how you can upgrade the firmware on your 3D printer, so be sure to follow each of them carefully.
Step 1. Head over to GitHub to download the latest Marlin release, which is 2.0.9.1 at the time of writing. You can check the latest version by clicking the dropdown menu on the page and checking the bottom release.
When you’re there, click on the dropdown arrow on the “Code” button and then select “Download ZIP.” That should begin the download for you.
Step 2. The file will come in a ZIP format, so you will need to extract it to continue. Once done, open it and click on the “config” folder.
Step 3. Once done, you will now need to copy the required information of your specific 3D printer and replace the default configurations files with it. To do that, click on the “examples” folder, find your 3D printer, and select your machine’s mainboard. The pathway given below is an example of how you should be doing this step.
Configurations-release-2.0.9.1 > config > examples > Creality > Ender-3 > CrealityV1
Copy the “Configuration” and “Configuration_adv” files to continue.
Step 4. Next, you will simply paste the files into the “default” folder. If you’re on a Windows PC, the system will prompt you to replace the present files with your copies ones. Do that to continue. Now we have the latest Marlin firmware version that’s configured for your 3D printer.
Step 5. Now, you will need the Arduino software to upgrade your 3D printer’s firmware. Arduino IDE can be downloaded from the official website, and if you’re on a Windows PC, you can also install it comfortably from the Microsoft Store.
Step 6. Next, launch the firmware in your Arduino IDE using the Marlin.ino file in the folder. When Arduino opens up, make sure that you select the right board of your 3D printer in the “Tools” section to avoid running into errors.
Step 7. Next, all you have to do is click on the “Verify” button that’s shaped like a tick in the top-left corner. This will begin the compiling process for the firmware. If you’ve done everything right until now, you hopefully won’t see any error messages popping up.
Step 8. After the firmware update has done compiling, you will now simply connect your 3D printer with the computer using a USB connection if your printer has a bootloader. If not, there’s also a way to connect your printer and I’ve talked about it later on in the article.
Once connected, click on the “Upload” button that’s right beside the “Verify” button. Make sure the printer has been plugged out from the power outlet before doing that.
That’s it for upgrading the firmware on your 3D printer. There’s a small chance that some of your settings such as bed leveling offsets or acceleration limits might have been reset.
In that case, you can use the “Initialize EEPROM” option in your 3D printer’s interface to restore everything in your configuration files.
The following video thoroughly goes over the process, so do check that out for an in-depth visual tutorial.
How Do I Add & Install Marlin Firmware to a 3D Printer?
To install the Marlin firmware on a 3D printer, you’ll first have to download Marlin on your computer, edit the downloaded configuration files, then use the Arduino software to compile the Marlin project into a readable form for your 3D printer. Once done, you’ll simply upload it to add Marlin to your 3D printer.
The process of installing Marlin to your 3D printer is quite similar to the subtitle above. You can basically repeat all the steps highlighted in the previous section, even if you’re adding Marlin for the first time to a 3D printer.
To edit your 3D printer firmware, you will be using the Arduino IDE application right after you open up the firmware in it.
However, it’s recommended not to mess with the configuration files in the editor since most of the code is already pre-defined, and changing something without knowing what it is could potentially prevent you from flashing.
The following video by Teaching Tech is a great guide on editing your 3D printer firmware, so be sure to check that out for more details.
Can You Update Your Ender 3 Firmware With Cura?
Yes, you can update your Ender 3 firmware with Cura in just a couple of easy steps. First, you simply download the pre-compiled version of the firmware you want in HEX format and upload it to your 3D printer using Cura.
The Cura slicer makes it quick and easy to upload our firmware of choice to the 3D printer. You don’t even need to have a bootloader to use this method.
What you will be needing is a USB, the firmware that you need in HEX format, and, of course, Cura. The rest of the process is extremely painless to follow, so let’s get into that right away now.
The following steps are going to explain how to update your firmware with Cura.
Step 1. Go to DanBP’s Marlin Configuration page and scroll down to files to find packaged HEX files that correspond with your setup for the Ender 3. You can also search for your own firmware online, but make sure that’s it compiled already before downloading.
Here’s what the section looks like to scroll down to on the page.
Step 2. Connect your computer/laptop to your 3D printer using the USB connector that fits your machine.
Step 3. After downloading the file, you will need to extract it to continue. Once done, simply launch Cura and click on the dropdown area beside your 3D printer selection area. After that, click on “Manage printers” to continue.
Step 4. As soon as you do that, you will see the “Preferences” window appear. There’s going to be an option called “Update Firmware.” Click on it to get to the next step.
Step 5. Lastly, you will now simply click on “Upload custom Firmware,” choose the HEX file you just downloaded and let Cura upload the firmware to your Ender 3 printer.
You’re all done! You stuck to a fairly basic process and ended up updating your 3D printer’s firmware. Don’t forget to initialize EEPROM on your 3D printer to store the firmware.
The following video is a visual explanation of the process discussed above.
How Do You Find Out & Know the Firmware of Your 3D Printer
To know and find out the firmware of your 3D printer, you need to send the M115 G-Code command to your printer using a software like Pronterface. Some 3D printers including the Ender 3 also have an “About” or “Printer Info” section in their LCD menu which can tell you what firmware is installed on them.
Most 3D printers ship with either Marlin or RepRap firmware, but it’s worth knowing for sure which one is installed on your machine.
The M115 command is basically a command for “requesting the firmware version and capabilities of the current microcontroller or mainboard. It can be entered in the terminal window of any software that can send your 3D printer G-Code commands.
Pronterface is a popular choice that many people use to control, adjust, and calibrate their 3D printers with techniques such as hot end and heat bed PID Tuning.
Upon entering the said command, you should get a string of code that would look something like this.
FIRMWARE_NAME:Marlin 1.1.0 (Github) SOURCE_CODE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:RepRap EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff
On the other hand, if you’re using the Makerbot Print slicer software, you can easily find out the firmware version you’re using by heading over to the Print Panel, selecting your 3D printer, and then clicking on “Utilities. ”
Finally, you would click on “Firmware Update” and all the relevant information will pop up, including the current firmware version that your printer is using.
Can You Extract Firmware From a 3D Printer?
Yes, you can extract firmware from a 3D printer once it has been compiled and uploaded. However, after you get the .hex file for your firmware configuration, it becomes pointless in the long run, since you won’t be able to edit or configure your firmware since it has been compiled already.
Before it’s compiled, firmware is either in the .h or .ino format. After you compile it, the format is converted to either .bin or .hex, depending on whether you have an 8-bit board or a 32-bit board.
Think of this like a dish you prepare. Before you cook, you have all the ingredients laid out on the table for you, allowing you to replace them with whatever you like. After you’ve cooked, you cannot go back to the ingredient stage. This is how it is with firmware as well.
Does Your 3D Printer Have a Bootloader?
Your 3D printer may or may not have a bootloader, depending on what printer you have. Budget-friendly 3D printers such as the Creality Ender 3 don’t ship with bootloaders because they take up extra storage space on the microcontrollers inside your printer’s mainboard and also cost more to include.
The following are some 3D printers that have a bootloader.
- QIDI Tech X-Plus
- Monoprice Maker Select V2
- MakerBot Replicator 2
- Creality Ender CR10-S
- Flashforge Creator Pro
Can You Flash Firmware Without a Bootloader?
Yes, you can flash firmware without a bootloader by using an external programmer that writes the firmware to the ICSP of your motherboard. The ICSP is present in most boards, so you should have no problem flashing firmware without a bootloader that way.
A bootloader is a software that allows you to flash firmware easily with a USB. It takes up minimal space inside your mainboard’s microcontroller, which is a specific component storing everything related to the 3D printer firmware.
Although minimal, the bootloader does take space in the microcontroller, which could potentially be utilized by other more important features, such as automatic bed leveling.
This is the reason many manufacturers avoid putting bootloaders inside the 3D printer’s mainboard, so users can fully utilize the space for more features.
Doing so makes flashing firmware definitely more complex because you cannot simply use a USB connection anymore. However, several people consider the trade-off worth it to increase their printer’s functionality.
The following video by Thomas Sanladerer is a great tutorial on flashing firmware without a bootloader, so do look into it for a thorough guide.
RepRap Vs Marlin Vs Klipper Firmware
RepRap, Marlin, and Klipper are all very popular choices when it comes to choosing a firmware for your 3D printer. However, the three of them differ fairly from each other, so let’s dive into the differences and see which one comes out on top.
Architecture
RepRap: The RepRap firmware is written in the C++ programming language and is strictly made to run on 32-bit processors only, such as the Duet controller boards. In doing so, it can be used on 3D printers, CNC machines, engravers, and laser cutters. RepRap is also based on Marlin.
Marlin: Marlin is based on the Sprinter firmware also written in C++ but is fairly versatile and can run on both 8-bit and 32-bit processors. Like RepRap, it handles most of the detailed G-Code calculations that control the components of the 3D printer itself.
Klipper: The Klipper firmware focuses on important components like stepper motors and bed leveling sensors, but leaves the complex G-Code calculations to another, more capable board, which is Raspberry Pi in most cases. Therefore, Klipper uses a combination of two boards to run 3D printers, and this is unlike any other firmware.
Category Winner: While architecture doesn’t pose an apparent benefit or downside, Marlin takes the win here because it’s the most experienced firmware, forming a strong foundation for many other firmware to be built upon.
Features
RepRap: RepRap is jam-packed with features, including high-end ones for advanced 3D printing users. Some of these include precise step time generation and dynamic acceleration adjustment, both of which are extremely helpful for speedy, accurate, and high-quality 3D printing.
Another key feature of RepRap is its web configuration tool that makes customization a breeze and painless to deal with, unlike Marlin where you have to edit everything in the Arduino IDE.
Marlin: With constant updates over time, Marlin has also become a feature-rich firmware with functionality like automatic bed leveling, autostart, which sets the printer to a fresh state after you restart it, and linear advance, which generates the correct pressure inside the nozzle for precise movement and higher print speeds without the loss of quality.
Klipper: Klipper boasts an advanced set of features such as input shaping which reduces the impact of stepper motor vibrations on the print quality. By eliminating this rippling effect in prints, you can print at higher speeds and maintain awesome quality.
Klipper boasts another feature called smooth pressure advance that reduces oozing or stringing and improves how the corners of your model are printed. It also helps keep the process more stable and robust, so the print quality is never compromised. There are many more expert-
Category Winner: Klipper
Speed
RepRap and Marlin: Both of these firmware are more or less the same when it comes to speed. RepRap does boast that it has a high upload speed, about 800Kb/s to the SD card by either using a Wi-FI or Ethernet connection. If you increase the speed beyond normal values in Marlin or RepRap, you will have to settle for lesser print quality.
Klipper: Klipper is the fastest firmware out of the bunch, with features such as smooth pressure advance and input shaping allowing it to print at higher speeds, about 80-100mm/s while maintaining great print quality and precision.
I even found a YouTube video of someone printing using Klipper at a speed of 150mm/s effortlessly.
Category Winner: Klipper
Ease of Use
RepRap: RepRap is definitely the easier firmware to use in this comparison. File configuration can be done in a dedicated web-based interface and it can also be used to update the firmware.
The online configuration tool makes RepRap stand out, giving it the ease of use many 3D printer users desire in Marlin.
Marlin: For beginners, Marlin is easy to get the hang of. However, the firmware does get time-consuming and difficult as well when you need to configure your files.
If you need to make a certain change to the configuration, you would have to re-flash the firmware and compile it, basically repeat the process all over again. On the positive side, Marlin has great documentation, a huge community, and a wealth of material available online to learn and get help from.
Klipper: Klipper is also an easy-to-use firmware, definitely more if you’re well-versed with Raspberry Pi. It’s not necessary to re-flash it, unlike Marlin, and changes to configuration files can be easily made.
That said, documentation for Klipper does lack since it is a relatively new firmware, and you won’t find the same level of help online as you would for Marlin.
Category Winner: RepRap
Compatibility
RepRap: RepRap was originally made for the 32-bit Duet boards. Therefore, it can only function on a handful of other 32-bit boards, so it isn’t really the most diverse firmware out there.
Marlin: Marlin is the most widely compatible firmware out there, made to work on both 8-bit boards and 32-bit boards. It’s why people use Marlin when they build their own 3D printer.
Klipper: Unlike RepRap, Klipper supports 8-bit and 32-bit boards as well, and works with just about any board out there. Klipper is also becoming more preferable for those who start building a DIY 3D printer and they need a feature-rich firmware to install.
Category Winner: Marlin
Multi-Spool Mode, Backup Drives, Splice Tun – Mosaic Manufacturing
Hello everyone!
With the new year in full swing we wanted to fill you all in on what has been happening at Mosaic with Palette 3! We’ve been working hard to add features and fix bugs in the firmware, while also putting our spare Palettes to work, printing across any of our available printers.
We are as excited as you are to be printing in multiple colors and are committed to bringing the experiences we are having in our office to each of you!
New Firmware
We just released a new firmware update which adds the following functionality:
- An ‘advanced start’ option when starting a new print. This allows you to configure backup drives or reassign which filament uses which input. We’ll cover these features in more detail below
- The ability to adjust splice settings for custom mode prints (Pattern, Random, Gradient, Multi-spool)
- Splice tuning can now be performed with inputs other than 1 and 2. Palette will also now ask which filament to use as the ingoing or outgoing filament
- A small adjustment to how ponging impacts compression, which should lead to slightly less variability in splice strength
- In case you missed it - in the previous update, we also added ‘multi-spool’ a custom print mode that allows spools to be joined together for long single color prints, or to combine the ends of spools (mm3d.co/p3-multispool)
- We have also included various small bug fixes and improvements. Check out the full release notes here
Advanced start, introduced in this update, provides some new options when starting a print. These options are the ability to ‘reassign colors’ or ‘configure backup drives’.
For ‘reassign’ inputs, if you have your Palette loaded up with filaments already but your color order doesn’t match what you set in Canvas - that’s ok! You can now use the screen to switch which input is used for which color.
‘Backup drives’ allows you to load additional spools to be used as a backup in case the other drive runs-out. You’re able to create as many backup drives as you have empty drives in your Palette! During the print, the leftmost drive of a given color will be used first, and then work from left to right through any other drives that were configured as backups.
As of today, you are only able to configure a backup drive before starting your print, but with a future firmware update coming soon, we will also allow you to make these changes during a print.
What Our Team is Working On Next:
Our team will continue to release firmware updates on a rolling basis as functionality is ready!
The following list is what we are currently working on and will be available soon:
- Remaining run-out functionality: This includes configuring a backup drive mid-print, handling when a filament runs-out without a backup drive, and the ability to change filament mid-print
- Webcam: We have been making great progress on webcam functionality, with the vast majority of the work completed. Soon you’ll be able to plug a USB webcam into Palette 3 and view the stream on Canvas
When we’ve completed the previous list, we will begin working on the following:
- Local file transfer: This will allow P2PP users and others to send files directly to their Palette 3 over a local area network
- Improvements to the print streamer: While most issues can be worked around using an alternate Palette 3 firmware or setting the ‘clear buffer command’ in Canvas to M400 - we are committed to improving the connection stability with your printer
- Logging: Ability to save log files from Palette 3 to aid our customer success and technical teams in solving issues that you encounter
- Timelapse: Building off of the webcam work, we will extend the functionality to allow Palette 3 to record timelapses of your prints
In addition to everything listed above, we will be constantly evaluating performance and reliability of Palette 3. Wherever we find opportunities to improve, we will include those fixes alongside new features.
Want something that we haven’t listed here? Reach out to us at [email protected]!
What We've Had On Our Printer This Month:
Alongside the testing of new features, we wanted to put Palette through its paces and run longer and more complex prints. We varied the printer, type of Palette (3/3 Pro), slicer, and material brand to try and capture a number of different configurations. In the last two weeks, we’ve completed over a dozen prints with a total of more than 10,000 splices between them.
A huge ‘thank you’ to the designers in the 3D printing community for amazing multi-color models, links to the specific models and designers can be found below! For more pictures of these prints check out our Instagram account, @mosaicpalette. We have more prints on the way - we’ll be posting on Instagram as they are completed.
Model | Designer | Link |
Bike Helmet | Mosaic | Coming Soon |
Cheshire Cat | Steve Solomon | MyMiniFactory |
Computer Mouse | Mosaic | Thingiverse |
Deadpool | Iczfirz | MyMiniFactory |
Eye | Mosaic | Coming Soon |
Hilbert Cube | Tbuser | Thingiverse |
Elder Lighthouse | Kijai | MyMiniFactory |
Mandalorian | Iczfirz | MyMiniFactory |
Mike Wazowski | Iczfirz | MyMiniFactory |
Packaging Concept | Mosaic | Coming Soon |
Tavern (Dice Tower) | Mosaic | Coming Soon |
Printing with Palette 3 has a learning curve, and our team is fortunate to know it inside and out. That said, we still had one print that gave us problems. The ‘Elder Lighthouse’ failed twice each with a broken splice about 10% of the way into the print.
We narrowed it down to the gray filament we were using. It was over a year old and had become brittle during that time. We swapped out the roll for the same color but something a bit more recent and the print finished with no problems on the next attempt.
Despite these failures, the remaining prints succeeded on their first print attempts. We want you to have a similar success rate, so we’ve outlined some of the factors we’ve controlled in our printing processes:
Firmware:
Many of these prints were completed with the firmware we just released, and the remainder with v21.12.21.0 (or alt-21.12.21.0 as required). It is important to stay up-to-date with the latest changes as we fix bugs or improve the splicing process.
Splice Tuning:
To begin, we replaced the PTFE tube inside the splice core for all units. If this tube wears out, splices can be too thick, ‘neck’ or jam inside the Palette. High levels of compression can wear out the tube more quickly, so it’s best to start with low splice tuning values (0 or 1 in most cases).
For all of these prints we used default splice settings (0 additional heat, compression, and cooling). Though other brands of filament may need additional heat and cooling. We would recommend increasing compression only once your heat is dialed in.
Printers:
We used printers that were able to connect via USB (we call this ‘connected mode’) that also had strong extruders. The Prusa Mk3 and Prusa Mini perform very well in this regard. The Ender 3 Pro is also a good candidate for printing with Palette 3, however we recommend upgrading the extruder to a metal version instead of the stock plastic pieces.
If you notice colors are consistently coming in early or late, take a look at our guide on calibration factors.
If the colors are coming in both early and late over the course of a print, then something is causing your extruder not to print filament consistently. This might be due to the added resistance of Palette 3, thick splices, or a weak extruder on the printer.
Using the shortest outgoing tube from Palette to your printer, a smooth filament path without too many turns and low compression for splicing (as outlined above) can help your printer be more consistent. In some cases, an upgrade to the printer’s extruder or for Bowden style printers, a Bowden tube with a wider inner diameter (2mm vs 1.8mm for example) can improve results.
Setups:
To give you an idea of how we set up our printers and Palettes, here are a couple images! For best results we suggest you follow the setup tips below.
A couple things to note:
- We put the filament below the Palette
- We arrange filaments on the spool holder in the order it will be loaded into Palette. This helps to prevent tangling and coming loose from the inputs
- In some cases, we run Palette lying on its back. This also helps to stop the filament from coming out of the inputs
- We typically run our Palettes without their top covers. This makes them a bit noisier, but allows us to watch the inner workings and also helps to improve splice cooling
Materials:
For the majority of our prints we used Mosaic PLA. This has been specifically designed to splice well, both due to its consistent diameter, but also because the material requires no additional heat during the splicing process.
Before shipping Palette 3, our endurance testing included hundreds of thousands of splices. In total, we used over 200kg of Mosaic PLA, which allowed us to specifically tune for this material.
In addition to Mosaic PLA, we also tested prints with Prusament and SUNLU PLAs. These brands also provide tight diametric tolerances and seemed to perform well at default splice settings.
Over the years of developing Palettes, we’ve noticed that some filaments require additional heat in order to create consistent splices. Specifically, PLA with tougheners often labelled as “Plus”, “Max”, “Tough” or “Pro” filaments can require around +3 heat (and corresponding +4 cooling).
Without additional heat, splices can be very weak and unreliable. Once splice tuning factors have been applied however, these filaments are generally less brittle and hold up well to the twists and turns going through Palette.
We look forward to seeing your prints! As always, if we can be of any assistance, please reach out to us at [email protected], we’d love to help!
Backup board firmware Melzi V2.05
I have long planned to learn how to independently configure the firmware and download it. Only one thing stopped - the impossibility of rolling back to the original firmware, if "something goes wrong." But having prepared everything for the auto level, this task rose to its full height.
Searching the Internet, I found two articles regarding this issue:
https://3dtoday.ru/blogs/craveg/eeprom-avrdude-again-about-working-with-controllers/.
The author notes that he did not succeed with the usual Chinese programmer, but I decided to try it with him, because the price of the device is less than 1.5 USD. A USBasp programmer was purchased:
https://ru.aliexpress.com/item/1pcs-New-USBASP-USBISP-AVR-Programmer-USB-ISP-USB-ASP-ATMEGA8-ATMEGA128-Support-Win7-64K/32582933115 .html and an adapter to it, since Melzi has a 6pin ISCP connector, and a 10pin programmer: https://www.chipdip.ru/product/avr-icsp
I printed a case for the programmer: https://www.thingiverse.com/thing:3096085
I had to drill another hole in the case so that the LEDs could be seen. The driver downloaded from here: https://www.myrobot.ru/downloads/ driver-usbasp-v-2.0-usb-isp-windows-7-8-10-xp.php.
There are no problems with the installation because the driver is signed. I just launched InstallDriver.exe and it was ready. I connected the programmer to the computer and then an “ambush” was waiting for me ... When I tried to work with the programmer through program avrdude . exe got this message:
avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
The firmware needs to be updated. But to update the firmware, you need another programmer! Yoprst…!
An Internet search revealed that the Arduino boards can be used for programming. Therefore, the set Arduino UNO was requisitioned from my son for a while.
I did the firmware update using this method: https://xdomus.ru/diy/usbasp-upgrade/ .
Firmware (file usbasp.2011-05-28.tar.gz) downloaded from the developer's website: https://fischl. de/usbasp/. I experienced a “slight” surprise that in 2019 a programmer with firmware earlier than 2011 is being sold.
To download the firmware, you need to connect the Arduino board with the programmer:
At first I did it with the wires from the kit, but the perfectionism instilled by the leader of the radio circle in the distant 6th grade of high school (“If you do it beautifully, it will work!”) Won, and I I made a cable from improvised means. I specially made it to connect specifically to the USBasp programmer adapter, since the Melzi board has an ISCP connector for connecting the programmer also to 6 pin. This made it possible to later read the firmware by both programmers and compare the results. It turned out like this:
Prepared the Arduino UNO programmer as described in the link above, copied the firmware file to the folder with the avrdude program. exe (it is part of Arduino IDE ). On my Windows 10, this folder is c:Program Files (x86)Arduinohardware oolsavrin . Launched the command line and executed:
avrdude -C ../etc/avrdude.conf -c avrisp -P COM 4 -b 19200 -p m8 –v COM 4 is the port to which the Arduino UNO board is connected (look at Windows Device Manager).
Next, the actual firmware:
avrdude -C ../etc/avrdude.conf -c avrisp -P COM4 -b 19200 -p m8 -U flash:w:usbasp.atmega8.2011-05-28.hex :i
No error messages received after running this command.
Well, and then ... read the recorded firmware:
avrdude - C .. / etc / avrdude . conf - c avrisp - P COM 4 - b 19200 - p m 8 - U flash : r : usbasp _ reading . hex : i
Firmware written to file usbasp _ reading . hex to the folder:
c:Users...AppDataLocalVirtualStoreProgram Files (x86)Arduinohardware oolsavrin
And then I thought a little, because the source file usbasp . atmega 8.2011-05-28. hex and the file read is usbasp _ reading . hex were quite different in size. On reflection, I downloaded the hex file converter: http://advantex.ru/joom/content/view/78/69. and converted both hex files to bin format. Bin files turned out to be the same not only in size, but also in content (compared using T otal Commander ). This instilled some confidence in the correctness of the chosen path.
Further - it's easier. On the Melzi board, I changed the jumper to USB power mode (lower position in the figure):
I connected the USBasp programmer to the Melzi board through an adapter and a standard 6 pin cable. When connecting, I was guided by the figure:
I do not give a connection diagram. There, all just the same-name contacts of the USBasp and Melzi adapter are connected to each other.
Display turned off just in case.
Next (similar to the firmware of the programmer) launched the command line and executed the commands:
Check: avrdude -C . ./etc/avrdude.conf -c usbasp -P usb -b 19200 -p m1284p –v
Read Firmware :
avrdude -C ../etc/avrdude.conf -c usbasp -P usb -b 19200 -p m1284p -U flash:r:printer_firmware.hex:i
Read EEPROM9
avrdude - C ../ etc / avrdude . conf - c usbasp - P usb - b 19200 - p m 1284 p - Ueeprom : r : printer _ eeprom . eep : i
Got no error messages. Same for Arduino UNO programmer:
Check: avrdude - C ../etc/avrdude . conf - c avrisp - P COM 4 - b 19200 - p m 1284 p - v
Read firmware:
avrdude - C ../ etc / avrdude . conf - c avrisp - P COM 4 - b 19200 - p m 1284 p - U flash : r : printer _ firmware _2. hex : i
Read EEPROM
avrdude - C ../ etc / avrdude . conf - c avrisp - P COM 4 - b 19200 - p m 1284 p - Ueeprom : r : printer _ eeprom _2 . eep : i
I compared the corresponding files received by both programmers - they turned out to be identical. Well, finally, through the Arduino IDE , I uploaded the firmware Marlin (ee was sent by the seller at one time). Native firmware - Repetier . I must say that connecting Melzi to the computer and connecting with the Arduino IDE is still that “song” ...
Changed the jumper on the board, connected the display and turned on the printer. I made sure that the firmware Marlin was flooded. Turned off the printer, returned the jumper to USB power mode, connected the USBasp programmer and uploaded the saved firmware and EEPROM:
avrdude -C ../etc/avrdude.conf -c usbasp -P usb -b 19200 -p m1284p -U flash :w:printer_firmware_2.hex:i
avrdude -C ../etc/avrdude.conf -c usbasp -P usb -b 19200 -p m1284p - Ueeprom:w:printer_eeprom_2.eep:i
Just in case, I give similar commands for the programmer based on Arduino UNO:
avrdude - C ../ etc / avrdude . conf -c avrisp -P COM 4 -b 19200 -p m 1284 p -U flash : w : printer_firmware . hex : i
avrdude - C ../ etc / avrdude . conf - c avrisp - P COM 4 - b 19200 - p m 1284 p - Ueeprom : w : printer_eeprom . eep : i
Returned the jumper on the board to its original position, turned on the printer and printed a test cube. Everything worked out!
EEPROM. Avrdude. Again about working with controllers. How to read and write data
Last time, when I wrote my "detailed answer to the question" about how to back up the firmware from Mega, I was reproached for not mentioning the EEPROM backup. At that time, I did not do it consciously, because. rightly judged that it is not worth complicating everything at the stage of the initial "approach to the projectile." The fact is that the fact that the EEPROM is not flashed when compiling and uploading the firmware from the Arduino IDE is not obvious to everyone. That is, it means that absolutely nothing is uploaded to the EEPROM when the firmware is uploaded from the IDE. And manipulations with the EEPROM (if its use is included in the firmware at all) are performed on a completely different level. And therefore, for a bare firmware backup without fine settings that MAYBE (only possible) can be stored in EEPROM, it was quite enough to save only the bare firmware. But since the question arose, why not "chew" it. Let's go in order.
What is EEPROM and why talk about it?
EEPROM - (Electrically Erasable Programmable Read-Only Memory) an area of \u200b\u200bnon-volatile memory of the microcontroller, into which information can be written and read. It is often used to store program settings that may change during operation and that need to be stored when the power is turned off.
An example of using EEPROM in a 3D printer
Consider the Marlin firmware as an example. Marlin Firmware does not use EEPROM out of the box. Configurator parameters (Configuration.h), which include the ability to use it, are commented out by default. 92]
These settings can be edited using the printer screen and controls. When using EEPROM is enabled, the following items should be displayed in the menu:
- Store memory
- Load memory
- Restore Failsafe
You can also use GCode to work directly (via Pronterface).
- M500 Stores the current settings in EEPROM until the next startup or M501 command.
- M501 Reads settings from EEPROM.
- M502 Resets the settings to the default values specified in Configurations.h. If you execute M500 after it, the default values will be entered in the EEPROM.
- M503 Displays the current settings - ''The ones in the EEPROM. ''
You can read about the EEPROM in the Repitier firmware here.
How to read and write data to EEPROM?
Similar to the backup method described in the article about backup, using the -U switch. Only in this case, after it there will be a pointer to the fact that EEPROM needs to be read.
avrdude.exe -p atmega2560 -c wiring -PCOM5 -b115200 -Ueeprom:r:"printer_eeprom".eep:i
This command reads the EEPROM data into the file "printer_eeprom.eep". If successful, you will see something like the following on the screen.
Recording is also nothing complicated and is performed by a similar command, which differs only in that the -U switch contains not "r", but "w".
avrdude.exe -p atmega2560 -c wiring -PCOM5 -b115200 -Ueeprom:w:"printer_eeprom".eep:i
If successful, you will see something like the following message on the screen.
How and why to erase the EEPROM?
To begin with, "why do this?". You need to erase the EEPROM if the previous firmware also used it, and garbage could remain in the memory. Somewhere I already came across people with problems that after switching from one firmware to another (from Marlin to Repitier EMNIP), their printer began to behave, let's say, "creatively". This is due to the fact that different firmware stores their data under different addresses. And when you try to read data from the wrong address, a pandemonium begins.
You can only overwrite the EEPROM programmatically from the firmware, but for this you have to temporarily upload a special sketch to the controller. You can read more about this in the official Arduino documentation.
If the EEPROM is erased not in the Arduino board, but in some abstract controller, then the sketch code will need to be changed taking into account the size of the EEPROM in a specific controller on the board. To do this, you will need to change the termination condition in the "For" loop. For example, for an ATmega328 that has 1kb of EEPROM, the loop would look like this:
for (int i = 0; i < 1024; i++) {.