Skip to content

Instantly share code, notes, and snippets.

@x45dev
Created December 6, 2023 22:10
Show Gist options
  • Save x45dev/edfa3985cb5c7ce3b5835f7493d62060 to your computer and use it in GitHub Desktop.
Save x45dev/edfa3985cb5c7ce3b5835f7493d62060 to your computer and use it in GitHub Desktop.
How to flash a bootloader onto Creality CR10-Mini controller board (Melzi 1.1.2 Atmega1284p) with Linux/Raspberry Pi and USBasp

Flash bootloader onto Creality CR10-Mini controller board (Melzi 1.1.2 Atmega1284p)

About

Steps to flash a bootloader onto Creality CR10-Mini controller board (Melzi 1.1.2 Atmega1284p) with Linux/Raspberry Pi and USBasp

Unlike CR-10S variants, the CR10 Melzi boards do not come with a pre-flashed bootloader, so this needs to be done first before flashing other firmware onto the controler board.

Hardware and software environment

  • Ubuntu laptop (x86_64) or Raspberry Pi
  • USBasp hardware connector (link below)
  • avrdude CLI

Steps

Flash the bootloader

The bootloader can be flashed using the USBasp hardware connector from a standard laptop or a Raspberry Pi - it's totally your choice. To keep the steps separate from the process of installing Klipper (via MainsailOS), the follow steps were used on a standard Ubuntu 21.04 system.

  1. Power off and unplug printer.
  2. Open control box to expose controller board. Connect the USBasp, ensuring that the pin orientation is correct. (I used the ISP header pinout images linked below to identify the GND pin, and then ensured that adapter was oriented correctly with its own GND.
  3. Install avrdude on the laptop/RPi; download the bootloader; test USBasp connection; flash the firmware.
sudo apt install avrdude
wget https://raw.githubusercontent.com/Lauszus/Sanguino/master/bootloaders/optiboot/optiboot_atmega1284p.hex

# Test USBasp connection
# There is no need to edit avrdude.conf if using the USBasp rather than connections via GPIO pins.
# Run this command. "If it doesn’t error out and it says ‘deviced initialized’ towards the end then everything is good."
sudo avrdude -p atmega1284p -C /etc/avrdude.conf -c usbasp -v

# Flash the bootloader
sudo avrdude -p atmega1284p -C /etc/avrdude.conf -c usbasp -v -U flash:w:optiboot_atmega1284p.hex:i

Done! :)

References and Credits

Things that didn't work

  • Attempting to flash the bootloader via ArduinioIDE with "Sanguino" board config. I successfully loaded the third-party board config but couldn't get the IDE to detect the board. Troubleshooting the board detection issues included attempting to run the IDE as root, creating udev rules, adding my user to the dialout group, etc.
  • Attempting to flash the bootloader via RPi bootable flashing image. The guide I found used Balena Etcher to write a RPi bootable disk image to a SD card, which is then used to boot the RPi and automatically flash the connected board via RPi pinout connections. This didn't work for me - I think because I was using a USBasp rather than pinout connections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment