Sample firmware for my X-A4U stick: https://flabbergast.drak.xyz/x-a4u-r2/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
flabbergast bacf194b1e Add eagle files here as well. 3 years ago
eagle-rev2 Add eagle files here as well. 3 years ago
fw-blink Add blink firmware. 3 years ago
fw-keyb-mouse Add SD code to KeybMouse firmware (read msg from SDcard). 3 years ago
fw-moodlight Fix moodlight fw. 3 years ago
fw-pulseled Update test firmwares for rev2. 3 years ago
fw-serial-keyb-pulseled Add KeyboardMouse firmware (basic). 3 years ago
.gitignore Add KeyboardMouse firmware (basic). 3 years ago
MT-DB-X4-128a4u_104.hex Add MattairTech's DFU bootloader. 3 years ago
README.md Add moodlight firmware. 3 years ago
flash-bootloader.sh Add a script for flashing bootloader + fuses + blink. 3 years ago

README.md

X-A4U stick

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

Firmware

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}.

fw-blink

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

fw-keyb-mouse

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.

fw-serial-keyb-pulseled

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

fw-pulseled

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.

fw-moodlight

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)

Bootloader

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

Fuses

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