Skip to content

Loading the Booloader

Marc edited this page Nov 2, 2016 · 6 revisions

This wiki page explains how to load the Bootloader on the BCN3D Electronics Mainboard.

The Bootloader is a small program at the beginning of the microcontroller's memory that allows to reprogram the flash memory via the serial port (USB).

When the microcontroller is assembled in the PCB, it's memory is completely blank. For this reason it is necessary to use the specific manufacturer programmer to load the Bootloader. In our case, to load the microcontroller ATmega2560 is recommended using the AVR ISP mkII programmer. You can use more advanced programmers by Atmel or third parties, but this is the most inexpensive and easiest option.

Another case that may be useful to reload the Bootloader is when the microcontroller memory is corrupted and malfunctions are detected. Reloading the Bootloader will reset all memory and can solve some random errors. :Exclamation: Loading the Bootloader will detele all variables and the information stored in the non-volatile EEPROM memory.


List of Materials:

  • Computer: preferably with a Linux / UNIX operating system but also works on Windows. You must have an internet connection at least for the first time to download all dependencies locally.
  • Repository with all the files needed. Basically we need the custom Bootloader BCN3D-stk500boot.hex.
  • AVR ISP mkII programmer with its USB cable.
  • Another USB type B cable for powering the Board.

Instructions

Connecting the Board

  1. Connect the USB cable from a computer port to the Type B connector on the Mainboard. Like shown in the animations. It must illuminate a blue LED indicating that the board has 5V and orange LED. Both LEDs must be fixed.

  2. Connect the other USB cable from another port on the computer to the AVR ISP mkII programmer. Programmer light should illuminate red.

  3. Connect the AVR ISP mkII programmer 3x2 pinned flat cable to the corresponding port next to the microcontroller. The cable has polarity. If connected in the correct position, the programmer LED will light green. Otherwise, it will flash orange.

Powering the Board Properly Connected Wrong Connection
Connecting the Board via USB Connecting the programmer correctly Connecting the programmer badly

Linux / UNIX Systems

Prepare the needed files

We use a Raspberry Pi solely to perform this function due to its low cost and easy transportation. In 5 minutes we can move the entire system anywhere. The process can also be performed with any Linux distribution.

First of all, you must have git installed. If you have not, just open a terminal and type:

sudo apt-get install git

Now we can download the script for Unix and the necessary files. We do this with the following command:

git clone https://github.com/bcn3d/bcn3d-utilities.git

Loading the Bootloader

The script is already prepared to install all the necessary tools automatically. The first time you run it, it will scan your list of packages and ask if you want to install the missing ones. You need to answer everything with "y" for the script to work properly. Also, if you have internet connection, every time you run it, it will ask if you want to update the repository by downloading the latest updates from GitHub.

Navigate to the directory:

cd ~/bcn3d-utilities/Firmware uploader scripts/Unix

and execute:

./FirmwareUploader.sh

Once installed all packages and updated the repository, the script asks what Firmware version you want to load on the board. This does not matter to load the Bootloader, so select anyone.

Then appears a menu from which we select option "1" and hit enter. Automatically the load of the Bootloader process will start . Progress bars will appear and when finished, the orange LED on the electronic board will blink with a frequency of a second. This indicates that the board functions properly and is ready to receive the Firmware.

We can repeat the process infinitely disconnecting the USB and the 6-pin terminal from the programmer and connecting and a new board. Press 1 followed by return and reloads. The average time per board is around 5 seconds.


Windows based Systems

Prepare the files

First you need to install all development tools for the AVR architecture because it does not come with the operating system by default. We recommend [WinAVR] (https://sourceforge.net/projects/winavr/files/). With this package you'll get the compiler, programmer and debugger and other extras/drivers.

To download the small script for Windows and other necessary files, click on this link. Then decompress.

Loading the Bootloader

Once installed * WinAVR * and unzipped the repository BCN3D-Utilities, we can start loading Bootloaders.

Navigate to the directory within the repository just downloaded:

\\BCN3D-Utilities\Firmware uploader scripts\Windows

Run the script with right click -> run as administrator.

The script asks you if you want to load the Bootloader or the Firmware.

Type "B" and press enter. We make sure that everything is connected properly and press enter again.

The process ends when the message appears on the screen. Returning to press enter we start the process all over again.