This is an old revision of the document!

This page is a work in progress: I'm unfamiliar with the formatting syntax used on here, and I'm preparing this article over the span of a few days with the bit of free time I have available. Please be patient :)

  • Why overclock?
  • Is this reliable/safe?
  • Requirements
  • Crystal selection
  • Directions
    • Crystal replacement
    • Bootloader installation
    • Marlin firmware changes
      • platformio.ini
      • macros.h
      • pins_ANET_10.h
      • speed_lookuptable.h
    • Compile and install new firmware
  • Potential issues

Why overclock?

I overclocked my printer for fun, and to learn more about the guts of Marlin.

Additionally, my build now has a stiff AM8-inspired frame, higher stepper motor currents, etc… and is capable of printing well over 100mm/s, and I've reached the point where turning up the speed further results in the printer stuttering when going around corners, because the planner can't keep up.

The 12864 LCD that I have on the printer doesn't help the situation either; it's well understood that having a graphic LCD on the printer slows down the printer, as sending pixels serially to the display takes away time from the planner. I could go back to the original character LCD display, but having a knob spoils me, and the Anet V1.0 card doesn't have sufficient I/O pins to hook up both a character LCD and a knob.

Is this reliable/safe?

According to its datasheet, the ATMega1284P processor used on the Anet V1.0 motherboard is rated for 20MHz operation at the operating point of 125 degrees C and +4.5V. If you run the processor at a higher voltage (like the regulated +5.0V that the Anet motherboard provides) and a more reasonable operating temperature, the processor should be capable of running at a higher frequency while remaining stable. Overclocking a microcontroller isn't much different from overclocking a desktop CPU in this regard.

If you're mounting your printer in an enclosure for printing ABS or whatever, this means you'll be running the processor much hotter. Overclocking the processor beyond 20MHz probably isn't a good idea.

As far as safety goes, 3D printers by nature aren't safe, especially cheap printers like the A8. There's a chance your printer could malfunction and cause damage or injury, and doing this modification does not make the printer any safer. If the processor running on the printer crashes outright, Marlin uses the watchdog timer in the processor and should reboot. But it's possible that silent corruption of the processor's state could occur, and Marlin does not have any safeguards against this. I can therefore make no guarantees of safety, and I'm not responsible for any bad consequences if your printer does something it shouldn't.

To change the crystal, you will need soldering iron, solder (lead or lead free is fine), solder wick, and a suitable place to work. Desoldering HC49S packages is a pain in the ass, having two irons or a hot air rework station greatly helps with getting the old crystal off.

Having a power supply to power the control board outside of the printer during reflashing greatly helps, this lets you make sure that everything works before you reassemble your printer. The Anet board will run from a 9V to 15V supply.

Doing this modification requires updating the bootloader on the ATMega1284P chip, so you'll need an ISP capable programmer to do this. There are a number of possibilities - buying a cheap “USB ISB” or “USBasp” programmer, using a spare Arduino board, etc. There are lots of instructions online describing how to reflash a new bootloader on a bricked Arduino board. Google around, the process for updating the bootloader is the same.

The Anet V1.0 board requires a “HC-49S” surface mount crystal. Choose one with an 18 to 22pF load capacitance, as this best matches the load capacitance provided on the Anet board.

Here are some suitable crystal frequencies to choose from:

Frequency % above stock % overclock Notes
16MHz 0% 0% Stock crystal frequency on the Anet V1.0 board.
20MHz +25% 0% Maximum clock frequency officially supported by the Mega1284P.
24MHz +50% +20% What I successfully used on my own board.
Can be salvaged from some USB devices (eg, high speed hubs)
25MHz +56.25% +25% Slightly faster, might be OK.
Significant baud rate error (see below)
Can be salvaged from devices with Ethernet (old motherboards, network cards, etc)
27MHz +68.8% +35% May be unstable.
significant baud rate error (see below)
Can be salvaged from video equipment (DVD players, etc)

If you're using the USB interface of the printer, using Octoprint for example, the crystal you choose affects how accurate the baud rate of the Mega1284P's UART will be at a given baud rate. For reliability reasons this should not exceed +-5%; lesser is desirable. If you're only printing from the SD card, this isn't an issue.

MHz (below), baud (right) 115200 230400 250000 460800 500000 921600 1000000 1500000
16 2.1% -3.5% 0% 8.5% 0% 8.5% 0% 33%
20 -1.4% -1.4% 0% 8.5% 0% -9.6% -16.7% -16.7%
24 0.16% 0.16% 0% -7.0% 0% 8.5% 0% 0%
25 0.5% -3.1% -3.8% -3.1% 4.2% 13% 4.2% 4.2%
27 1% -2.3% -3.6% 4.6% -3.6% 8.4% 12.5% 12.5%

To calculate for different clock frequencies and baud rates, use the following math:

  • UART divisor = (Processor clock) / 8 / Desired baud rate
  • Actual baud rate = (Processor clock) / 8 / rounded divisor value
  • Actual baud rate and desired baud rate should be +-5%, preferably +-2.5%

Compile Optiboot

You'll need to download and compile Optiboot first. More information can be found on the Optiboot github page:

Use the following options to compile it for the Anet V1.0 board. Change the “24000000” value to the frequency of the crystal you're using in Hz - don't forget the L on the end.

make AVR_FREQ=24000000L BAUD_RATE=57600 LED=A4 atmega1284p UART=0

Save the .hex file for later.

Marlin Firmware changes

A number of files have to be modified. These are:

  • reprap/anet/anet_mainboard_overclocking.1515033751.txt.gz
  • Last modified: 2018/12/02 01:27
  • (external edit)