Hello Sir,
Kindly try this. I am refering the "KL04 Sub-Family Reference Manual" for this.
Pls refer" 32.4.5 LPTMR counter" in page 539.
"The CNR cannot be initialized, but can be read at any time. On each read of the CNR,
software must first write to the CNR with any value. This will synchronize and register
the current value of the CNR into a temporary register. The contents of the temporary
register are returned on each read of the CNR."
Pls try writing a junk value to the LPTMR0_CNR and the reading it.
I think u will be able to do it.
But, if you are using interrupt for a timeout then I wld like you to note the "TCF" bit in LPTMR0_CSR register
"
Timer Free-Running Counter
When clear, TFC configures the CNR to reset whenever TCF is set. When set, TFC configures the CNR to
reset on overflow. TFC must be altered only when the LPTMR is disabled.
0 CNR is reset whenever TCF is set.
1 CNR is reset on overflow."
The interrupt happens when the CNR is equal or > CMR. So I feel when there is an interrupt and you go to the ISR, the CNR is already > CMR and therefore
it (CNR) is reset. There is a confusion here for me :smileyhappy:
But even I find sometimes its a bit dodgy.
Vinod.