Friday, March 6, 2015

Updating Your Printrboard Firmware (OS X)

Part of a series on installing the hotend.

Thank the Community

The people at Printrbot Talk have done a good job of documenting everything over the years. I could almost just write "go read everything there" but some of it has aged out. The main page on Firmware is chock full of details so you should become antiquated with it.

Downloads

I'm on a Mac (currently Yosemite) and there are a lot of Mac specific downloads thanks to user PxT. I started a fresh folder for all the downloads so they wouldn't get mixed in with other stuff. Nothing should need to be installed so you can easily delete and/or archive the folder when you are done.

First you need to download the firmware. Printrbot keeps their branch of the Marlin firmware on github so you can go ahead and grab it from their releases page on GitHub. I don't know exactly what Printrbot you have so I can't tell you what you need but I have a Simple Metal with a Rev D board so I needed the standard issue Simple-Metal-1403-Firmware. Check your Printrboard to see what revision you have before you get too far.

Assuming you have a Mac, next you'll need to download an Arduino Build Environment and the Firmware Update App. You could roll your own Arduio Build Environment and find other tools to flash a new firmware on your board but Printrbot's tool leads you through the steps. Find both of these tools on the PxT user page on Printrbot Talks. To get the Arduino Build Environment to work you may have to install Java. That's outside the topic of conversation here but this install solved my problems for now.

Unzip anything that looks unzippable and make sure the apps will open. Feeling overwhelmed yet? We haven't even gotten our hands dirty.

Arduino Setup

The Arduino download saves you a lot of work hunting around for installs and putting files in odd places, but there are still 2 more things you need to do before you can get to work. You are going to compile your firmware by running verify on a specified board.

Your firmware will be compiled in a silly location so check the 'compilation' box to show verbose output during compilation. Everything else on this window can stay the same. If you are planning on compiling more than once you'll want to uncheck the 'Update sketch files to new extension on save' box, but you shouldn't have to.
See the compilation button I checked?
Now you'll need to tell the Arduino app to write data for Printrboard. You can compile for the usbtinyisp or the BootloaderCDC boot loader.  Older documentation suggests the BootloaderCDC variant. Newer documentation suggests the usbtinyisp variant. I found the older documentation first and compiled with BootloaderCDC (It worked for me). You should probably compile for usbtinyisp because it is the more current suggestion.

[Wild Speculation] The Mac OS X Firmware Update App comes bundled with the DFU bootloader so I'm guessing it bolts that on as the actual boot loader it uses. This would make sense that I built with BootloaderCDC (the bad one) with no problems. The firmware I was uploading was just a hair too big for the memory (addressed later) and two firmwares would do that.

[usbtinyisp]Teensylu/Printrboard
[BootloaderCDC]Teensylu/Printrboard

Edit the Source

Have you ever done any programming in C++ before? Now is the time to beef up your resume. In the Arduino app open up the 'Marlin.pde' file in the Marlin subdirectory. It is linked to all the other files so you'll see a bunch of tabs open up.

Open up the Configuration.h tab, it is the only one you'll need, and find the TEMP_SENSOR definitions. You only have one temperature sensor and it needs to be updated from '0' to '5' so edit the line '#define TEMP_SENSOR_0 0' to '#define TEMP_SENSOR_0 5' and save the file. The 5 here refers to the thermistor that shipped with your E3D v6 hotend and the 0 was the thermistor that was on your Ubis.
#define TEMP_SENSOR_0 5
Oddly, the binary of the firmware you compile this way is just a hair too large to fit on the memory of your Printrboard. Luckily there are pieces you probably don't need. Lower in the Configuration.h file you'll find a collection of definitions that enable cool new pieces of hardware that work for Marlin boards. If you are like me you don't have any of them and you probably never will. I chose to disable support for the Ultipanel, so I recommend you do that as well. Add '//' to the front of the Ultipanel definition line so edit the line '#define ULTIPANEL //the ultipanel as on thingiverse' to '//#define ULTIPANEL //the ultipanel as on thingiverse' and save the file.
//#define ULTIPANEL //the ultipanel as on thingiverse

Compile and Copy

Now hit that green checkmark in the upper left hand corner to verify your code. This will actually compile it. You'll see a bunch of warning fly by but everybody else says that's fine, so just ignore those messages. Watch the console at the bottom of your Arduino app to finish and take note that it lists a long ugly directory that contains your Marlin.cpp.hex file.
blah/blah/blahMarlin.cpp.hex
You'll want to put that hex file someplace that's worthwhile because you'll need it. I just opened a terminal and copied the file to my desktop with a proper name using the cp command.
cp blah/blah/blah/Marlin.cpp.hex ~/Desktop/Printrbot.hex

Flash the Firmware

Depending on the version of your board you'll need to add or remove a BOOT jumper. If you need to add it (like me) a piece of folded aluminum foil is good enough to get the job done. All you need is to make sure the pins are shorted for a few minutes.

Using the provided Firmware Update App is pretty easy. You just drag and drop your hex file onto the app and it leads you step by step the things you need to do. If you don't drag and drop it'll ask you some information about your printer. Follow the directions as it asks you about your USB cable and your jumper. Press the reset button and carry on.

If you try to write a flash a firmware file that is too large the App will throw an error that doesn't say anything about file size. Basically the code you uploaded is large enough that it tries to put too much information in the Bootloader. You can solve this by removing more features from the Configuration.h file.
Bootloader and code overlap.

Success

If you get a success message then you have successfully flashed your Printrboard. Time to continue on and autotune your hotend.

9 comments:

  1. The Y stepper wiring is backward in the marlin source. I just flipped my connector around, but maybe I could edit the config.h if I knew where to look ...

    ReplyDelete
    Replies
    1. The official Printrboard firmware flip-flopped on stepper wiring as well between updates. I don't know how closely they were following the marlin source at the time. I agree that flipping a connector is easier than flashing the board again.

      Delete
    2. Line 295 of Configuration.h is where you flip the y-axis, change the value from true to false

      Delete
    3. @Robert, thanks for hunting it down. I'm sure it'll help somebody out.

      Delete
  2. Spoon

    Great guide do you have a link to the pritrbot 1504 makers rev.d firmware so i can do this mod?

    ReplyDelete
    Replies
    1. Release notes on the Firmware state that the 1403 is intended for the Simple Maker 1405 as well. My Printrboard is a Rev. D (same as yours) and I didn't have any issues with the 1403 Firmware.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete