Hello all,
I found a strange thing recently,
we need to write a data like 0x11 to CNR to read the current value of the LPTMR,
but, usually, we just need to read the CNR register so we can get the current value of the TIMER,
so, i want to know why NXP design CNR as RW instead of RO,
is there any advantage in doing this?(It's important
Sorry i'm not good at english, but this question does really confused me for a long time,
waitting for your answer...
Hi,@VaneB
Thanks for your reply,
i'm very glad,
sorry, seems i don't have permission to upload images,
maybe you can see the "S32K-RM",
in page "1571",you can see there is a description of it: "The CNR returns the current value of the LPTMR counter at the time this register was last written",
and we need to write a data then we can get the current value of the counter,
but usually we just read it, and we can get the value,
so i think it's not a code question, it's more like a design question,
i want to know is there any advantage in doing this?
My friends say it's a NXP's bug, don't care about it, anyway we can get this value, it's fine.
But i don't think so, i believe there must be some reasons for this
MCU: S32K144
IDE: Keil
SDK: v4.0.1
Waitting for your reply,
B.R.
Howys
The reason this register is read and write is because on each read of the CNR, the software must first write any value to the CNR. This will synchronize and register the current CNR value to a temporary register. The content of this register is returned on each reading of the CNR.
Thank you for your reply,
From your reply I know the reason why we need to write CNR registers and read the value,
and i still don't know the advantages of writing and reading CNR registers instead of directly reading CNR registers,
when we design the CNR register, why don't we design the CNR register read only?