Atreus won't stay connected outside of bootloader mode

I have an atreus that used to work fine. Then several months ago I tried flashing the firmware using chrysalis and now I get no input when I type on it. At the time I read something about problems when you hold the esc key too long while flashing and thought that may be the issue, but I had no luck making that work at the time. Since a new version of Chrysalis came out in October I decided to try again.

I’m on OS X 12.6, intel silicon, with the latest release of Chrysalis and Kaleidoscope.

Right after I plug it in or press the reset button, if I open the system report I can see the Atreus Bootloader USB device attached, but that always disappears after about 30 seconds. Chrysalis, Arduino IDE, and ardunio-cli can all pick it up in that first 30 seconds also.

Screen Shot 2022-12-21 at 5.55.17 PM

0. Assumptions about bootloader mode

First, to clarify an assumption I made, I’ve seen posts and Chrysalis refer to holding esc while flashing, holding esc while plugging in, and pressing the reset button all relating to entering bootloader mode. I think these are all roughly the same thing:

  • When I plug it in it boots up, and holding esc tells it to load the bootloader only.
  • When I hold esc as I tell Chrysalis to flash, it is programmatically rebooted and then loads the bootloader.
  • When I press the reset button, it is manually rebooted and since I pushed that button it knows to load the bootloader (I think, or maybe this one is part of my device’s broken behavior).

Notably, whether I hold esc or not, every time I plug it in I see the bootloader appear in the system report. I’m not sure if that’s the expected behavior or not. If any of this is incorrect, please let me know.

1. Flashing with Chrysalis

I can only connect the keyboard to Chrysalis in that 30 sec bootloader window, so I do that and race through the menus to flash with the latest firmware and do a factory reset, but this always fails. I get an “Error flashing the firmware” popup. Here’s the “report a problem” bundle.

{
  "timestamp": "2022-12-22T00:16:44.061Z",
  "uuid": "fc954ffa-cc48-48ce-a72b-6d9a1df0e1f5",
  "chrysalis": {"version": "0.12.0"},
  "os": {"platform": "darwin", "distro": "macOS", "release": "12.6", "codename": "macOS Monterey", "kernel": "21.6.0", "arch": "x64", "hostname": "Tims-MacBook-Pro-2.local", "fqdn": "Tims-MacBook-Pro-2.local", "codepage": "UTF-8", "logofile": "darwin", "serial": "06A10466-36D7-3A0B-9EE7-A9053A8991A3", "build": "21G115", "servicepack": "", "uefi": true},
  "usb": [{"id": null, "bus": null, "deviceId": null, "name": "AppleUSBXHCI Root Hub Simulation", "type": "Hub", "removable": false, "vendor": "Apple Inc.", "manufacturer": "Apple Inc.", "maxPower": null, "serialNumber": null}, {"id": 2, "bus": null, "deviceId": null, "name": "Bluetooth USB Host Controller", "type": "Controller", "removable": false, "vendor": "Broadcom Corp.", "manufacturer": "Broadcom Corp.", "maxPower": null, "serialNumber": null}, {"id": 17, "bus": null, "deviceId": null, "name": "USB Receiver", "type": "Storage", "removable": true, "vendor": "Logitech", "manufacturer": "Logitech", "maxPower": null, "serialNumber": null}, {"id": 23, "bus": null, "deviceId": null, "name": "Atreus Bootloader", "type": "Storage", "removable": true, "vendor": "Keyboardio ", "manufacturer": "Keyboardio ", "maxPower": null, "serialNumber": "atreus"}],
  "logs": [
    {"args": ["/keyboard-select"], "level": "debug", "message": "navigating to location", "timestamp": "2022-12-22T00:03:37.121Z"},
    {"function": "find", "label": "focus", "level": "debug", "message": "serial port list obtained", "portList": [{"path": "/dev/tty.Bluetooth-Incoming-Port"}], "timestamp": "2022-12-22T00:16:01.230Z"},
    {"function": "find", "label": "focus", "level": "warn", "message": "no supported devices found", "timestamp": "2022-12-22T00:16:01.234Z"},
    {"function": "find", "label": "focus", "level": "debug", "message": "serial port list obtained", "portList": [{"path": "/dev/tty.Bluetooth-Incoming-Port"}, {"locationId": "14100000", "manufacturer": "Keyboardio ", "path": "/dev/tty.usbmodematreus1", "productId": "2302", "serialNumber": "atreus", "vendorId": "1209"}], "timestamp": "2022-12-22T00:16:05.404Z"},
    {"devices": [{"focusDeviceDescriptor": {"bootloader": true, "info": {"displayName": "Keyboardio Atreus", "product": "Atreus", "urls": [{"name": "Homepage", "url": "https://shop.keyboard.io/products/keyboardio-atreus"}, {"name": "Forum", "url": "https://community.keyboard.io/"}, {"name": "Chat", "url": "https://keyboard.io/discord-invite"}], "vendor": "Keyboardio"}, "keyboard": {"columns": 12, "rows": 4}, "usb": {"bootloader": {"productId": 8962, "protocol": "avr109", "vendorId": 4617}, "productId": 8963, "vendorId": 4617}}, "locationId": "14100000", "manufacturer": "Keyboardio ", "path": "/dev/tty.usbmodematreus1", "productId": "2302", "serialNumber": "atreus", "vendorId": "1209"}], "function": "find", "label": "focus", "level": "debug", "message": "supported devices found", "timestamp": "2022-12-22T00:16:05.420Z"},
    {"level": "info", "message": "Connecting to port", "path": "/dev/tty.usbmodematreus1", "timestamp": "2022-12-22T00:16:06.853Z"},
    {"args": ["/focus-not-detected"], "level": "debug", "message": "navigating to location", "timestamp": "2022-12-22T00:16:07.076Z"},
    {"args": ["/firmware-update"], "level": "debug", "message": "navigating to location", "timestamp": "2022-12-22T00:16:08.481Z"},
    {"level": "info", "message": "Starting to flash", "timestamp": "2022-12-22T00:16:14.723Z"},
    {"label": "flash", "level": "info", "message": "executing step", "step": "flash", "timestamp": "2022-12-22T00:16:14.737Z"},
    {"error": {}, "label": "flash", "level": "error", "message": "Error during flash", "timestamp": "2022-12-22T00:16:19.279Z"},
    {"error": {}, "level": "error", "message": "Error while uploading firmware", "timestamp": "2022-12-22T00:16:19.279Z"},
    {"label": "toast", "level": "debug", "message": "Toast message received", "msg": {"message": "Error flashing the firmware", "variant": "error"}, "timestamp": "2022-12-22T00:16:19.300Z"},
    {"args": ["/keyboard-select"], "level": "debug", "message": "navigating to location", "timestamp": "2022-12-22T00:16:19.318Z"},
    {"level": "info", "message": "Disconnecting from keyboard", "path": "/dev/tty.usbmodematreus1", "timestamp": "2022-12-22T00:16:19.319Z"},
    {"args": ["./"], "level": "debug", "message": "navigating to location", "timestamp": "2022-12-22T00:16:19.319Z"},
    {"args": ["/keyboard-select"], "level": "debug", "message": "navigating to location", "timestamp": "2022-12-22T00:16:19.324Z"},
    {"function": "find", "label": "focus", "level": "debug", "message": "serial port list obtained", "portList": [{"path": "/dev/tty.Bluetooth-Incoming-Port"}, {"locationId": "14100000", "manufacturer": "Keyboardio ", "path": "/dev/tty.usbmodematreus1", "productId": "2302", "serialNumber": "atreus", "vendorId": "1209"}], "timestamp": "2022-12-22T00:16:19.344Z"},
    {"devices": [{"focusDeviceDescriptor": {"bootloader": true, "info": {"displayName": "Keyboardio Atreus", "product": "Atreus", "urls": [{"name": "Homepage", "url": "https://shop.keyboard.io/products/keyboardio-atreus"}, {"name": "Forum", "url": "https://community.keyboard.io/"}, {"name": "Chat", "url": "https://keyboard.io/discord-invite"}], "vendor": "Keyboardio"}, "keyboard": {"columns": 12, "rows": 4}, "usb": {"bootloader": {"productId": 8962, "protocol": "avr109", "vendorId": 4617}, "productId": 8963, "vendorId": 4617}}, "locationId": "14100000", "manufacturer": "Keyboardio ", "path": "/dev/tty.usbmodematreus1", "productId": "2302", "serialNumber": "atreus", "vendorId": "1209"}], "function": "find", "label": "focus", "level": "debug", "message": "supported devices found", "timestamp": "2022-12-22T00:16:19.344Z"}
  ]
}

Additionally, the electron console reports this error:
Error: Firmware on the device does not match local data

2. Flashing with Kaleidescope’s Makefile / ardunio-cli

I followed the instructions in the readme here GitHub - keyboardio/Kaleidoscope: Firmware for the Keyboardio Model 01 and other keyboards with AVR or ARM MCUs.

When I try VERBOSE=1 make flash it looks like it compiles just fine but I saw this in the output that looked suspect:

Bootloader file specified but missing: /Users/tsaylor/projects/Kaleidoscope/.arduino/user/hardware/keyboardio/avr/bootloaders/Atreus2/Caterina.hex

And the upload step gave me this error:

To update your keyboard's firmware, hold down the key in the lower left corner of your Atreus.

When you're ready to proceed, press 'Enter'.


ARDUINO_DIRECTORIES_USER=/Users/tsaylor/projects/Kaleidoscope/.arduino/user ARDUINO_DIRECTORIES_DATA=/Users/tsaylor/projects/Kaleidoscope/.arduino/data /Users/tsaylor/projects/Kaleidoscope/bin/arduino-cli upload --fqbn keyboardio:avr:keyboardio_atreus \
	 \
	--input-dir "/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T//kaleidoscope-tsaylor/output/2693763974-Atreus.ino" \
	--verbose
Error during Upload: Failed uploading: no upload port provided
make: *** [flash] Error 1

I noticed that second line of the command with just a \ on it and guessed that it was supposed to include the --port argument, so I reset the keyboard and ran that command individually with the --port option and got this output that looked successful, but no change in the keyboard’s behavior.

$ ARDUINO_DIRECTORIES_USER=/Users/tsaylor/projects/Kaleidoscope/.arduino/user ARDUINO_DIRECTORIES_DATA=/Users/tsaylor/projects/Kaleidoscope/.arduino/data /Users/tsaylor/projects/Kaleidoscope/bin/arduino-cli upload --fqbn keyboardio:avr:keyboardio_atreus \
    --port "/dev/tty.usbmodematreus1" \
    --input-dir "/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T//kaleidoscope-tsaylor/output/2693763974-Atreus.ino" \
    --verbose
Performing 1200-bps touch reset on serial port /dev/tty.usbmodematreus1
Waiting for upload port...
No upload port found, using address:"/dev/tty.usbmodematreus1" protocol:"serial" as fallback
"/Users/tsaylor/projects/Kaleidoscope/.arduino/data/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/Users/tsaylor/projects/Kaleidoscope/.arduino/data/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega32u4 -cavr109 -P/dev/tty.usbmodematreus1 -b57600 -D "-Uflash:w:/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T//kaleidoscope-tsaylor/output/2693763974-Atreus.ino/Atreus.ino.hex:i"

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/tsaylor/projects/Kaleidoscope/.arduino/data/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
         User configuration file is "/Users/tsaylor/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbmodematreus1
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T//kaleidoscope-tsaylor/output/2693763974-Atreus.ino/Atreus.ino.hex"
avrdude: writing flash (28646 bytes):

Writing | ################################################## | 100% 2.20s

avrdude: 28646 bytes of flash written

avrdude done.  Thank you.

3. Flashing with Arduino IDE

I followed the instructions here Setting up your development environment — Kaleidoscope documentation

This method was basically the same as Kaleidescope, but using the IDE. When I reset the keyboard I could see it in the “port” menu, so I selected it and uploaded the firmware. I got very similar looking output (though the port is different), but still no change in keyboard behavior.

Sketch uses 26022 bytes (90%) of program storage space. Maximum is 28672 bytes.
Global variables use 983 bytes (38%) of dynamic memory, leaving 1577 bytes for local variables. Maximum is 2560 bytes.
Performing 1200-bps touch reset on serial port /dev/cu.usbmodematreus1
Waiting for upload port...
No upload port found, using address:"/dev/cu.usbmodematreus1"  label:"/dev/cu.usbmodematreus1"  protocol:"serial"  protocol_label:"Serial Port (USB)"  properties:{key:"pid"  value:"0x2302"}  properties:{key:"serialNumber"  value:"atreus"}  properties:{key:"vid"  value:"0x1209"} as fallback

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/tsaylor/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
"/Users/tsaylor/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/Users/tsaylor/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega32u4 -cavr109 -P/dev/cu.usbmodematreus1 -b57600 -D "-Uflash:w:/private/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T/arduino-sketch-C81EF0A9FB51A90FA3EFFA0B985C098E/Atreus.ino.hex:i"
         User configuration file is "/Users/tsaylor/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodematreus1
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/private/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T/arduino-sketch-C81EF0A9FB51A90FA3EFFA0B985C098E/Atreus.ino.hex"
avrdude: writing flash (26022 bytes):

Writing | ################################################## | 100% 2.06s

avrdude: 26022 bytes of flash written

avrdude done.  Thank you.

Any advice on how to get this device working again would be greatly appreciated!

Bumping this topic after the holidays. Hopefully someone has an idea I can try!

I’m not familiar with the Atreus in particular, but a few questions that might help others to give answers: Does it function normally as a keyboard? After 30 seconds, is it completely absent from the USB device list in System Information? Or does it show up as the non-bootloader Atreus device? What version is the package in the Arduino Boards Manager? Are you uploading the Atreus example sketch, or a custom one?

Thanks Argonblue!

  • It does not function, and it disappears from the device list after 30 seconds.
  • In the Arduino IDE boards manager I have Kaleidoscope Keyboards v 1.99.7 installed
  • I am uploading the Atreus example sketch from the head of the Kaleidoscope repo as of commit 506c780f78

@tsaylor - you may want to try the keyboard.io discord channel: keyboardio. Lately it has seemed a bit more responsive to time sensitive queries.

Oops - I see you asked there alread - did you get the help you needed?

If it always shows up in bootloader mode for 30 seconds after being plugged in, it might be that there’s a problem with the Esc key, or whatever key or switch is used to put it into bootloader mode. But if it’s not showing up as any USB device at all after those 30 seconds, something is probably wrong with the firmware or your hardware. I’m afraid I don’t have any ideas beyond that for now.

I just noticed this post about the model 100: Model 100 make flash error - #2 by dcavalari which mentioned a problem where basically you have to hold the prog key as you plug in the keyboard. Then pressed “enter” on a different keyboard and the firmware flashing worked. May not be applicable to the atreus, but figured it would be an easy thing to test. This was dated October 2022. @algernon may be able to suggest more options (?)

Thanks, I’ll give the model 100 solution a try, and if that doesn’t work I’ll see if I can swap the esc key switch with another one to isolate if that’s the problem.

No luck with either of those solutions unfortunately.

I tried physically swapping the esc key switch with another on the board in case it was bad, but it still showed up in bootloader mode every time it was plugged in, then disappeared entirely after 30 seconds.

Then I tried reflashing with make flash from the Kaleidoscope repo, and got a couple different outcomes, but basically the same result.

Kaleidoscope’s make flash looks like it compiles, then pauses before actually flashing with this prompt:

To update your keyboard's firmware, hold down the key in the lower left corner of your Atreus.

When you're ready to proceed, press 'Enter'.

I did this twice, the first time I plugged in the keyboard while holding esc, then kicked off make flash, then pressed esc again while I pressed enter on my laptop keyboard. Doing that gave me this error:

avrdude: ser_open(): can't open device "/dev/cu.usbmodematreus1": No such file or directory

avrdude done.  Thank you.

Error during Upload: Failed uploading: uploading error: exit status 1
make: *** [flash] Error 1

I thought it might be exiting bootloader mode by the time the compilation is over, so I tried again and once I saw the flashing prompt I re-plugged it in while holding esc, then pressed enter on my laptop keyboard to proceed with flashing. This time there was no error and I got output that looks like a flash occurred, but the keyboard still doesn’t work. Partial output showing the flash write below:

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/var/folders/db/s5945whx13zgfcxtrjqyhr400000gn/T//kaleidoscope-tsaylor/output/2693763974-Atreus.ino/Atreus.ino.hex"
avrdude: writing flash (28646 bytes):

Writing | ################################################## | 100% 2.21s

avrdude: 28646 bytes of flash written

avrdude done.  Thank you.

I thought I might be able to learn something if I could monitor the traffic over the USB interface. I found out that Wireshark can do that, so I gave it a try. I saw the same behavior while capturing USB packets, that the keyboard comes up for 30 seconds, doesn’t respond to keypresses, and then disappears. Nothing in this dump file means much to me but maybe someone else is more familiar?
atreus-usb-sniff.txt (46.2 KB)