Hi,
(well I think I am the expert...;-))
I finally succeeded detecting DCF77 signals of 100ms (0-bit), 200ms (1-bit), 1s (start of bit) and 2s (final second 59). From the first active going edge the counter is started and on the next edge the counter value is read and counter is restarted. I started applying the longest signal of 2s by a function generator to the stm8s103. The counter value should be within the 16-bit counter range 65535. So I started with prescaler value 15 and decremented it until the measured counter value is at the highest possible count less than 65535. Decrementing the prescaler value the counter value doubles exactly, so no problem with the prescaler or counter itself. Prescaler 9 timer 2 counts:
56463 at 2 seconds.
28230 at 1 second
5646 at 200ms
2823 at 100ms
So very very nice.
I used these values with a plus/minus offset to detect correct DCF77 signals and it works perfectly.
So lets be simple. With CKDIVR set to zero then 1 second takes 28230 counter ticks. Therefore the timer 2 input frequency must be 28.230Hz. Multiplied by prescaler 2^9 is 512 makes 14453760 or 14.4 system clock frequency not even within 1% of 16MHz as documented and far out from the HSI calibration posibilities.
Thanks for listening.