Javascript required
Skip to content Skip to sidebar Skip to footer

How to Flash New Firmware Arduino Mega 2560

Page 1 of 6
  1. PsyVision

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    798
    Likes Received:
    248
    Hi Everyone,

    I'm going to put together a firmware flashing guide. This is just a placeholder for the time being, I will add content later. I will aim to cover the following topics, feel free to ask me to cover any more.

    • Driver Installation
    • Arduino IDE Setup
    • Project Setup
    • Firmware Flashing

    Driver Installation

    The Windows driver for the RUMBA board can be downloaded from the RepRap wiki:

    http://reprap.org/wiki/RUMBA#RUMBA_USB_Driver_for_Windows

    Download the ZIP file, extract the installer and run it. Follow the installer steps until completion accepting any default options.

    Edit: I'm unsure if this requires the printer to be connected over USB as part of the installation. Can someone confirm?

    Note 1: I'm not sure if this is needed for Windows 10.
    Note 2: I can't remember if the driver is signed, certain versions of Windows require you to boot into a special mode that allows unsigned drivers to be installed.

    Arduino IDE Setup
    The installer can be downloaded from the Arduino website:

    https://www.arduino.cc/en/Main/Software

    The current version is 1.6.8 and this is the version this guide will be using. When installing choose the default component installation and installation location.

    Arduino IDE is now installed, however, before we can build a new firmware there are some extra libraries required. These come bundled with the source code so will be setup in the next step.

    Project Setup
    The firmware source code is hosted on GitHub in the following repositories depending on the printer type:

    https://github.com/BigBox3D/Marlin

    Click the Download ZIP button on the right-hand side of the page:

    [​IMG]

    Extract the files in the ZIP to a sensible location on disk, I have chosen C:\3d\Firmware\

    [​IMG]

    The source code for the firmware is stored in the Marlin folder. The ArduinoAddons folder contains the 3rd party libraries needed to compile the firmware.

    Copy the U8glib folder from Arduino_1.0.x\libraries\ and Arduino_1.6.x to the libraries folder in the location we installed Arduino IDE to. If you accepted the defaults and are running x64 Windows then it will be C:\Program Files (x86)\Arduino\libraries\. If you are running x86 Windows then it will be C:\Program Files\Arduino\libraries\.

    Before proceeding further it would be wise to check that we can compile firmware okay. Navigate to the Marlin folder and double-click Marlin.ino. This should open Arduino IDE.

    Select the following options from the menu to make sure the correct board and processor options are set:

    Tools > Board > "Arduino/Genuino Mega or Mega 2560"
    Tools > Processor > "ATmega2560 (Mega 2560)"

    [​IMG]

    To compile the firmware, select Sketch > Verify/Compile from the menu:

    [​IMG]

    The compilation will take a minute or two and may well report some warnings in the output window at the bottom of the screen, these can be ignored. You should not see any errors. When compilation is complete Arduino IDE will report information about the amount of memory the program uses.

    If you receive any errors then it is likely that you either haven't setup the U8glib library or selected the right board/processor type.

    Firmware Flashing
    Note: Do not flash your printer whilst it is printing. The printer should be in 'cooldown' mode.

    Connect your printer to your computer using a USB cable. If you have the OctoPrint upgrade then open the electronics fan hatch, unplug the USB cable from the RUMBA and plug in a cable from your computer.

    Note: From the factory the board will not power up with just the USB voltage. Make sure the printer has mains power turned on too. It is possible to power the RUMBA via USB but this involves switching a jumper on the board and isn't strictly necessary.

    When connected to your computer Windows Device Manager should show the COM port. I will add a screenshot of this to confirm as soon as possible. The first time connecting it Windows may take a while whilst it sorts out the driver for it.

    Run Arduino IDE and check that it has correctly identified the correct COM port (circled in red) to use:

    [​IMG]

    If Port is greyed out and there is no COM listing afterwards, as above, then it is likely that the printer is either not connected or not detected by Windows because of a driver issue.

    To compile, verify and write the firmware to the printer choose Sketch > Upload from the menu:

    [​IMG]

    Once the printer firmware has been flashed it will reboot.

  2. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,560
    Likes Received:
    483
    I'll add in some things here as I do them. Hopefully it helps you compile something robust.

    1. Downloading Arduino 1.6.8 (84.1 MB) from https://www.arduino.cc/en/Main/Donate : installed
    2. Download Marlin Firmware for Bigbox Dual - https://github.com/joshuarowley42/BigBox-Dual-Marlin: downloaded
    3. Create a working directory called Arduino. Unzip Firmware. Remove "-master" suffix : done
    4. Enter BigBox-Dual-Marlin/Marlin. Double click Marlin.ino : done
    5. Click Verify - generates errors about U8glib.h
    6. Download U8glib.h library from https://bintray.com/olikraus/u8glib/Arduino. From Arduino IDE, choose Sketch > Library > Include .zip library and select the downloaded U8 zip file. done
    7. Click Verify - 3 warnings generated but compilation successful

    Warnings:

    sketch\ultralcd.cpp:2207:73: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), "Homing");

    C:\Users\M3D\Documents\Arduino\libraries\U8glib\utility\u8g_rot.c:48:1: warning: initialization from incompatible pointer type [enabled by default]

    u8g_dev_t u8g_dev_rot = { u8g_dev_rot_dummy_fn, NULL, NULL };

    C:\Users\M3D\Documents\Arduino\libraries\U8glib\utility\u8g_rot.c:48:1: warning: (near initialization for 'u8g_dev_rot.dev_fn') [enabled by default]

    8. Power off BigBox
    9. Open Hatch. Locate blue cable plugged into bottom left of RUMBA board, pull out. Connect similar cable directly from RUMBA to computer. Surprisingly, RUMBA is not powered from the 5v on the USB. -

    Actually the RUMBA board can be powered from USB for flashing. A jumper pin is clearly marked on the board to the left of the first stepper driver. Switch to flash. Switch back to print.
    10. Re-read instructions from Richard Gain and finally got the point of step 4. Copied from marlin zip folder from ArduinoAddons/hardware to <Arduino install location>/hardware and similarly for libraries
    11. Re-verify -
    successful compile with no warning or errors
    12. Power on BigBox - Windows complains and Arduino IDE autodetect no COM board to flash . Devices and Printer shows RUMBA ATmega 2560 co
    13. Grab RUMBA driver for Windows http://reprap.org/wiki/File:RRD_RUMBA_TAURINO_DriverSetup.zip
    14. Disconnect USB and install RUMBA driver
    15. Reconnect USB - driver installs - successfully now reports RUMBA connected on COM9
    16. Back to Arduino IDE - select COM9
    17. Upload. This recompiles and transfers the new firmware to the RUMBA.
    18. Unclear if we've been successful as the front screen seems to still report the same version.
    19. Edit Default_Version.h

    #define SHORT_BUILD_VERSION "1.1.0-RC4 (BBDual)"
    #define DETAILED_BUILD_VERSION "1.1.0-RC4 Modified for BigBox Dual"
    20. File Save, Upload. Change in version confirms code is changed.

  3. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,560
    Likes Received:
    483
    So glad I went through this. The short pips are less piercing. The dial direction change just feels more natural and, though I worried I'd have to unlearn what had become rote, changing it round just seems to work for me so much better. The dial speed is also a massive improvement. Each tactile dial notch is now a movement on the menu. This really allow for much better, more accurate bed levelling. Great job on the changes and the inital guidance to @PsyVision and Richard Gain
  4. Alex9779

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    Recommended method is using the OctoPi plugin mentioned in the next post of this thread!
    Just install avrdude on your RPi as describe here and use that plugin!

    I want to add how to flash the firmware directly from the RPi for those who have it.

    To do this you need to open a terminal connection to the RPi with SSH using terminal app on a Mac or Linux or preferably Putty if you are on Windows.
    To open the terminal app on a Mac use the 'Spotlight Search'. Just enter 'terminal' and hit enter. The enter "ssh pi@[ip or name]", enter the password when asked, you should have done something similar when you setup the RPi so...

    Install avrduded on the RPI

    sudo apt-get install avrdude

    Somehow move the firmware image file to the RPi or make it accessible
    This might be the tricky part.

    On mac or linux you can push file with sftp to the RPi. sftp is a file transfer just like ftp but over ssh. Just use the same credentials as for you ssh connection.

    Use 'lcd' to change your local directory and 'cd' to change the directory on the RPi. With 'put filename' you upload the file to the current location.

    On Windows you can use

    FileZilla to open an sftp connection over ssh to upload the file.

    On a Mac you can also use FileZilla or use 'sftp' in the terminal to send the file.

    Or you can make a share on the RPi with Samba or NFS and connect that share an put the file there. I will not cover how to do this here.

    Or you can mount a share for example on a NAS on the RPi and put the file there. That's what I do.

    Flash the firmware
    Now use avrdude in a terminal connection to your RPi to flash the new firmware to the box.

    Do not do this while your printer is printing!


    Your printer MUST NOT be connected in OctoPrint! Make sure it is disconnected before flashing or even stop OctoPrint!

    /usr/bin/avrdude -C/etc/avrdude.conf -v \ -patmega2560 -cwiring -P/dev/ttyACM0 \ -Uflash:w:[insert path to hex file]:i

  5. Alex9779

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    Oh an to fully complete this there is an OctoPrint plugin not listed in the plugin manager, I posted this on another thread here in the forum already:
    https://github.com/OctoPrint/OctoPrint-FirmwareUpdater

    You have to install it manually.
    The option to update from file seems to work well. The plugin seems to be targeted for a future web service with an auto-update function. Maybe this could be worked out to target a Github repo with a firmware. So far the admin fails to get the version from Marlin as it depends on some text in the info which Marlin does not give back.

    At least you don't have to fight with the CLI, SSH or other stuff.

    avrdude has to be installed on the RPi though for it to work...

    Just compile the firmware with the Arduino software using the option to export the binary file in the "Sketch" menu which will give you a "Marlin.ino.mega.hex" in the Marlin dir of the source repo you downloaded and upload it with the plugin...

  6. Syko_Symatic

    Syko_Symatic Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    365
    Likes Received:
    106
    Excellent guide! Followed it to the letter and it worked a treat.
  7. MaOb

    Joined:
    Sep 6, 2015
    Messages:
    5
    Likes Received:
    2
    Take care when doing that!!!!

    I had Octoprint disconnected,
    programming started fine stopped at 98% with a communication-error
    Now my RUMBA seams to be broken:(

    i tryed to bur a new bootloader with my ArduinoISP (https://www.arduino.cc/en/Main/ArduinoISP)
    but that's not working, error:
    Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

    avrdude: verification error, first mismatch at byte 0x3e000
    0xff != 0x0d
    avrdude: verification error; content mismatch
    Error while burning bootloader.

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.

    Am i doing something wrong, or is my board really broken?

  8. Alex9779

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    How? Did you pull the cable? Power shortage?As far as I can tell after a search on Google this could happen for example because of a bad USB cable connection.

    Maybe try to flash the firmware from you Desktop with the ArduinoIDE?

    I flashed the firmware about 20 times now, mostly with my describe method. The first time by connection to my Mac with Arduino IDE and did not have any problems...

    Technically there is no difference between flashing with the Arduino IDE and using avrdude. The IDE actually uses avrdude to do it...

  9. MaOb

    Joined:
    Sep 6, 2015
    Messages:
    5
    Likes Received:
    2
    when the RUMBA is connected to my PC, COM3 is shown in the device-manager
    but i assume that that is the 16u2 chip on the RUMBA
  10. Alex9779

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    It is but what is the problem with that? Just follow PsyVision's first post and try to flash the firmware...
  11. MaOb

    Joined:
    Sep 6, 2015
    Messages:
    5
    Likes Received:
    2
    that's not working for me.....?
    in the device manager, the board is shown right as a RUMBA/TAURINO Board
    Compiles fine, no problems with that!

    but uploading does not work:
    Sketch uses 137,686 bytes (54%) of program storage space. Maximum is 253,952 bytes.
    Global variables use 5,021 bytes (61%) of dynamic memory, leaving 3,171 bytes for local variables. Maximum is 8,192 bytes.
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_getsync(): timeout communicating with programmer

  12. Alex9779

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    What did you set the "Programmer" to?
    Mine is always at "AVRISP mkII"...
  13. MaOb

    Joined:
    Sep 6, 2015
    Messages:
    5
    Likes Received:
    2
    Programmer was set to 'ArduinoISP', i changed that to 'AVRISP mkII' now.....without success:-(
    But for my understanding, the programmer is only important if you are programming via ISP,
    that sould not affect the progtamming via USB.....or am i wrong?
  14. MaOb

    Joined:
    Sep 6, 2015
    Messages:
    5
    Likes Received:
    2
    fixed it :D

    had success flashing the RUMBA bootloader with my USBasp.
    (that was not working with the ArduinoISP...)
    programming with the Arduino-IDE is working now, everything is fine!!!

  15. simalblau

    Joined:
    Jan 5, 2016
    Messages:
    2
    Likes Received:
    0
    Hi

    Can someone post a video how i can flash the Firmware (step by step)
    It don t work My big box heat up but don t start printing

  16. PsyVision

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    798
    Likes Received:
    248
    I would be looking to understand why a print won't start before playing with firmware. It will likely be that the temperature has not stabilised for long enough for the printer to start printing. I would suggest a PID tune to resolve that. Otherwise, you will likely flash the firmware and have the same issue.
  17. JohnEsc

    JohnEsc Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    229
    Likes Received:
    144
    So, I Installed the OctoPrint FW Updater and the AVRDude... How do I find out what the Path to the AVRDude is for the Plugin Configuration? I used this path:
    /usr/bin/avrdude

    But when I click the Test button it doesn't do anything......

  18. Alex9779

    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,411
    Likes Received:
    735
    So does mine... Test is useless it seems...
    To get the installed path use "which avrdude". But your path should be ok...
  19. JohnEsc

    JohnEsc Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    229
    Likes Received:
    144
    And is this the URL, I would paste in the Hex File From URL: https://github.com/joshuarowley42/BigBox-Pro-Marlin.git
    ??? Sorry for all the questions, not very familiar with this... or should I just use the Browse From File and download the ZIP file for the BB Pro to my computer and use the Browse button?
Page 1 of 6

Share This Page

How to Flash New Firmware Arduino Mega 2560

Source: https://forum.e3d-online.com/threads/firmware-flashing-guide.708/