How to Program an AT90USB1286/Teensylu/Printrboard with Arduino and USBtinyISP

My first step in loading Marlin RepRap firmware into the Printrboard is to get Arduino to play nicely with it.  The method I am going to describe in this article for programming a Printrboard with Arduino will work with the Teensylu or any other device that uses the AT90USB1286 and has an ICSP connector.   The programmer we are going to use is a USBtinyISP or compatible. Since the AT90USB1286 isn’t officially supported by Arduino, it takes a bit of setting up to get things working properly.

I first looked at the instructions on Teensylu’s page in the RepRap wiki, but found them very confusing, and I didn’t like the idea of having to send the HEX file to the MCU using an external utility instead of doing everything within the Arduino IDE. So, I set out to streamline the process and document it as I went.  If you follow my method below, you’ll be able to compile and download your firmware all within the Arduino IDE.

Step 1: Download and install Teensyduino

Teensyduino was created by PJRC for their Teensy line of boards.  Teensy is a great alternative to Arduino if you want an ultra compact board with built in USB.  The Teensy++ happens to also use the AT90USB1286, so it’s compatible w/ Printrboard/Teensylu.  Follow PJRC’s instructions for installation from the download link.

If you only plan to program for RepRap, you don’t need to install any of the libraries.  On Windows, you will be prompted to install the serial driver. Select yes.  You don’t have to worry when Windows complains that the driver is unsigned… it’s just an INF file to tell Windows to use one of its own built-in drivers.

Step 2: Modify Teensyduino Configuration for use with USBtinyISP

Download at90usb1286txt.zip.

Navigate to where your Arduino files are located.  On my computer, I have them in d:\arduino-0022.  We will call this <arduinofolder>.  Now, find the subfolder where the Teensyduino library was installed:

<arduinofolder>\hardware\teensy

If you are in the correct folder, you should already see a boards.txt and a subfolder called core in there.  Drop the files from at90usb1286txt.zip into that folder, overwriting the existing boards.txt.  You should see something like this:

If you don’t plan to develop with any of PJRC’s Teensy or Teensy++ boards, you can keep them from showing up in your Arduino menu by copying boards.txt.nopjrc over boards.txt.

Now, when you start Arduino, you should see some new configurations in the Tools->Board menu.  The important ones are:

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

To use a USBtinyISP programmer, select either [usbtinyisp]AT90USB1286 or [usbtinyisp]Teensylu/Printrboard. The only difference between the two configurations is that I took the extra useless options out to make things simpler when programming Teensylu/Printrboard.  The Teensylu/Printrboard option is the same as the AT90USB1286 option with USB Type = Serial and CPU Speed = 16MHz.

At this point, you can plug in your USBtinyISP and into your AT90USB1286/Teensylu/Printrboard and start programming!

So what are the [BootloaderCDC] configurations for?  They allow you to download sketches into your target board directly through a USB connection to your host, without the USBtinyISP programmer.  See my next article for details on how to do that.

There are 9 Comments to "How to Program an AT90USB1286/Teensylu/Printrboard with Arduino and USBtinyISP"

  • [...] menu, and select the COM port associated with your Printrboard’s bootloader. SeeLincomatic’s How to Program an AT90USB1286/Teensylu/Printrboard with Arduino article for help configuring [...]

  • [...] for this post goes to Lincomatic. I’m posting my methods and what I did to get my board working. I also think having this [...]

  • Redd says:

    hey, so after we tried uploading to the printrboard using the arduino022 compiler ..the program compiles however it takes a long time to upload and doesnt return any success or error ..it isnt even able to upload a simple blink program…any help would be appreciated

    • lincomatic says:

      Is the CDC Bootloader installed on your Printrboard? After it’s installed, you also have to set the jumper to boot into the bootloader before you can load your code into the Printrboard. See the “Booting into the Bootloader” section of my bootloaders article for details. There’s also a step by step write up in the RepRap wiki.

      • Mto says:

        Thanks for the post. I’ve used USBTiny to load CDC and was able to recover my printrboard.

        I struggled to upload Marlin software via CDC using Arduino though. It says “Done,” but nothing changes at all. So I went with USBTiny and got stuck like Redd reported above. After I left it for a while, I disconnected and connected to my pronterface. To my surprise, the new Firmware was there! I now see my name as the config author. So USBTiny method may have been working. I will test this board with the rest of the printer today.

  • wktey says:

    Hi,

    I am so interesting in your project which to bootload a printrboard using Arduino. However, I had tried the steps you stated in this post but I failed to install the Teensyduino. The software seems cannot find the Arduino.exe in my laptop during the installation. Any thoughts?
    Sorry for being noob as I am a beginner. :)

    Thanks,
    Tey

    • lincomatic says:

      Maybe you can try copying the installer to the same folder as your arduino.exe and seeing if that works?

  • 3dsheffield says:

    I am trying to get my printrbot to connect
    This is as far as I have got

    On a win 7 laptop I get the following in the pronterface .exe console. Com 5 is the port listed in device manager. Says device is abstract class control and fuctioning correctly I get one constant green LED on the printrboard (bought from a 3rd party fleabay seller in denmark)

    Exception AttributeError: “‘NoneType’ object has no attribute ‘stdout’” in <bound method Tee.__del__ of > ignored
    Traceback (most recent call last):
    File “pronterface.py”, line 1566, in connect
    File “printcore.pyc”, line 76, in connect
    File “serial\serialwin32.pyc”, line 30, in __init__
    File “serial\serialutil.pyc”, line 260, in __init__
    File “serial\serialwin32.pyc”, line 56, in open
    serial.serialutil.SerialException: could not open port COM5: [Error 5] Access is denied.

    Anything obvious?
    Many thanks
    Dave

    • lincomatic says:

      Did you use the INF file to enable the CDC serial port emulation? Try using a serial terminal emulator, such as PuTTY to talk to the Printrboard directly… can you type gcode directly to it?

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>