Tuesday 8 March 2016

Updating RepRapFirmware and PanelDue firmware using Mac OS X as a host

(Guest post by Michael Hackney, SublimeLayers.blogspot.com and www.EclecticAngler.com)

Recently, I worked out the process for updating Duet and PanelDue using a Macintosh computer as a host. Once you have the right tools and information, it's quite simple. I've tested this on Mac OS X Yosemite and El Capitan.

Firmware updates for both the Duet and PanelDue are performed via USB. Before we can update that firmware though, we need to install the right tool. This tool is called BOSSA and is an Open Source flash programmer for the Atmel SAM microcontroller used on both the Duet and PanelDue. Unfortunately, there are many different versions of BOSSA, including both command line (BOSSAC) and GUI versions, but only a few of them will actually work! Not to worry, I'll make sure you get a workable version.

You can get the BOSSAC command line utility with the Arduino IDE 1.6.1 release. This release is no longer supported but since you can install multiple versions of Arduino IDE on OS X, it isn't an issue to install it. Another option is to find a copy of the BOSSAC utility and use that. I've extracted BOSSAC from the Arduino 1.6.1 IDE and made it available on my Google drive: BOSSAC for Mac OS X.

2) Get the new firmware
Once you have the BOSSAC utility, you need to download the firmware you are planning to install. These are found on David Crocker's GitHub here:

PanelDue firmware

I like to keep the BOSSAC utility and the firmware versions all in one place in a single folder for convenience.

3) Find the Duet's or PanelDue's port number
This is the most finicky step in the process but this should make it a little easier. The tricky part is that the device we need is not available until you press the Erase and Reset buttons on the Duet or PanelDue. But, there already may be devices with similar names so it isn't obvious which one to use. So, I look in the device directory (/dev) first, then Erase-Reset the board and then look in the device directory again to see what's new!

  • Launch the Terminal application and type "cd /dev" and press [return] (without the quotes). /dev is the directory where Mac OS X keeps all of its device files.
  • There are lots of devices in the directory but we are only interested in a particular type. You can see everything by issuing the "ls" command. But to narrow it down to the USB device we need, run "ls | grep tty.usbmodem". 
  • Now hook up the USB cable to your Duet or PanelDue and press the Erase button and then the Reset button. 
  • Run "ls | grep tty.usbmodem" again and watch the output for the new device that should be found. It will look something like tty.usbmodem14444421 but most likely with a different number sequence.
Now we're ready to flash the new firmware. I'll show two ways of doing this depending on if you are using the Arduino IDE BOSSAC or the "naked" BOSSAC. In both cases you run BOSSAC from a Terminal window, so launch Terminal if needed. Then, "cd" into the folder where you keep your firmware .bin files to make it easier.

4a) Running BOSSAC from the Arduino IDE
Type the following command into the Terminal window but replace the YOUR_PORT_# with the port number you found in step 3 and the firmware version you are uploading. Note that this assumes several things: 1) that you installed the Arduino 1.6.1 IDE in your Applications folder and that you have "cd" into the folder that contains the firmware. Make sure you type it exactly and don't forget the "-R" at the end:
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/bossac --port=tty.YOUR_PORT_# -U true -e -w -v -b RepRapFirmware-1.09o-dc42.bin -R

4b) Running BOSSAC directly
This example assumes that you have placed the bossac utility in the same folder with your firmware .bin file and you have "cd" into the folder in a Terminal window. Make sure you type it exactly and don't forget the "-R" at the end:

./bossac --port=tty.YOUR_PORT_# -U true -e -w -v -b RepRapFirmware-1.09o-dc42.bin -R

Here is an example of what you should from bossac as it runs:
./bossac --port=tty.usbmodem1444431 -U true -e -w -v -b RepRapFirmware-CHTest-3.bin -RErase flashWrite 309308 bytes to flash[==============================] 100% (1209/1209 pages)Verify 309308 bytes of flash[==============================] 100% (1209/1209 pages)Verify successfulSet boot flash trueCPU reset.
When bossac finishes, it resets the board and you are ready to go.