AT90USB64x/128x Support for Arduino IDE

Hi all,

We recently started working with the AT90USB646 series of uC's on a project, as they perfectly fit the bill for us. To this end, we wanted to keep compatibility with the Arduino environment for our customers. While there appeared to be a few other attempts to add support, they didn't really work for us, so we created a little patch.

One of the big problems for us was the Atmel bootloader, and the original LUFA bootloader, were fairly complex in initiating the bootloader. We include a modified LUFA CDC bootloader that automatically goes into the bootloader at start-up, but will automatically start the program if PF0 is high. This way, you can simply attach a button to PF0 and press it during power-on to start the bootloader for firmware update. We also needed a bootloader indicator, so PC6 is flashed while in the bootloader (you can attach an LED, LCD backlight, etc.) The new bootloader is also at around 4k, freeing more flash space.

Everything is available here: GitHub - DynamicPerception/ArduinoAT90USB: AT90USB64x/128x Support for Arduino IDE

If people like it, we can look at doing a merge and pull request with the core Arduino project.

!c

I downloaded and installed the zip file, copied everything inside of the hardware/arduino folder as instructed. Then I opened the IDE, picked the 'AT90USB1287 16MHz' board and tried a simple blink program:

int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(250);
  digitalWrite(ledPin, LOW);
  delay(250);
}

When I try to compile that (not upload, just compile), I get the following error:

In file included from C:\Program Files (x86)\arduino-1.0.5\hardware\arduino\cores\AT90USB/LUFA/usb_cdc_hid.h:40,
                 from C:\Program Files (x86)\arduino-1.0.5\hardware\arduino\cores\AT90USB/usb_api.h:37,
                 from C:\Program Files (x86)\arduino-1.0.5\hardware\arduino\cores\AT90USB/Arduino.h:184,
                 from sketch_jun09b.ino:1:
C:\Program Files (x86)\arduino-1.0.5\hardware\arduino\cores\AT90USB/LUFA/Board.h:143:2: error: #error unsupported board

If I pick the 646, the compile works. If I pick the '1287 USBKey 16MHz', I get the same failure as above.

Hi Kirash,

I pushed a fix to the github repo for you this morning.

Here's a link to the github issue: Error with 1287/1286 on Arduino IDE 1.0.5 · Issue #1 · DynamicPerception/ArduinoAT90USB · GitHub

!c

FYI: I suggest looking at using the 1.5 version in github, with Arduino 1.5.x we now can make available all of the LUFA libraries as well. Still fixing everything up to work with the 1.5.x directory structures for libraries (a major pain, to be honest - and something I can't get working right no matter what), but there's also a nice KeyboardHost library included.

!c

Hey thanks drone. As for 1.5.x, I don't use a Due so didn't feel a need to switch to that. However, if it's beneficial for other development, I'll look into switching. Thanks for the heads up.

1.5.x supports much more than the Due - it provides a complete 3rd party build process capability, which allows us to compile the raw, unmodified LUFA libraries and make them accessible in Arduino sketches. The 1.0.x build only provides a brief, highly modified subset of LUFA - borrowed from Mattairtech and Peter Barrett (looks like some of the credit is not called out in the readme, we'll get that taken care of today.)

If you get the 1.5 nightly build up and working, per our github conversation - make sure to check out the KeyboardHost example, that's the general direction we're thinking of going with the LUFA integration, and would love feedback on it.