Uploading the Firmware

The following instructions are for uploading the pre-compiled .hex firmware images.

Get an ISP Programmer

You'll need a small AVR programmer to upload the software to the board via the 6 pin ISP connector.
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 has both an ISP 6 pin and 10 pin adapter (use the 6 pin), and provides power to your board via the USB.


It works both on Mac and PCs.

Before you can use it on a Windows machine, don't forget to download and install the USB drivers found here:
Windows XP USBtiny driver
Windows 7 USBtiny driver (see note below on installation)
The drivers are not needed on Linux or a Mac.

The XP driver installs without a hitch, but I could not install the Windows 7 driver using the provided installer. Instead, I installed the driver manually like this:

Download and unzip the Adafruit drivers folder to your desktop (https://learn.adafruit.com/usbtinyisp/download)

Usbtinyisp_libusb-win32-64_1.2.1.0

Plug the programmer into the USB port. It should show under My Computer as "unknown device" (with a yellow warning icon). We'll fix that in the next step.

Go to Control panel->devices and hardware->device manger

There you should see the "yellow icon" over the unknown device.

Open it and select update drivers. Choose the specific location and browse to the driver folder you saved on your desktop. It will complain that the driver is not signed by Microsoft. Just ignore this and choose to install anyhow.

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

Get the uploader software

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

On the Mac it's more complicated, command line might be the easiest method (see further down). However AVRDudess can run 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.

Finally, for advanced users, mostly for programmers only, you can use the complete Eclipse graphical development environment, as explained in Eclipse setup , which works wonders on any platform. It's way more involved, but it allows you to modify and compile the source code and flash the software from there.

(Old instructions for the alternate Burn-O-Mat method can still be found here).

Connect the programmer to the board

Here is the correct orientation of the cable plug:

(in case you forget the correct orientation, 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)

Unless your board has its own power source, 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":

Launch and Configure 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

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

Optional: set Bit Clock to 96. This one seems to vary: on most boards I could leave it alone (blank), but some people had to slow it way down to 96 to get rid of device signature or verification errors.

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


Download the appropriate firmware image file at the bottom of this page to your computer:
  • The master board (connected to the panel servos) needs the PanelController firmware.
  • The slave board (connected to the HPs) needs the HPController firmware.

Then 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 a dialog like this. There is more at the end confirming the fuse settings.
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.

Direct Method using Command Line

If you are comfortable with the command line this the most straightforward method, particularly on the Mac or Linux.

First you'll need to get command line tool AVRdude ("AVR Downloader-Uploader"):
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

Then open a Terminal session (Mac or Linux) or a Command Window (Windows). Here is what was reported to work on a Mac.  You should only need the Write Fuse and Flash Code commands. Be super careful with the fuse line, check the values three times before sending it...


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

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/Droid/Code/PanelController_v1.5.hex:a

Optional:

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



On the PC, teh simplest is to first copy the .hex file you want to upload to C:\WinAVR\bin\, then open a command window (Start, run..., type cmd) and to the following:


Copy the firmware .hex file in C:\WinAVR\bin\ (in this example we use the file PanelController_v1.5.hex)

Then from the command line, move to that directory:
cd C:\WinAVR\bin\

--------------------------------------------------------------------------------

Flash everything in one go (fuses + code)

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 want 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 code:

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


Choosing the Firwmare Image

Download the firmware image files from the links at bottom of this page by using the DOWN ARROW symbol.

Master Board (Panel Controller):

The current version of the PanelController is v1.6, and works with R2 Touch 1.2 or higher

There are three flavors:

  • PanelController_MP3Trigger_v1.6.hex: most people should use this. For use with the MP3Trigger sound system
  • PanelController_CFIII_v1.6.hex: for use with the CF-III sound system
  • PanelController_ReverseServos_v1.6.hex: moves servos in the opposite direction (has MP3Trigger sound)

Slave Board (HP Controller)

The current version of the HPController is v1.51.

There are three flavors:

  • HPController_v1.51.hex. Most people should use this. Standard HP servo motion max of range 90 degrees (servo pulse range from 1000us to 2000us)
  • HPController_v1.51_ExtendedServoRange.hex. Extended HP servo range motion closer to 180 degrees (servo pulse range from 500us to 2500us). Member Jason says his setup needed extended range, so I made this version available for him and everyone else. Beware, some servos don't respond to pulses beyond the standard limits. servocity.com says which ones do for sure.
  • HPController_v1.51_RestrictedServoRange.hex. Restricted HP servo range motion, less than 90 degrees (servo pulse range from 1200 us to 1800 us). Member 92Ecto says his setup needed less range, so I made this version too.

Running v2 Firmware

It is possible to run v2 firmware on v1 boards. For now you gain I2C functionality (for the REON Holos). All the rest of the code is the same. Instructions are here.

ċ
HPController_v1.51.hex
(28k)
Curious Marc,
Feb 8, 2014, 6:25 PM
ċ
HPController_v1.51_ExtentedServoRange.hex
(28k)
Curious Marc,
Feb 8, 2014, 6:27 PM
ċ
HPController_v1.51_RestrictedServoRange.hex
(28k)
Curious Marc,
Feb 8, 2014, 6:26 PM
ċ
PanelController_CFIII_v1.6.hex
(50k)
Curious Marc,
Nov 14, 2013, 9:12 PM
ċ
PanelController_MP3Trigger_v1.6.hex
(50k)
Curious Marc,
Nov 3, 2013, 6:55 PM
ċ
PanelController_ReverseServos_v1.6.hex
(50k)
Curious Marc,
Sep 30, 2015, 9:24 PM