AnsweredAssumed Answered

Why does the Kinetis K10 Low-Power Timer only count when I try writing to LPTMR0_CNR?

Question asked by Ryan Phillips on Aug 11, 2016
Latest reply on Aug 12, 2016 by Ryan Phillips

I have a project that's almost done and we're going to use the LPTMR (low-power timer) as a counter with a pulse input. When I go to read the LPTMR_CNR like so:

 

lptmrCounta = LPTMR0_CNR;

lptmrCountb = LPTMR0_CNR;

 

It does not work. All I get is a 0 no matter how many times I create a pulse. However, when I try to write to the CNR first, like so:

 

LPTMR0_CNR = 0;

lptmrCounta = LPTMR0_CNR;

lptmrCountb = LPTMR0_CNR;

 

It works every time. The documentation shows that the CNR is read only and it says nothing about writing to it before reading it. So why does it work only when I try to write to it?

Outcomes