I made an error with my fuse bits. I changed CKSEL to 128 kHz Int RC with the CKDIV8 fuse bit on. The device is now effectively running at 16 kHz clock speed as far as I understand. I can see that the MCU is still executing my program, just very slowly.
The problem is that I am unable to connect to the MCU using Atmel-ICE. The problem seems to be that Atmel-ICE cannot run its ISP slower than 8 kHz, and I would like to run it at four or even two kilohertz.
I tried with Atmel Studio 7.0 which lets you set the ISP speed to 8 kHz minimum. I also tried with atprogram.exe which terminates with a mysterious
[ERROR] ispSetBaud: Error status received: Got 0xcd, expected 0x00 (Unknown status message). (TCF Error code: 1)
error when setting the ISP clock speed below 8 kHz. When set to 8 kHz or more I get
[ERROR] Could not establish connection to device. Please check input parameters, hardware connections, security bit, target power, and clock values. Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00 (Command has failed to execute on the tool). (TCF Error code: 1)
What to do?