I have an atTiny85, that can happily switch back and forth between debugWire and ISP as it should; when using the internal PLL clock (16K CK/14CK + 64 ms). I have added a 20 MHz crystal with 2x 22 pF capacitors, changed the fuses (external osc, 8+ MHz, slow start) and everything seems to work fine, the timing of my application corresponds to the 20 MHz speed.
However, when I want to switch to debugWire and go through this process in Atmel Studio 7, after toggling target power it says that "Setting debugwire fuse seems to have failed, check your clock and fuse settings". At this point it goes neither into debugWire or ISP mode, seems to be locked in some sort of "limbo" without any communication with the device. If I try debugWire it attempts to set it up from scratch trhough ISP, but ISP does not work ("Got 0xC0 expected 0x00). The application still works on the MCU with the correct timing. Have two '85 locked in this state already, it's not a productive day. :)
I have tried to connect to the MCU without the 10 kOhm pullup to Vcc, and there is no capacitors on the reset line. Here is the weirdest part: running out of ideas I connected the reset through the 10k resistor to ground (I don't know why), and it connected to debugWire, could even go back to ISP... To me, this does not make sense. There is nothing connected to the MCU except the Atmel-ICE and an oscilloscope probe so I can see if the application timing is correct.
- Is there a special trick to use debugWire with an external crystal / at 20 MHz?
- How could connecting reset to the ground through the resistor enable DW? What is the logic in that?
- Since DW is asynchronous, how does it know what is the speed it should use? (I have no F_CPU in the code)
- Is there a maximal speed for DW?
Would be grateful for any ideas or explanations, I have run out of them.