Bootloaders for AT90USB1286

While the AT90USB1286 MCU in the Teensylu/Printrboard can be programmed with an ICSP or JTAG programmer, you can also install a bootloader, which will allow you to program it via a USB connection alone. Besides the convenience of not having to attach a hardware programmer, uploading firmware via a USB bootloader is blazingly fast. Also, it allows you to write host software to do end user firmware upgrades without a hardware programmer.

I am currently aware of 3 bootloader options for the AT90USB128x MCU’s:

DFU – USB Device Firmware Upgrade Class

This is the bootloader officially supported by Atmel.

PRO: Works with Atmel FLIP tool.

CON: requires libusb device driver; no command line tool available for Windows.  For Linux, an open source host loader app is available; can’t integrate into Arduino IDE

CDC – USB Communication Device Class

PRO: can integrate into Arduino IDE; works with avrude via avr109 protocol.

CON: requires user to know which virtual serial port it’s associated with; in Windows, uses native Windows driver, but requires INF file install, needs upgrade of avrdude to newer version for Arduino < 1.0.

HID – USB Human Interface Device Class

PRO:  Trouble free – doesn’t require any device drivers – just plug and play

CON: doesn’t integrate into Arduino IDE

 

Fuse Settings

Before you can install a bootloader on your MCU, you must set the fuses correctly to allocate space for it.  We need 4K bytes (2K words) of space, so using the Engbedded Atmel Fuse Calculator, we see that we need Boot Flash Size BOOTSZ=01,  which is in the high fuse.  Here are the fuse settings that I use on mine:

avrdude -c usbtiny -p at90usb1286 -U lfuse:w:0xde:m -U hfuse:w:0xdb:m -U efuse:w:0xf0:m

BE CAREFUL IF YOU WANT TO FIDDLE WITH FUSE SETTINGS YOURSELF.  It’s not hard to “brick” your AVR with the wrong settings.  In fact, when I was first working with my Printrboard, I managed to brick it by messing up the CKSEL bits, thinking I was supposed to set it for an external oscillator.  Luckily, all I had to do was connect an external oscillator (I used the signal generator function of my DSO Quad mini scope) to XTAL1 and then use avrdude to fix the offending fuse.  If you do something worse, like disabling SPIEN by accident, you might have to resort to HV programming.  Here is some info on recovering a bricked AVR:  http://www.larsen-b.com/Article/260.html

Note that I have set hfuse = 0xdb, which disables the JTAG interface.  This makes more I/O pins available (in particular, some of the pins exposed on the I/O headers of Printrboard).  If you want to use a JTAG programmer, you should instead set hfuse = 0x9b.

Once your fuses are set correctly, use avrdude with your programmer to upload the bootloader.  After your bootloader is installed, you don’t need to use the programmer anymore – just a USB connection is enough.

Booting into Bootloader

Once a bootloader is installed (see instructions below), the bootloader must be activated when you want to upload firmware.  To boot the AVR into the bootloader instead of normal program code, you must tie the HWB pin to ground during a RESET pulse.  To to this on Teensylu or Printrboard, simply remove the 2-pin jumper that’s next to the AT90USB1286 chip, then press and release the reset button.  You can then replace the HWB jumper.

NOTE: If you have a Printrboard RevD, the jumper has been reversed, and needs to be INSTALLED to get into the bootloader, and REMOVED to run your firmware.

Below, I describe how to install and use each of the bootloaders.  For Arduino IDE integration, use BootloaderCDC.  I also like BootloaderHID, because it doesn’t need drivers, and doesn’t require selecting a virtual serial port.

DFU Bootloader

  1. Download and install FLIP. FLIP will also install the device driver.
  2. Download BootloaderDFU.zip. I built this one for AT90USB1286 from LUFA-120219.
  3. Install with avrdude: avrdude -c usbtiny -p at90usb1286 -U flash:w:BootloaderDFU.hex:i (note if using a usbtiny and avrdude complains of a verification error at byte 0x1f000, ignore it)
  4. To flash hex files to board, after Booting into Bootloader, use FLIP or dfu-programmer.

CDC Bootloader

  1. Download BootloaderCDC.zip.  I built this one for AT90USB1286 from LUFA-120219.
  2. Install with avrdude: avrdude -c usbtiny -p at90usb1286 -U flash:w:BootloaderCDC.hex:i (note if using a usbtiny and avrdude complains of a verification error at byte 0x1f000, ignore it)
  3. To flash hex files, you’ll need a newer version of avrdude than the one included with Arduino < v1.0.  The version I use is 5.10.  After Booting into Bootloader (the first time, Windows might want a driver … point it to the INF file that I included) , type:  avrdude -c avr109 -P port -p at90usb1286 -U flash:w:firmware.hex:i, substituting your Printrboard’s CDC serial port for port, and the name of your hex file for firmware.hex.
  4. If you want to flash directly from the Arduino IDE, follow my instructions for installing my at90usb1286txt.zip files into Arduino.  Then, after restarting Arduino and Booting into Bootloader, select [BootloaderCDC]Teensylu/Printrboard from the Arduino Tools->Board menu.  Then select the serial port associated with your board.  Hit the Upload button in the Arduino IDE to compile and upload your sketch.

HID Bootloader

  1. Download BootloaderHID.zip. I built this one for AT90USB1286 from LUFA-120219.
  2. Install with avrdude: avrdude -c usbtiny -p at90usb1286 -U flash:w:BootloaderHID.hex:i (note if using a usbtiny and avrdude complains of a verification error at byte 0x1f000, ignore it)
  3. To flash hex files, after Booting into Bootloader, type:  hid_bootloader_cli -mmcu=at90usb1286 -w -v firmware.hex, substituting the name of your hex file for firmware.hex.  I’ve included the Windows binary.  For Linux or OSX, you can build hid_bootloader_cli yourself from the LUFA sources.

NOTE: When uploading a bootloader to the AT90USB1286 using a USBtinyISP, you will get a verify error from avrdude.  You can safely ignore it.  The problem is that the USBtinyISP has a bug with reading flash memory above the 64K (10000h) boundary.  However, it can write it without problems.

121 thoughts on “Bootloaders for AT90USB1286”

  1. Hi,

    First of all, thank you for putting all this information out there for us to use!

    I wondered if you might be able to help with my issue?

    I received my Printrboard with the CDC bootloader and Marlin installed, however a friend of mine didn’t. Mine is Rev.D and his is Rev.B. I bought a USBtinyISP to update his firmware and thought I’d check it on mine first. Everything checked out and I’ve gotten both boards updated, however… I used to be able to update the firmware with the Arduino IDE but now I can’t. It seems as if the boot jumper isn’t making any difference, I’ll explain.

    Before updating, when my board was working with the Arduino IDE, upon installing the jumper (Rev.D) and pressing the reset button the serial number changed to a different number from the one displayed without the jumper (from 12341 to 3d11) and I could upload new firmware.

    Now, after updating the bootloader and booting into it, the serial stays the same, Arduino gives a “Java.Lang.nullpoint” error upon uploading and I can still connect / print via Pronterface (which I’m assuming I shouldn’t when in bootloader mode).

    Do you have any suggestions? I appreciate your help.

    Colin

    1. I think they reversed the jumper in Rev.D. In my rev B/C boards, you remove the jumper and press reset to boot the bootloaders.

      Open up Windows Device Manager and look under Ports (COM & LPT).
      When the board’s in bootloader mode, you should see it as Communications Port (COMx).
      When it’s running the firmware, you should see it as Usb Serial (Communications Class, Abstract Control Model) (COMx)

      One problem may be that the original bootloader you had was improperly using a different USB VID/PID.
      I’m assuming you used my BootloaderCDC.zip. Assuming that bootloader is flashed into your Printrboard,
      with the jumpers set for bootload, right click on it in Device Manager, select Update Driver Software from the popup menu,
      and then point it to the INF file that I included. Hopefully, that will make it recognize the bootloader properly.

      If the bootloader is installed properly, then you should be able to flash the firmware using avrdude, as in my article above.
      Let’s get avrdude working properly first, then we can figure out what’s wrong w/ Arduino.

  2. Hi,

    After searching the depths of the internet I found a forum post where someone had a similar issue with an adafruit board. This resulted in me adding : “cdcteensylu.bootloader.path=undefined”
    to the teensy/boards.txt file and now I can program my Printrboard with the Arduino IDE!!

    JOY!!

    FYI I’m using OSX 10.7 so things were a little different but with the Marlin firmware loaded I see “USB Serial” in System Information and after I set the fuses, uploaded your CDC Bootloader and booted into the bootloader, System Information then said “AVR CDC Bootloader”. From there I uploaded the Marlin firmware with the Arduino IDE and it all worked.

    Again, thanks for you help. Your work has been incredibly valuable and I appreciate you posting about it all in your blog. Keep up the great work!!

    Colin

    1. Ah, I wish you’d mentioned you were using a OSX. Anyway, glad you got it working, and thanks for posting your fix… perhaps it will help someone else get it going.

  3. When setting the fuses, I found that I had to add -u (note lowercase) to disable ‘safe mode.’ I verified this by reading the fuses back, using -U lfuse:r:low.txt:h (and similar for high and ext).

    I don’t see this -u option mentioned here, or in any other AVRDUDE article on setting fuses… am I the one missing something or is everyone else?

    1. What version of avrdude are you using? While the documentation says that it’s needed for updating fuses, I’ve never had problems with not specifying -u

      1. I got the latest version I could find: Version 5.11-Patch#7610

        I just discovered that the -? option says this:
        -u Disable safemode, default when running from a script.
        ..and I did use (DOS/windows) batch files for everything. ..so perhaps safemode is _not_ active _unless_ running from the a batch file?

  4. Hi im new with printrboard tested before mezli and sanguinololu have two repraps few days ago i have bought printrboard for new project and got one problem which i hope u will help me to solve 😉 i got comunnication problem with my board and system i have try on win7 and xp and cant connect to the board i have installed stuff from printrboardfarm file but this still dose not work could u recommend some procudure to help me link my board with prontarface ?? thanks a lot

  5. Hi,

    I followed the instructions on the http://reprap.org/wiki/Printrboard#Installing_A_Bootloader and i used there fuse values and it completed with the errors like you stated it updated to the new bootloader now its bricked.. it will not register at all on any machine windows/linux/OSX. How can i de-brick this board? i checked ur link but i am unsure what any of that means. Any help would be greatly appricated.

    Thanks
    James

    1. The only way you can actually “brick” the board is to mess up the CKSEL bits.
      If you can still burn a bootloader, then you just need to redo it.
      Try following the article above.

      1. I can’t see the board on the pc and if i connect my USBtinyISP to it and try to re run the commands it fails not finding the printrboard. and the post you linked about using an external clock i have no idea how to implement. I am at a loss on how to accomplish getting back to a reprogramable state.

        1. Ouch, OK, I didn’t know that you were having trouble w/ the USBtinyISP as well.
          The other thing besides CKSEL that can make the USBtinyISP not work is if you disabled that via the SPIEN bit in the high fuse.
          But you were able to write a bootloader to the board after setting the fuses, right?
          If so, then the fuses are not your problem.
          Did you make sure to remove the jumper (Printrboard Rev A-C .. RevD the jumper should be installed) and hit reset before trying to reload the bootloader?

          1. I put the jumper on to get it into Bootloader connected the 6pin pin1 (red) closest to SD slot plugged the usb into the USBtinyISP ran those two commands. I think it errored on the fuses bits and asked me if i wanted to continue or revert.. and i didn’t reverse. But it downloaded the new bootloader failed on verification like it should have but now its just done plug it in and the light comes on but nothing won’t load on the OS regardless of jumper. would this be easier on an AIM or IRC thing I hate to fill up your comments section with nub stuff

  6. I’m no expert on this stuff. If the fuses got messed up, you have to follow the instructions in the linked article for unbricking. In my case, I knew exactly which bits I messed up, so clocking it with an external oscillator woke it up to a state where the USBtinyISP was working again. If the USBtinyISP can still see your board then just follow my instructions above.

    1. i got the bootloader to go without hassle but the board will not boot. was a driver issue before but no matter what bootloader i put on it.. windows will not find the board and i cannot load firmware to the board using your modified teensy files. Can you tell me exactly what version of IDE you use and what else you’ve changed as of right now i have a controller i cannot use but is programable via USBtinyISP and with the CDC bootloader windows can find it but not upload any firmware. and with the DFU bootloader or HID bootloader windows cannot see the board. I am at a loss

      1. After you install my CDC bootloader, you need to use my INF file in order for Windows to see it. If you manage to install firmware on it via the bootloader, then you will need to use Teensy’s INF file to see it as a serial device.
        Another way is use my [usbtinyisp]AT90USB1286 board setting, and just load the firmware directly instead of installing a bootloader.
        I am using the Arduino 0022 setup thats linked from reprap-usa.com’s Printrboard product page. I sent them my Arduino files because they were having trouble configuring it properly

        1. after much tinkering and swearing and drinking i managed to get HID bootloader working and got sprinter firmware on my board and pronter see’s the board and the printer moves.. YAY

          1. I am attempting to debug the sprinter code with Arduino 1.0.1(I’ve tried -0022 and -0023!). Our customer wants us to use the CDCBootloader in the Rev.D. I got the fuses and bootloader installed by erasing the entire AT90USB1286 via Atmel Studio 6\Device Programmer(I know now, I can insert either -u or -e to override to erase the lockbits). I have followed lincomatic’s instructions to a “T”, except attempting to use Arduino 1.0.1(Customer preference!)
            Can you explain how you got sprinter to cooperate with Arduino?
            Also, I am a noob to the software programming field. I am a Electronics Tech, and a recent Arduino UNO hobbyist.
            Any help you can give is greatly appreciated.

          2. I haven’t tried to compile anything for AT90USB1286 with Arduino 1.0+.
            For Sprinter, I had to make a bunch of changes to get the pin assignments correct,
            but Kliment accepted my changes a long time ago.
            Maybe you can try compiling my branch first https://github.com/lincomatic/Sprinter

        2. I just replied to the James you conversed with the last few days.

          First off, thank you muchly for your hard work in keeping this blog up and all your leg work you have done to make the PrintrBoard function.

          I am new to the C\C++\Arduino programming. I am attempting assist our customer with the set up of the Sprinter\Arduino programming. My limited experience is showing.

          My problem is that Arduino(1.0.1,-0022, or -0023 in WIN XP Pro SP3) and Sprinter(kliment-Sprinter-de2feb0) fail to link. Here is what I am seeing:
          “In file included from arc_fuc.cpp:26:/ Sprinter.h:6:23: warning: Arduino.h: no such file or directory”. There are several other errors, two more state “no Arduino file or directory”. I am an electronics technician by trade, an Arduino fan by hobby.
          Any assistance would be greatly appreciated!!!

          1. Arduino.h is part of Arduino 1.0+. For older versions of Arduino, it should include WProgram.h instead.
            It’s possible that the particular snapshot of Sprinter you downloaded has compile issues.
            Can you try downloading a different version? Also, you can
            try using my Arduino setup and see if that works better. http://www.reprap-usa.com/download/arduino0022.zip

  7. Thanks for answering.
    I downloaded the Arduino-0022 from RepRap this morning, just found it.
    I will get another version of Sprinter when I’m done answering this blog.
    I also downloaded your Marlin RC2 firmware and am attempting to just get a good download at this time.

  8. I took your advice to use all your modified software and an older version of Sprinter, succeeded in programming the first production unit.
    What had me stopped for a while was initialization errors with avrdude5.5. I pulled a stupid tech trick and placed the usbtinyusb 6 pin cable backwards on the header!

    We are currently doing setup for the functional test.

    I wish to thank you again for your assistance of this blog site and your reply.

  9. I work for AMIEMS,Inc, a contract electronics manufacturing and services provider.
    This product is for a 3D printer company( cannot disclose name). I am the lead electronics tech for the Test Dept.

  10. I don’t know if this matters for USBtiny but I was having a heck of a time trying to program the bootloader onto my Printrboard (rev D) it was taking 3 hours to run and still not working and all I had to do was add -u (turns off safe mode) to the avrdude commands (for setting fuses and programming the bootloader) and everything worked perfectly in 30 seconds.

    Hope this helps

    1. Just to clarify the first sentence, I was programming with the the Pololu AVR programmer so I don’t know if the -u is also needed for the USBtiny or not

      1. That’s strange. -u turns off checking that fuse bits didn’t get corrupted.
        Are you sure your fuse bits didn’t get changed?
        I don’t have to use that w/ USBtinyISP.

  11. When I would run it without the -u command, I would (only sometimes which is strange) get a response saying that the fuse bits had been changed to 2 and if I wanted to change them back to 0x9B or whatever and I would say ‘y’ and then it would just timeout for a long time and nothing would happen.

  12. Andrew, it might help you to use -e instead of -u. E.g., if you want to rewrite all the flash and EEPROM. I had to erase and then load fuse bits, then used CDCBootloader.hex. It looked like this:
    avrdude -c usbtiny -p at90usb1286 -e -U lfuse:w:0xde:m -U hfuse:w:0xdb:m -U efuse:w:0xf8:m
    It really helps to clear those lock bits first. remember, the AT90USB1286 comes preloaded with HID bootloader and lock bits set so to not allowed accidental erase or rewrite

  13. alright soooo heres my issue and no can seem to figure it out.. lastely me.. i need marlin firmware but i also what to be able to directly upload from Arduino IDE.. so i wen’t and got a stock copy of 022 then got teensydunio for that version of IDE. downloaded my firmware from your github.. complied it without errors.. but it for the life of me will not uploadfirmware to the board. I have the jump set to boot into the bootloader and it gives this error
    “avrdude: ser_open(): can’t set dtr for “\\.\COM2”
    which is the com port my board is on. so i don’t know whats up.. here my pastebin of flashing your BootloaderCDC.

    http://pastebin.com/P6Wz9AHR

    any help would be appricated

    1. 1) are you sure the boot jumper is in the correct position? if in doubt, try both. on my Windows machine, the com port number changes between the two settings
      2) have you followed the instructions in the RepRap wiki?
      3) please try using my pre-hacked arduino-0022.. there’s a link from RepRap USA in the comments section of this article
      http://blog.lincomatic.com/?p=537

      1. So I went and grabbed that copy of the arduino from RepRap USA.. and i did a file compare to mine from yours and it turns out your version has the avrdude.exe in it that is newer than the one in mine.. so i tried your copy.. uploads fine.. so i copied the avrdude and other avr files from the RepRap USA copy to my copy of arduino-0022 now my copy uploads fine.. think just an older version of avrdude caused my issues.

  14. Hi

    Newbee to this, so my question might be very simpel.
    I have a printerbot working just fine. Some modifications, but over all super enjoy and introduction to the field 3D printing.
    I like the board printerboard rev D, onboard stepper controllers etc, so I ordered one for other other application and developement.
    I thourght it was very easy to do the first simpel test.
    Compile “blink” with Arduino, and use flip to program the board.
    It seems to work fine, there is just one wrong thing….
    I’m using pin 46 im my file, but seems like the output goes to pin 61
    What am I missing ?
    Tryied selecting different board types in Arduino software.
    Can see hex file changes, but all give output to pin 61 and not 47 as expected.
    Is the board in some way locked

    Allan Pedersen
    Denmark

    1. I think maybe you are assuming the logical pin numbers used in Arduino code match the physical pin numbers on the AT90USB1286?
      They are actually arbitrarily assigned by Teensyduino.
      You can find the pin mappings in core_pins.h:
      ////////////////////////////////////
      // Teensy++ 1.0 & 2.0
      ////////////////////////////////////
      #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
      #define CORE_NUM_TOTAL_PINS 46
      #define CORE_NUM_DIGITAL 38
      #define CORE_NUM_ANALOG 8
      #define CORE_NUM_PWM 9
      #define CORE_NUM_INTERRUPT 8
      #define PIN_D0 0
      #define PIN_D1 1
      #define PIN_D2 2
      #define PIN_D3 3

      so digital 0 = PIN_D0, which is physical pin 25.
      The pins actually end at 45:
      #define PIN_F6 44
      #define PIN_F7 45
      So you can’t use any number higher than 45 for calls to digitalRead()/digitalWrite().
      But if you are using my fastio.h from Marlin, then you can use fastio for
      46 = PE2 = physical pin 43
      47 = PE3 = physical pin 9

      Which pin is pin 61 on Printrboard? I don’t understand the results you are getting.

  15. Thanks for reply

    I have found your post on the pin issue.

    Yes was assuming that the logical pin numbers match the physical pin numbers 🙂

    I made an error in my post… I’m using pin 39 to the blink test… according to diagram printerboard rev B ( not able to find printerboard rev D diagram ) it should be HotBed ( PC4_A12_0C3C)… but output appears on pin 60 according to diagram E-Therm (PF0-ADC0) . I have changed frequency etc to make sure I’m not getting cheated af something else. I’m using your 0022 Arduino version.

    So I guess it should be okay to use Teensylu\printrboard as selected board in Arduino 0022 to compile, even it is saying CDC Bootloader ? It works fine execpt for the pin issue, witch i’ll have to correct looking to core_pins.h
    After compile, I’m using Flip to program.

    Allan Pedersen
    Denmark

    1. Yes, you can use Teesylu/Printrboard CDC to generate the code. The hex file doesn’t care which bootloader you’re using, so you can just use FLIP to upload

  16. Hi again,

    Been looking around but not much info other than here 🙂
    So what I have to do is #include to my sketch ?

    If I can’t use digitalRead()/digitalWrite() pinmode(), what to use then?

    Allan Pedersen
    Denmark

  17. Hi

    I am having a bit of trouble uploading firmware to the printrboard i believe i have the DFU bootloader it even connects to flip. I try an upload with flip and if i have the verify step ticked it comes back with an error if i untick that step i looks like it uploads fine.
    From what i am seeing it looks like the flash is not being erased of written too.

    i have also tried this from a linux box with dfuprogrammer but it look like i am getting the same resolute.

    I have just bought a USBtinyISP to see if i can write it that way.

    does any one hava a suggestion i can try while i am waiting for the USBtinyISP to arrive.

    I have a rev B board and have tried uploading a hex file i created and the default firmware that came with the board.

    also the board only talks to me when i am in the bootloader and won’t talk to me when booting the firmware.

    Thank for the info this has been one of the most help places to understanding the printrboard.

    Lincoln

  18. I got the printrboard from printrbot and from what i have been reading that is what is loaded on all of theres.

    Do you know a way i can find out the bootloader version?

    Thanks
    Lincoln

    1. Lincoln,
      You may be able to verify the firmware bootloader version by verifying it against the one you think it is (DFU,CDC,HID) with Arduino software. If you use an Atmel programmer, you can read the file and verify with Atmel Studio. I can’t remember if you can how to verify using WinAVR.

      1. Actually, it’s avrdude that can help. To check for CDC:

        avrdude -c avr109 -p at90usb1286 -P\\.\comX

        replace X with your comm port number

        It’s very unlikely that the HID bootloader is installed, but if you want to test, try my instructions for hid_bootloader_cli above.

  19. Sorry about that about the avrdude. I went back and saw the mistake. I had the flu last week and some things got messed up. Did Lincoln get his problem solved?

      1. Hi guys

        After a bit more digging in found out that I some how had locked parts of the flash.
        I was using the right tools to talk to the printrboard but it just wouldn’t wipe or write.

        I only got this fixed after getting my USBtinyISP and flashing the bootloader from this Page is am now using the dfu bootloader and have flashed the repetier firmware by the bootloader.

        Does anyone have an idea on the commands for flashing a firmware by the USBtinyISP?

        Thanks for putting up this information this the only place I have found with any information that has been any help.

        Thanks again
        Lincoln

  20. Hi,

    I have a V2 Linear Prusa wired up with printrboard (CDC), Got all the programs running and compiled sprinter succesfully. (Arduino 0023) installed all programs and files stated here. As I read above, I’m having the same problem, arduino returns:

    ” avrdude: ser_open(): can’t set dtr for “\\.\COM5″ ”

    after upload. (the compile works fine though)
    Normal printrboard state will connect with com4 on my pc and when booting it changes to com5 like it sould.

    For James updating the avrdude.exe, and the files fixed the problem,
    becuase I use arduino 0023 I can’t use these (I tryed, gave me version errors)

    Could I try something else to fix this specific error?

    Thanks in advantage.
    Regards,

    Ward

  21. My (official) Pintrboard (revD) locked itself, and I used Atmel’s MK2 programmer and AtmelStudio6.1 to erase the lock bits and reinstall DFU bootloader.
    The PB now no longer connects to the computer (does not appear in Device Manager, Win7) in either boot_mode/normal_mode.

    Maybe I need to fix CKSEL and BOOTRST? I hope lincomatic or others can chime in before I brick my board.
    Here’s what my fuse values are now:

    BODLEVEL: 2V6 (options: disable, 2V0, 2V2, 2V4, 2V6, 3V4, 3V5, 4V3)
    HWBE: enable
    OCDEN: disable
    JTAGEN: enable
    SPIEN: enable
    WDTON: disable
    EESAVE: disable
    BOOTSZ: 4096W_F000 (options: 512W_FE00, 1024W_FC00, 2048W_F800, 4096W_F000)
    BOOTRST: disable
    CKDIV8: enable
    CKOUT: disable
    SUT_CKSEL: EXTOSC_8MHZ_258CK_65MS (options: EXTCLK_6CK_0MS, EXTCLK_6CK_4MS1, EXTCLK_6CK_65MS, INTRCOSC_6CK_0MS, INTRCOSC_6CK_4MS1, INTRCOSC_6CK_65MS, EXTLOFXTAL_32KCK_0MS_INTCAP, EXTLOFXTAL_32KCK_4MS1_INTCAP, EXTLOFXTAL_32KCK_65MS_INTCAP, EXTLOFXTAL_1KCK_0MS_INTCAP, EXTLOFXTAL_1KCK_4MS1_INTCAP, EXTLOFXTAL_1KCK_65MS_INTCAP, EXTLOFXTAL_32KCK_0MS, EXTLOFXTAL_32KCK_4MS1, EXTLOFXTAL_32KCK_65MS, EXTLOFXTAL_1KCK_0MS, EXTLOFXTAL_1KCK_4MS1, EXTLOFXTAL_1KCK_65MS, EXTXOSC_0MHZ4_0MHZ9_258CK_4MS1, EXTXOSC_0MHZ4_0MHZ9_258CK_65MS, EXTXOSC_0MHZ4_0MHZ9_1KCK_0MS, EXTXOSC_0MHZ4_0MHZ9_1KCK_4MS1, EXTXOSC_0MHZ4_0MHZ9_1KCK_65MS, EXTXOSC_0MHZ4_0MHZ9_16KCK_0MS, EXTXOSC_0MHZ4_0MHZ9_16KCK_4MS1, EXTXOSC_0MHZ4_0MHZ9_16KCK_65MS, EXTXOSC_0MHZ9_3MHZ_258CK_4MS1, EXTXOSC_0MHZ9_3MHZ_258CK_65MS, EXTXOSC_0MHZ9_3MHZ_1KCK_0MS, EXTOSC_0MHZ9_3MHZ_1KCK_4MS1, EXTXOSC_0MHZ9_3MHZ_1KCK_65MS, EXTXOSC_0MHZ9_3MHZ_16KCK_0MS, EXTXOSC_0MHZ9_3MHZ_16KCK_4MS1, EXTXOSC_0MHZ9_3MHZ_16KCK_65MS, EXTXOSC_3MHZ_8MHZ_258CK_4MS1, EXTXOSC_3MHZ_8MHZ_258CK_65MS, EXTXOSC_3MHZ_8MHZ_1KCK_0MS, EXTXOSC_3MHZ_8MHZ_1KCK_4MS1, EXTXOSC_3MHZ_8MHZ_1KCK_65MS, EXTXOSC_3MHZ_8MHZ_16KCK_0MS, EXTXOSC_3MHZ_8MHZ_16KCK_4MS1, EXTXOSC_3MHZ_8MHZ_16KCK_65MS, EXTXOSC_8MHZ_XX_258CK_4MS1, EXTXOSC_8MHZ_XX_258CK_65MS, EXTXOSC_8MHZ_XX_1KCK_0MS, EXTXOSC_8MHZ_XX_1KCK_4MS1, EXTXOSC_8MHZ_XX_1KCK_65MS, EXTXOSC_8MHZ_XX_16KCK_0MS, EXTXOSC_8MHZ_XX_16KCK_4MS1, EXTXOSC_8MHZ_XX_16KCK_65MS)

    Fuse registers:
    EXTENDED: 0xF3
    HIGH: 0x99
    LOW: 0x5E

    Any help is appreciated!

  22. The Printrboard Wiki is what confused me.
    http://reprap.org/wiki/Printrboard

    It recommends using your settings (except with JTAG enabled) for CDC and HID bootloaders, but a different set of fuse values for DFU bootloader. I am currently using DFU with the standard CDC settings and it works perfectly again.

    LOW: 0xde
    HIGH: 0x9b (same as yours except with JTAG enabled)
    EXTENDED:0xf0

    Thank you for the help!

  23. Hi Lincomatic,
    You could consider the Caterina/LUFA bootloader used with Arduino Micro (ATMega32U4) also…

    I am looking into doing a port of the Arduino Micro bootloader (Caterina/LUFA) to a Teensy 2.0++. (http://www.adafruit.com/products/1315)

    I like the fact that the Micro supports a software reset (1200 baud switch) which eventually goes to the user program (like the original Arduino DTR toggle trick) and that I could use the Arduino IDE with or without Teensyduino. In fact the software reset is the whole reason I am looking into this. Using Win7/C# I have had no luck getting HalfKay to reset to a user program on Teensy 2.0++.

    I think I can handle the bootloader recompiling for ATMega1286 and ISP loading to the Teensy2.0++. But I have a question you may be able to answer: where do you think the 1200 baud switch is interpreted for the reset function? I did not see it in the bootloader code and wonder if its embedded in a resident USB driver somewhere. Any insight you could give would be greatly appreciated.
    Thanks,
    Bill

  24. Hello!

    I have Printrboard Rev.D, and the first time i plugged it to my pc tried with repetier-host and couldn’t move my printer.

    Now i’m trying to do your tutorial to load bootloader and firmware.
    I’ve tried with windows7 and ubuntu, usbtinyIsp and arduino as an isp, trough avrdude and arduino Ide, and still i can’t program it.
    Here is the code of my last attempt nuno@npc:~/Desktop$ sudo avrdude -c avrisp -P /dev/ttyACM0 -p at90usb1286 -F -D -U flash:w:BootloaderCDC.hex:i
    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.01s

    avrdude: Device signature = 0x000000
    avrdude: Yikes! Invalid device signature.
    avrdude: Expected signature for AT90USB1286 is 1E 97 82
    avrdude: reading input file "BootloaderCDC.hex"
    avrdude: writing flash (131072 bytes):

    Writing | ################################################## | 100% 0.57s

    avrdude: 131072 bytes of flash written
    avrdude: verifying flash memory against BootloaderCDC.hex:
    avrdude: load data flash data from input file BootloaderCDC.hex:
    avrdude: input file BootloaderCDC.hex contains 131072 bytes
    avrdude: reading on-chip flash data:

    Reading | ################################################## | 100% 14.68s

    avrdude: verifying ...
    avrdude: verification error, first mismatch at byte 0x0000
    0xff != 0xa5
    avrdude: verification error; content mismatch

    avrdude: safemode: Fuses OK

    avrdude done. Thank you.

    nuno@npc:~/Desktop$ sudo avrdude -c avrisp -P /dev/ttyACM0 -p at90usb1286 -F -U flash:w:Repetier.cpp.hex

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.01s

    avrdude: Device signature = 0x000000
    avrdude: Yikes! Invalid device signature.
    avrdude: Expected signature for AT90USB1286 is 1E 97 82
    avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
    To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "Repetier.cpp.hex"
    avrdude: input file Repetier.cpp.hex auto detected as Intel Hex
    avrdude: writing flash (59902 bytes):

    Writing | ################################################## | 100% 8.15s

    avrdude: 59902 bytes of flash written
    avrdude: verifying flash memory against Repetier.cpp.hex:
    avrdude: load data flash data from input file Repetier.cpp.hex:
    avrdude: input file Repetier.cpp.hex auto detected as Intel Hex
    avrdude: input file Repetier.cpp.hex contains 59902 bytes
    avrdude: reading on-chip flash data:

    Reading | ################################################## | 100% 6.71s

    avrdude: verifying ...
    avrdude: verification error, first mismatch at byte 0x0000
    0x0c != 0xa5
    avrdude: verification error; content mismatch

    avrdude: safemode: Fuses OK

    avrdude done. Thank you.

    Have i messed up with the fuses in the proccess?
    Or is something that i missed?
    Any help would be very appreciated!
    Regards Nuno

    1. It’s possible that the fuses are messed up. Either that, or the connection of the USBtinyISP is loose.
      Did you reprogram the fuses? If so, what command line did you use, and did it show any errors?
      BTW, you shouldn’t bother trying to force it. If your device signature is wrong, the communication is messed up, and you won’t get good results.

  25. I’m trying to load the CDC bootloader using the following command:

    avrdude -c usbtiny -p at90usb1286 -U flash:w:BootloaderCDC.hex:i

    the problem I’m having is that it keeps telling me that there is no BootloaderCDC.hex file or directory. Is there somewhere I need to install it? I am working in a windows 7 environment and it’s been awhile since I’ve done anything in a command line. Any help will be appreciated, thanks

      1. I did that, but I run the avrdude command it doesn’t see the hex file. Does it need to be installed in a certain directory?

        1. put it into the directory from which you invoke avrdude. or put the full path .. e.g. c:\temp\BootloaderCDC.cpp.hex

  26. I have Marlin firmware installed, but when I try to use Pronterface to control printer it goes haywire. It seem like the stepper motors run backwards and if I try to operate the extruder everything locks up. By the way, my printer is a mini Kossel delta; I don’t know if that is what is causing the problems. Any ideas?

  27. You need to configure it properly. The parameters are all in Configuration.h.
    Sorry, it’s very complicated. I can’t walk you through it. I suggest that you contact your vendor or ask on the reprap.org forum for help.

  28. Hi When i try to load the firmware into Printrboard rev E i get an error in the command prompt that says, error reading intel hex file “firmware.ccp.hex”

    I suspect i am not naming the file correctly so that they match. What should the file names be so it will be recognized in the command prompt.

    Thank You

      1. It is Marlin.cpp.hex. I made the file and the address in the command prompt match.
        Didn’t fix the error. I tried Marlin.hex for both. I still believe it my naming that is causing the errors but i just have’t gotten the correct combination yet.
        Can the hex file name be most anything as long as they match, The one in the HID folder and the one in the command prompt?

  29. Hello! I don’t know if you can help me or not, but I’m struggling with getting the firmware to upload onto my printrboard rev D.

    I’ve tried both on mac and win7, using AVRDUDE and an usbtinyISP, I can flash the boot loader (have tried CDC and DFU) and everything appears to work fine. It does get the validation error, but as you said, you can safely ignore. Here is where the problem lies…

    Neither the mac nor the windows machine will recognize the printrboard from the USB port. I have tried to follow everything I can find to the letter, but no luck. I am doing the jumper / reset as well.

    With the DFU installed, Flip doesn’t recognize the printrboard when plugged in.
    With CDC installed, no port is recognized on either the mac or the windows machine. It wasn’t clear whether or not I was supposed to run avrdude -c avr109 through the USBtinyISP to ISCP or through the onboard USB, but neither seems to work.

    I’m hoping you have something else I might be able to try. This all started with me attempting to update the firmware via FLIP and finding that it was locked.

    Thank you!!

    1. Do you still have the jumper set to program the bootloader? The computer can’t detect it otherwise.
      On the RevD-E, you have to remove the jumper to load the firmware (the opposite of RevA-C).

    2. Hi, I got the CDC bootloader running my locked up Rev D board this weekend and updated the firmware (Printrbot Simple Metal). See the blog on my website for details; couldn’t have done it without Adafruit and Lincomatic!

      Basically, I used a USBtinyISP and avrdude to set the fuses on the AVR and uploaded the CDC BL, then disconnected the SPI cable and connected the printer directly to the laptop via USB. My Win7 laptop saw a new device connected and installed the Teens y USB Serial Driver onto a new com port. This is the port that you have to use when uploading the firmware using
      “avrdude -c avr109 -P -p at90usb1286 -U flash:w::i”

      BTW, I tried all 3 bootloaders before I got CDC to work; had different problems with both DFU and HID:

      HID: “error reading intel hex file” ; users on the solidoodle site think this is due to the size of the latest firmware file that has both LCD and SD card support (doubled in size)

      DFU: I could also not get the bootloader to show up as a Windows device, though I was using the factory fuse settings as reported on reprap.org. Didn’t try it with the fuses spec’d here that are being used for all 3 bootloaders.

      1. Hey, I have a solidoodle and I’m exactly in the situation you described. Since I tried to add an LCD to my printer, I can’t upload my firmware any more… Indeed the size of the .hex file increased.
        Did you find a solution? I’m new in this field and I am very lost… Even after days and nights of research I can’t find anything… I will be very thankful if you or lincomatic could help me…

        Bye

        Pierrealexb

        1. Hi Pierrealexb, are you able to remove the LCD from the system and load an older non-LCD version of the Solidoodle firmware? This would tell you if your board and bootloader are still working correctly.

  30. I just wanted to note my failure and success here.

    I flashed the CDC bootloader and couldn’t get it to show up in in the Arduino IDE (only in bootloader mode) with the provided fuse settings. Using the settings from the above mentioned reprap.org wiki page ():

    avrdude -c usbtiny -p at90usb1286 -U lfuse:w:0xDE:m -U hfuse:w:0x9B:m -U efuse:w:0xF0:m

    Got it to show successfully. I haven’t taken the time to understand the differences in the fuse settings, (only in the high fuse) but it seemed to be the thing that worked for me. No idea why. I’m on a Rev D Printrboard, OS X 10.9

  31. Good afternoon,
    I like a lot this board, because his power (more than Mega’s) and its size. Also it has everything I need, and nothing else. I have had several problems with arduino+ ramps (all qualities, from chineese’s to spanish’s) and would like to buy one, but I have seen the Readme on his developer’s github. Would like to hear some impressions about the board, its speed (I have a delta, and mega was not powerfull enought) and problems about it. Also I have seen this one http://es.aliexpress.com/item/3D-Printer-Teensylu-V0-8-Board-Hi3D-RepRap-Prusa-Mendel-Printer-Driver-Board-Free-shipping/1471865277.html?isOrig=true#extend what do you think about it? It is the 0.8 revision, not the 0.9, does it improve much?Thank you all!

    1. You’re not going to get any speed boost switching from a Mega+RAMPS to any board based on the AT90USB1286. They run at the same speed. If you want more speed, you need to go to an ARM board like a Smoothie or the Azteeg X5.

      1. Oh! You are right, I have heard that it was quickler but it is not true. Could you please tel me about your impressions, problems and anything could be useful to a potential buyer 🙂
        Thankyou!

  32. Hello,

    Thanks for sharing your work with us. Its very much appreciated.

    I have a printrboard revD (i think its a clone of some sort). It looks exactly like another board I have which is a RevD direct from Printrbot.com.

    When i plug the usb into my laptop (tried linux and win7), I get absolutely nothing. On linux, lsusb command does not show the printrboard, with either jumper on or jumper off. After reading about bootloaders, i suspected the bootloader was missing or corrupt. I followed your article and installed your DFU bootloader using an AVR pocket programmer and avrdude as you describe. The processes went seemingly flawless, including setting the fuse values you mention.

    However….. playing with jumper on, jumper off, reset button, and full power cycle in every combination, I still cant get a computer to recognize the board. Its as if im not even plugging it in! (I’ve tested the usb cable with my other printerboard of course, and it works fine).

    Any ideas? Any other ways of testing the board and its usb system?

    Thanks for any help you might be able to provide!
    -Tim

    1. I haven’t played w/ the Printrboard on linux yet, but if it’s not detected as a USB device with or without the bootloader jumper installed, and you wrote a bootloader to it, it really sounds like the USB port on your board is not working. Try tracing the pins from the USB port, and make sure they’re all connected. I’ve had the USB connectors break off on 2 of my boards… at least the traces on the connector broke. I had to bridge the connections w/ some solder to get them working again. Good luck.

  33. i was wondering if you had a delta version of marlin…. all the sources ive been to have alot of issues… most of wich i have already worked threw thanx to you sharing this forumm with everyone!! 😉 i recently was able to afford a kit (without electronics) for a delta rostock. I took apart my old (bought it last year) 1up printer (rev d printrboard) i used teensy last year to set the firmware… but now have gone threw every bit of the config file to iron out the issues i have ( when i disable the auto bed leveling feature(i dont have a probe) it throws out a few errors… any way) when i load it to the printer it displays about 6,000kb 97% used, then it throws two lines out saying that connection was dropped

    1. Marlin isn’t really idea for deltas. I played with it a bit, using the latest version from github, and then switched to a smoothie board. Though the Marlin team always ignored my pull requests, someone
      else managed to get some of my changes into the mainline code.

  34. I followed the instructions as best as I can, but when I try to upload the CDC bootloader, its succeeds (log here http://pastebin.com/7WF8JYEQ) but then when I unplug the programmer and plug in the USB and press the restart button, it doesn’t show up at all on my Windows PC. My board is a Ref F.5 and the commands I used are in the pastebin. If you could help me connect my board to my PC I would be much appreciated.

    1. I don’t have a Rev F Printrboard. Assuming that you installed the HWB programmer to install the bootloader, did you remove the jumper after the bootloader was installed?

          1. Sorry, I meant the HWB jumper, not HWB programmer… so even though you disabled the HWB after programming it still doesn’t show up?

      1. Yes, Even after putting it back into firmware mode, i cant see it on my computer. I dont know what else i could do.

        1. When you say you can’t see it on your computer, what do you mean? What OS are you using? If you’re using Windows, it should show up in the Device Manager.

          1. Ive tested it on Windows 7 8 and 10 and checked the device manager multiple times, tried to connect to it over com ports 1-20 and all that. no sign of it. This is the reason i came to this thread in the first place. I tried to reprogram it and its still not working. Im probably just going to get a new board.

          2. 1) did you install the USB CDC INF file that I included with the bootloader? If not, it won’t be recognized properly as a serial port
            2) When you have the Device Manager open, and unplug/plug the Printrboard into the computer, does it react? You should at least see the list of devices close/reopen and possibly a serial port or unknown device appear/disappear

          3. Yes, I installed the inf file and pluged in and unpluged multiple times, im thinking its a bad board. Thank you for the guide and the help.

          4. I’ve had the USB connector break loose on mine. If that’s not the problem, and the board is able to communicate with avrdude via your programmer, then I think that the problem might be due to operator error. If you want to pay shipping both ways and send it to me, I’d be glad to take a look.

  35. I’m new to this blog, thanks for the comments above- they are really helpful!
    I am using AT90USB1287 as the MCU for product which allows the end user to update the firmware through the application installed in their PC, through the USB by DFU-programmer.
    The AT90USB1287 chip has the lock_bits preloaded which prevent user to hack the firmware through the JTAG by ISP. The loophole is:
    The user can erase the whole chip by ISP, reload the Bootloader without lock_bits setup, after this step, the chip can connect to the application in the PC again and the firmware can be reloaded through DFU-programmer.
    After the firmware reloaded, the user/hacker can extract the whole firmware through the JTAG by ISP. That’s the reason why I asked if the LOCK_BITS can be setup through the DFU-programmer (by bootloader).
    Is there any possible solution to solve this issue?

    1. I could be wrong, but I don’t think DFU can be used to set lock bits. Try using Atmel’s DFU utility. If it can’t do lock bits, then I would say that you definitely can’t set them from the DFU bootloader.

      1. Thanks for the response! You are correct, I tried to use DFU-programmer commands to get or set the fuse, lock bits, none of them can be read or write by DFU- always show me that the target (chip) won’t support the operation.

  36. i am a student and I’m new to at90usb1286 microcontroller. Till now i have worked on atmega32,atmega8,atmega328. i heard that at90usb has on chip usb.
    could anyone please tell me answers for the following questions.

    1. how can i use on-chip usb of at90usb1286 and what procedure i have to follow for this.

    2. could you please tell me that fuse bits for external crystal frequency at 11.0592Mhz

    3. please suggest any links regarding these.

    any help will be appreciate greatly.

    excuse me for bad english.

      1. Hi, thanks for giving reply. It is my kindly request you that I need to dump the program into at90usb1286. Sir, actually i have ponyprog2000, but it doesn’t support. and I have progisp hardware(atmega8 based), chinese progisp software, by using these hardware and software i lost two at90usb1286 permanently. I don’t trust these progisp hardware and software.
        Could you please suggest me of programming tools. I am unable to buy JTAG, stk500 e.tc

        Excuse me for bad english..

          1. program your firmware with avrdude
            avrdude -c usbtiny -p at90usb1286 -U flash:w:yourprogram.hex

            in the article above, I used USBtinyISP instead, but I don’t recommend it, because you will get warning messages.

  37. You could try looking up the usbtiny programmer. These are cheap, but a good purchase. I used these to program these chips for a customer with excellent results.
    The usbtiny is open source also.

    1. I actually use the USBtinyISP in the article above. Unfortunately, it has problems with HEX files >64K, so it gives warnings during verification when loading big files into the AT90USB128x

  38. thanks for the info,
    https://www.amazon.com/Printrboard-Printer-Electronics-Stepper-Drivers/product-reviews/B00I50FYWG
    In the end I can not update the firmware to enable the LCD Smart Controller.
    ok, I think I have a Chinese slide clone in my hands, because it does not say PrintrBoard, just “Rev D”, but it has the “start mode” disabled and it is not visible as an atmel device when I press the reset button, same as the Serial LPT device of the teensyino driver.
    I tried it, fuses, boot administrators, CDC, FUD, but maybe these Chinese chips arrive with the internal HWB block to boot mode.
    Thank you anyway.

  39. I struggled with attempting a firmware reload thru the Arduino IDE. In about 8 hours of playing around, it actually downloaded the printer firmware once thru an Arduino nano that I was using as a programmer.

    In the end though…..it wasn’t repeatable and required hooking up the jumper wires. I finally wised up and used the above instructions for the HID_bootloader_cli. Worked the first time.

    When it ran, the host CLI reported finding the halfkay bootloader on the AT90USB target. This was after I thought I’d downloaded the HID bootloader (several times). Regardless…..it now works to download the Marlin code (w/o even making the jumper change on my printrboard).

    My advice to anyone desperate enough to read all these comments is to try the update using the HID bootloader cli before doing anything else. If that fails, then try flashing the bootloader.

  40. I have a printrboard Ref F5. I followed your instructions for flashing the DFU bootloader along with setting the fuses. It seemed to work, and my printer boots into its firmware. However, now I cannot get back into programming mode, despite installing the BOOT jumper. My USB device shows up with the same VID and PID (16C0 and 0483) in either mode. I also can’t program through the TINYusbISP, since you need to be in programming mode to use that! Please help me, I need to reflash my printer to make it usable and now I can’t!

    1. some revs program with the jumper in, some with it removed. try it both ways. and you must program it with DFU compatible software. what are you using to program it? also, hardware programmers are not affected by bootloaders. if you can’t program it with usbtiny or usbasp and avrdude, you’re using the wrong parameters. send more info please

      1. I solved it this morning!

        The problem was that I flashed the new marlin firmware from the ISP header. This evidently overwrote the DFU bootloader, so the board was operating without a bootloader. This meant I couldn’t use Amtel Flip. It also meant that the correct AVRdude command changed. I was able to reflash a bootloader using the following command:

        avrdude -c usbtiny -p at90usb1286 -P COMX -U flash:w:at90usb128-bl-usb-1_0_1.hex

        Where COMX is replaced with the COM port which the printer shows up as. Once the bootloader was on, I was able to put it into DFU boot mode and load a firmware using FLIP.

  41. Hey thank you for the write up, I’m still looking at it even in 2024! Im looking to install any of the bootloaders, however the links to the bootloader zip files dont work anymore. Can someone update the links?

    Thanks!

    1. AFAIK, the links still work. Your web browser might be blocking them as insecure files. What’s the error message you get and which files
      are you trying to download?

Leave a Reply