- I have changed all my write commands to write entire registers at a time instead of 1 bit as you suggested in your post.
Sorry, bad memory. I thought timer prescaler bits are write once, and this could bite you. There's no need to do what you did for all registers, only for those ones, which have write once bits. For example look at IRQCR register description. It is said that IRQE bit is write once. This means that first write to IRQCR will lock contents of IRQE. So if you do first
IRQCR_IRQEN = 0; // or =1
then write
IRQCR_IRQE = 1;
^^ this will be ignored and IRQE will stay in its reset default state = 0.
- It still works in debugger only. Is there any way to make the chip run in special mode without the debugger?
No, it's not possible. You can boot MCU in special single chip mode, but it will be halted until you command it to GO using BDM interface.
- When you say that you cannot write to TCNT during normal mode. How do I zero the timer then? I thought you can write to TCNT as long as the timer is OFF.
You can't zero TCNT in normal mode. Manual says this about TCNT "Write: Has no meaning or effect in the normal mode; only writable in special modes (test_mode = 1).".
Instead of resetting timer counter, you should setup new timer events relative to the old events:
TCx = TCNT + ticks_to_go; // TCx will happen N ticks later
TCx = TCy + ticks_to_go; // TCx will happen N ticks past TCy
Having free running counter you have (almost) 8 independent timers. Resetting counter you have only one timer.