Solidoodle Firmware

The arduino environment is available in the fedora repos, but it does not include support for the hardware used on my printrboard (apparently the at90usb1286 chip).

To get the hardware support for that, you need the Teensyduino additions. Those are much simpler to install in a local copy of the arduino environment, so I downloaded the tarball for arduino-1.0.5 and installed the tensy additions in that tree.

When you run the arduino IDE (something I'll need to rid myself of as soon as possible), select Teensy++2.0 which is the same chip as the printrboard.

NOTE: Fix the boards.txt file to have a printrboard alias so I don't have to remember this :-).

I'm trying to build the beta firmware and after staring at the hopelessly cluttered github page, I finally found a little link down on the right hand side for copying the clone URL to the clipboard. Did that, and pasted it as the argument of a git clone command to fetch the Solidoodle-Marlin_v1 tree.

BZZZZT! The clone doesn't seem to download the beta. I don't understand how this git gibberish works. However, if I pick the download zip link I can get the beta. Where the git tree is located, I have no idea. Anyway, the zip file creates the directory I really want: Solidoodle-Marlin_v1-Solidoodle_Marlin_v1_beta

Finally decrypted enough gibberish to figure out how to pick up the source via git:

git clone -b Solidoodle_Marlin_v1_beta

That actually seems to produce a tree that matches the zip file contents.

Having done that, I now need to edit Marlin/Configuration.h to make sure it says I have a Solidoodle 2 and am building for a printrboard. This is accomplished by making sure these parameters are set:

#define MOTHERBOARD 81

I'd like to be able to put everything back exactly the way it was if something goes wrong, but no binaries for precompiled firmware seems to be available. However, I do have a handy-dandy AVRISP mkII programmer and some reading showed me it was possible to suck up the existing memory so I can put it back later:

avrdude -p usb1286 -P usb -c avrispmkII -U flash:r:printrboard.bin:r
avrdude -p usb1286 -P usb -c avrispmkII -U eeprom:r:printrprom.bin:r

That gives me two files, printrboard.bin with the flash memory contents and printrprom.bin with the eeprom contents. I can save these and write them back later if something goes wrong to restore the stock printrboard firmware and settings. (Running strings on the flash contents shows me all sorts of text I've seen the firmware print, so I do believe it correctly read the flash memory).

Note that, for a small miracle, the orientation of the plug on the cable makes it easy to connect to the programmer headers on the printrboard. No need to contort it or run it across the board from the other side :-).

Also note that the correct way to use this is to have the printrboard USB cable plugged in to provide power to the board while using the programmer (I know that wasn't obvious to me the first time I worked with the programmer).

(That does tend to make my UDEV scripts get in the way though, as the programmer keeps resetting the board which triggers the UDEV scripts. Maybe I should teach them to do a lsusb and ignore the events if the AVRISP mkII is plugged in :-).


I'm almost confident enough to try compiling and loading the new firmware now :-).

Back to building the new firmware: Somewhat to my amazment, that all compiles. Now I need to get rid of the abomination that is the arduino IDE. This magic command can help:

strace -o compile-trace.txt -v -s4096 -f -e trace=process ./arduino

That traces the complete working of an arduino IDE session, recording all the environment and NOT truncating any strings, so I should be able to extract all the commands it ran, turn them into makefile rules, and never have to use the disgusting IDE again.

Unfortunately, there is more going on than just compiling. Apparently it also creates some source files so, I haven't figured out how to eradicate the annoying arduino IDE yet, but I can use it to compile the firmware, then dig the Marlin.cpp.hex file it generates out of the /tmp/build... directory where it leaves the object files. I can then kill off the teensy programmer the IDE starts and use the mkII instead:

avrdude -p usb1286 -P usb -c avrispmkII -U flash:w:Marlin.cpp.hex

Whew! For another small miracle, it seems to work. I get the new info line when I connect RH and I can manually control things. Time to print a small test part just to make sure all is well...

Now it gets tricky. The cube printed OK till it got about 1/4 inch from the top and the extruder started clacking. Looking at it, I could see the clacking happened as it retracted when it hit the corner where it moves to the next layer. I have no idea why it started clacking only near the top.

So, the next experiment is to put back the firmware I saved off earlier and do the exact same print again.

avrdude -p usb1286 -P usb -c avrispmkII -U flash:w:printrboard.bin:r

Ack! It is even worse. The clacking starts immediately and the cube is bad all the way up:

But I didn't restore the eeprom. Let's put that back as well:

avrdude -p usb1286 -P usb -c avrispmkII -U eeprom:w:printrprom.bin:r

Ah-HA! A clue! The new test print looks perfect again:

So something is going on with the eeprom and the firmware. I wish I knew what :-).

I think I understand it now: The ConfigurationStore.cpp code keeps a version flag in the eeprom. If the version is different, then it resets all the fields to default values, so when I loaded the beta Marlin (#define EEPROM_VERSION "V09"), the eeprom settings leftover from the original Solidoodle firmware (#define EEPROM_VERSION "V07") got reset to defaults and lost all my calibration tweaks. Likewise when I put back just the flash and not the eeprom, the version was also different.

So, clearly the next step is to take a screenshot of the settings, load the new Marlin again, manually reapply all the settings to get my calibrations back, then print the test cube again:

At last! New firmware and old calibration settings are working perfectly again. I finally think I believe I can update and restore firmware now.

Go back to my main Solidoodle page.

Page last modified Mon Jan 6 20:13:01 2014