Found by setting the CCR bit CLKSRC to 1, the 32768-Hz crystal is used and the seconds count increments reliably, even while the reset button is being pressed. Unfortunately, 1-second timing isn't good enough for any but the slowest Morse code and reading the CTC register isn't reliable when not using the system clock. So I found out the default divisor of CCLK is 4, which makes the 20MHz crystal give a 5MHz PCLK signal. Now to see if that clock works during reset, and if so, modify it to tick at maybe 20 times per second.

Back to blog or home page

last updated 2012-12-05 22:16:34. served from tektonic.jcomeau.com