MarcDuino Firmware Upload

Choose which firmware file to install

The procedure is mostly here for MarcDuino v1 boards

The v1.5 and v2 come with the firmware pre-loaded,so you should not have to do anything. But just in case, you can follow the same procedure to change or update the firmware on these later boards too.

Beware of the version conventions, there are Firmware v1 and v2s, and MarcDuino boards v1, v2 and v1.5:

v1 Firmware is for v1 MarcDuinos.

The v2 firmware runs on the MarcDuino v2 AND the MarcDuino v1.5 boards. It adds I2C support which works with REON Holo projectors at the moment, but you can also send your custom I2C commands. Otherwise there is no other change.

It is actually possible to run v2 firmware on v1 boards, but wiring has to change slightly because a few pins have to be reallocated to liberate the I2C pins. It's a relatively simple modification. Go to this page if you want to make the modification.

Master vs. Slave Firmware

For MarcDuino v1 and MarcDuino v1.5 boards, the firmware is the piece that makes the board master or a slave. Otherwise the boards are the same. The MarcDuino v2 boards are physically different: master firmware goes on the master board, and slave firmware on slave board obviously. However the firmware comes pre-loaded on the v2s, so you should not have to worry about that.

v1 Firmware Download Links

Recommended defaults are in bold, see notes for other available variants

MarcDuino Firmware

v2 Firmware Download Links

Recommended defaults are in bold, see notes for other available variants.

v2 Firmware

Get a Pocket AVR Programmer

There are many so-called "ISP programmers" available. My favorite is also the least expensive, PocketAVR from Sparkfun:

https://www.sparkfun.com/products/9825

It comes both with an ISP 6 pin and 10 pin connector at the end of the cable. The MarcDuino uses the 6 pin one.

Install the programmer drivers (Windows only, not needed on Mac or Linux)

The Windows USB drivers are found here:

Windows XP USBtiny driver (the Windows XP one installs without problems)

Windows 7 USBtiny driver (the Windows 7 has to be installed manually see procedure below)

The Windows 7 driver would not install automatically. I had to install it manually like this:

1- Download, unzip the USB driver folder and put it on your Desktop. The driver folder was called:
Usbtinyisp_libusb-win32-64_1.2.1.0

2- Plug the programmer into the USB port. I

3- Go to Control panel->devices and hardware->device manger
In the list there should be an "unknown device" with a yellow icon over it.

4- Double click it and select "update drivers". Choose the "specific location" option, and browse to the driver folder you saved on your desktop. It will complain that the driver is not signed by Microsoft (dang Microsoft). Choose to "install anyhow". 

5- It should now start installing normally. Takes a while. After it's done, you can check under My Computer. The programmer should now be properly recognized as "USBtiny".

Download AVRDudess (Windows only)

If you are on a PC, use this graphical upload tool: AVRDudess

On the Mac, command line explained later is the easiest method.

Note 1: I was nevertheless able to run AVRDudess on the Mac under Mono. 
On Mountain Lion, I also had to install XQuartz.
Once Mono is installed, launch avrdudess from the terminal (after having navigated to your avrdudess folder):
 mono avrdudess.exe 
After waiting a (long) while for Mono to initialize, it finally appears and works just fine.

Connect the programmer to the MarcDuino board

Here is the correct orientation of the cable plug. There is a tiny triangular arrow on pin 1 of the connector just below the wires at the left, that has to point to the 1 printed on the board.

You will need to power the board through the programmer while uploading. To do so, make sure the sliding switch at the bottom of the board is towards "Target Power":

Uploading the firmware using AVRDudess

Configure it as follows:

Programmer: USBtiny (or whatever ISP programmer you use)
MCU: ATMEGA328p
Flash: Then navigate to the .hex firmware file you want to upload (from the bottom of this page, see below which image to choose)
Fuses: enter as shown in picture,
L: 0xff
H: 0xdf
E: 0x07
Check the box that says "Set Fuses"
Optional: set Bit Clock to 96. This one seems to vary: on most boards I could leave it alone (blank), but on some boards I had to slow it way down to 96 to get rid of device signature or verification errors.

Triple check the fuse entries. Mis-configuring the fuses can brick your board forever.

You should end up with a configuration that looks like the picture below:

Save the configuration for later use by hitting Save... in the Presets box at the top right.

From AVRDudess, navigate to the firmware image you down loaded (.hex file) using the [...] button in the Flash section.

Hit the "Start Button", and you should see the output progress appearing like this:


If it complains that it cannot find the USBTiny, unplug it and re-plug it again in the USB port, and try again.

If it misreads the device signature or you have verification errors, increase the time in the Bit Clock field to slow down the download. I was able to upload with values as low as 48, but some users had to use up to 96.

As soon as the flash upload is done and verified, the red LED on the MarcDuino board should start to blink exactly one second on, one second off. This indicates that the real time module has loaded and that the software is running.

Uploading the firmware using the command line

This the most straightforward method for Mac or Linux, also works on Windows.

Get command line tool AVRdude:

It is part of the Crosspack AVR on the Mac:

Crosspack AVR download for Mac

It is part of WinAVR on Windows:

WinAVR 2010-10-10 download for Windows


Open a Terminal session (Mac or Linux) or a Command Window (Windows).

Commands for the Mac

Write the fuses first. Be super careful with the fuse line, check the values three times before sending it. You can brick your board if this goes wrong:

Write Fuses:
/usr/local/CrossPack-AVR-20130212/bin/avrdude -C /usr/local/CrossPack-AVR-20130212/etc/avrdude.conf -p m328p -P usb -c usbtiny -u -U efuse:w:0x07:m -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m 

Then flash the code. In this example the firmware file is on the Desktop and is called PanelController_v1.5. hex. Replace for the correct location and name of the firmware file you want to upload:

Flash code:
/usr/local/CrossPack-AVR-20130212/bin/avrdude -C /usr/local/CrossPack-AVR-20130212/etc/avrdude.conf -p m328p -P usb -c usbtiny -U flash:w:<user>/Desktop/PanelController_v1.5.hex:a

The verification steps below are completely optional:

Read and Verify fuses commands are added here for info, if you need it for debugging

Read Fuses:
/usr/local/CrossPack-AVR-20130212/bin/avrdude -C /usr/local/CrossPack-AVR-20130212/etc/avrdude.conf -p m328p -P usb -c usbtiny -U efuse:r:./efuse.hex:i -U hfuse:r:./hfuse.hex:i -U lfuse:r:./lfuse.hex:i


Verify Fuses:
/usr/local/CrossPack-AVR-20130212/bin/avrdude -C /usr/local/CrossPack-AVR-20130212/etc/avrdude.conf -p m328p -P usb -c usbtiny -U efuse:v:0x07:m -U hfuse:v:0xDF:m -U lfuse:v:0xFF:m 


Commands for the PC

Copy the .hex file you want to upload to the C:\WinAVR\bin\ directory (in this example we use the file PanelController_v1.5.hex)

Open a command window (Start, run..., type cmd) and navigate to that directory:

cd C:\WinAVR\bin\

Flash everything in one go (fuses + code)

Write fuses and flash firmware:
avrdude -C avrdude.conf -pm328p -cusbtiny -u -Uflash:w:PanelController_v1.5.hex:a 
-Uefuse:w:0x07:m -Uhfuse:w:0xDF:m -Ulfuse:w:0xFF:m 

If you prefer to do the operations individually:

Write Fuses:
avrdude -C avrdude.conf -pm328p -cusbtiny -u -Uefuse:w:0x07:m -Uhfuse:w:0xDF:m -Ulfuse:w:0xFF:m 

Flash firmware:
avrdude -C avrdude.conf -pm328p -cusbtiny -u -Uflash:w:PanelController_v1.5.hex:a

Verify that the firmware is running

As soon as the firmware upload is completed, the MarcDuino red LED should start flashing once per second. Success!

If the flashes, but very slowly (once every 8s), you probably did not download the fuses. Make sure to check the little box that says "Set fuses" on AVRDudess and try again.