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
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:
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:
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.
Update 20140909: I have uploaded a copy of Arduino 1.0.5-r2 for Windows to github, which is already modified to work with the AT90usb1286, so you don’t have to modify it as above. Simply go to https://github.com/lincomatic/arduino-1.0.5-r2-at90usb1286 and click the Download Zip button, and then extract the contents to your PC. My distribution also supports the USBasp in addition to the USBtinyISP.
32 thoughts on “How to Program an AT90USB1286/Teensylu/Printrboard with Arduino and USBtinyISP”
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
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.
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.
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. 🙂
Maybe you can try copying the installer to the same folder as your arduino.exe and seeing if that works?
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.
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?
Help please when I tried your hid bootloader i get this error “error reading intel hex file MarlinBill.cpp.hex.” I had this problem before and i think there is an upgraded bootloader but my searches can’t find it
I need more details about exactly what steps you took and what you’re trying to do.
I am trying to update my firmware I have a Solidoodle SD3 Solidoole board Rev E Printrboard) a sparkfun AVR pocket programmer (USBTiny ISP)
I follow all stpes in your blog compile (using Arduino 1.0.5 R2 , find and copy MarlinBill,cpp.hex. file . Open cmd window navigate and point to file hit enter and get this code
“Teensy Loader, Command Line, Version 2.0
error reading intel hex “MarlinBill.cpp.hex ”
I seem to remember from months ago when I added a Panelolu 2 I got this same error , and that I found an upgraded HID bootloader that worked it had something to do with larger memory of motherboard . I think . I had to replace my computer 2 months ago so I lost all of my files . I have tried searching but can only find your blog with the old bootloader . Any help would be greatly appreciated
Any help would be great
I just had the same problem, thought I’d let you know a solution that worked for me since you pointed me in the right direction.
I edited hid_bootloader_cli.c, on line 769 like so:
new #define MAX_MEMORY_SIZE 0x10000
After recompiling I was able to load larger .hex files. Without this change I could only load hex files that used <50% of the memory on an at90usb1286, so I assume doubling the max size should be the correct solution.
Hope this works for you
Hmm, my formatting got messed up. the line should be changed from
#define MAX_MEMORY_SIZE 0x10000
#define MAX_MEMORY_SIZE 0x20000
Sorry, I didn’t see your latest messages. I have updated my BootloaderHID.zip to include a hid_bootloader_cli.exe with Forrest’s modification. Please try it out and let me know if it fixes your problem.
Thanks so much for sharing your fix!
Sorry about delay in reply , I have been busy at work .This worked great I changed memory size and it worked . Once i uploaded it I got the display on my Panelolu to display but it says “NO SD CARD any ideas?
Thank you Lincomatic you saved my life !!
If you hadn’t solved my problem my wife would have killed me if i spent another $180 because I bricked the spare one .
I’m glad it worked! I don’t know what’s going on with your NO SD Card message. I don’t have a Solidoodle.
Hi, do not know why, but instead of that options for uploading Marlin to the Teensylu, I pushed it via Teensy 2++. Now, PC does not recognize my Teensylu, neither in Windows nor Linux. Could you please help me?
Hi, do not know why, but instead of that options for uploading Marlin to the Teensylu, I pushed it via Teensy 2++. Now, PC does not recognize my Teensylu, neither in Windows nor Linux. Could you please help me? Arduino does not recognize it, neither lsusb in linux. I have tried to install bootloader from this http://blog.lincomatic.com/?p=548 and could not recognize the Teensylu
any plans to update the boards.txt to work in ide 1.6.8 ?
Sir, I have been working on Teensylu++ 2.0 with 1286 and flat form is used is Arduino IDE. Sir, I needed to burn Marlin Firmware to bootloader to Teensylu++ 2.0 with 1286. How to do sir? Please send the steps for me. Really I needed it. Reply to firstname.lastname@example.org or here.
Thanks for the post, helped me install my new hotend!
I am trying to get a board using a AT90USB1286 chip to work with Arduino IDE 1.8.7
Can you help me?
I’ve spent a couple weeks working on this but to no avail.
Thanks in advance and feel free to email me directly.
Sorry, but it’s really too much work, and there really isn’t much advantage to doing it.
Thank you for your reply. Perhaps I should provide more detail on my problem. I have gotten to the point where I am able to compile the latest version of marlin for my board that uses a AT90USB1286 chip while using the latest Arduino IDE 1.8.7.
However, the issue I get is that the Teensy uploader pops up asking me to press the button but it says my .hex file is too large. Previously the Teensy uploader didn’t pop up in the Arduino IDE 1.05r branch you created. Why was that? I’d like to recreate that if possible. Thanks for your reply in advance, I appreciate all the help I can get with this issue.
Thank you for your great work and introduction into the topic. unfortunately I got after some tries the following error in Arduino, when I want to check the sketch:
fork/exec /Applications/Arduino.app/Contents/Java/hardware/teensy/../tools/: permission denied
I tried to give all permissions for this directory but nothing changes. I have no idea how to proceed.
Thank you for your help.
what OS, and are you using my specially modified Arduino from github?
I have followed instructions and they installed well. But, in Bootloader mode (jumpered) the AT90usb128 dfu appears in “libusb-win32 devices” and no longer as Com5. I had hope your approach would resolve that. So i cannot communicate with the bootloader but can communicate with the Pronterface thru COM ports. Any advice?
The article you replied to describes how to program the board w/ a USBtinyISP. There is no bootloader at all. If you want to use a bootloader, you need to read this article: http://blog.lincomatic.com/?p=548 . You mentioned DFU. If you installed the DFU bootloader, you need to use the Atmel FLIP tool to load the firmware, which is linked in the article. In DFU mode, it shows up as a libusb device, not a COM port.
Hey Lincomatic, I’m trying to upload the latest version of Marlin to a SAV MK1, your version of arduino’s ide does not seem to support this. What am I doing wrong? Very much appreciate any insight you can provide. – Joe
Sorry, I have absolutely no idea what you’re talking about. Could you give more details? I don’t even know what SAV MK1 is.
Let me provide some more context – I am using your arduino ide version 1.0.5r to upload firmware to this board https://reprap.org/wiki/SAV_MKI which uses an Atmel AT90USB1286. It works great for older versions of Marlin but no so much for newer versions. I was wondering if you could help me understand what I need to do to create a bootloader for an Atmel AT90USB1286 chip with the latest Arduino IDE.