Fork 0
Sample firmware for my X-A4U stick: https://flabbergast.drak.xyz/x-a4u-r2/
Go to file
flabbergast bacf194b1e Add eagle files here as well. 2015-02-25 10:57:20 +00:00
eagle-rev2 Add eagle files here as well. 2015-02-25 10:57:20 +00:00
fw-blink Add blink firmware. 2015-01-17 10:25:34 -10:00
fw-keyb-mouse Add SD code to KeybMouse firmware (read msg from SDcard). 2015-01-17 16:15:50 -10:00
fw-moodlight Fix moodlight fw. 2015-02-24 18:00:34 +00:00
fw-pulseled Update test firmwares for rev2. 2015-01-09 11:03:54 +00:00
fw-serial-keyb-pulseled Add KeyboardMouse firmware (basic). 2015-01-17 10:25:07 -10:00
.gitignore Add KeyboardMouse firmware (basic). 2015-01-17 10:25:07 -10:00
MT-DB-X4-128a4u_104.hex Add MattairTech's DFU bootloader. 2015-01-08 22:12:59 +00:00
README.md Add moodlight firmware. 2015-02-24 10:02:49 +00:00
flash-bootloader.sh Add a script for flashing bootloader + fuses + blink. 2015-02-20 23:49:38 +01:00


X-A4U stick

Current revision: rev2 (microSD, RGB led, button).


Example firmwares are in fw-* directories. See below for the current list. The firmwares can be compiled by running make in the appropriate directory, and after the putting the stick into DFU mode, it can be flashed with make dfu.

Note that the USB capable firmwares use Dean Camera's remarkable LUFA library - so you'll need to download, unpack and copy the LUFA subdirectory into the appropriate subdirectory here.

Of course, all compilation is done by avr-gcc. Windowed people can use WinAVR {or ATMEL studio}.

Blink (on/off) the green led with 700ms delay.


Act like a composite Keyboard+Mouse device. "Type" a message on pressing the E0 button. The content of the message is read from the file called MESSAGE.TXT in the top directory of the first (FAT-formatted) partition on the microSD card.


This demo uses LUFA to pretend to be a USB Keyboard and Virtual CDC Serial device. The RGB led changes colour with time.


No USB interface. Three possible tests (select by #define in the source):

  • Blink test: just blink the three colours on the RGB LED.
  • PWM test: the LED on rev2 breathes, one colour after another.
  • SD test: try accessing the microSD card. Blinks blue before the test. If successful, switch to green.


A subset of fw-serial-keyb-pulseled functionality - just breathe/change colour of the RGB LED. No USB, no microSD, no button.

Revision 2 notes

There's a mistake on the silkscreen in RGB colour marking: E2 is red and E3 is blue. (I guess this depends on the RGB LEDs that I have.)

Technical info (can be ignored, it's for me to remember)


At the moment, I use DFU bootloader compiled by MattairTech. MT-DB-X4 page Bootloaders


Need to program bootrst fuse, and MattairTech also changes watchdog settings. I don't know if that's really needed. Nothing else is changed:

    avrdude -p x128a4u -c avrisp2 -U fuse1:w:0x00:m -U fuse2:w:0xBF:m -U fuse4:w:0xFF:m -U fuse5:w:0xFF:m

fuse1 consists of two 4-bit initial watchdog values (normal and window, see page 127 of xmega manual). AVR stick uses 0xFF (no watchdog) and MattairTech uses 0x00 (8ms watchdog).

EESAVE is bit3 of fuse5 (0 -> eeprom is preserved during erase), so to save eeprom on chip erases, use fuse5:w:0xF7:m. However this doesn't prevent the (DFU) bootloader to erase eeprom, and indeed, it's impossible to have DFU not erase eeprom without recompiling.

Bootloader and lockbits

Flash the bootloader with

    avrdude ­p x128a4u ­c avrisp2 ­U flash:w:MT­DB­X4­128a4u_104.hex

MattairTech also locks bootloader and r/w. Don't want that (so don't do the following):

    avrdude ­p x128a4u -c avrisp2 ­U lock:w:0x3c:m