Hi all, I'm using Kinetis controller and ihave a question for lpt(low power timer). I'm using LPT as counter(counter and compare registers are 16-bit wide) and i need to count 32 bit value instead of 16 bit. can i cascaded the LPT?
It is possible. You can configure both timers, start one timer at any moment and then start the second timer inside the interrupts of the first timer. E.g.
LPTMR0_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
LPTMR1_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
Technical Support Engineer
Thank you for your reply. Yeah i was using same method in a different approach. i was trying to cascade it in hardware. Now im using same method and is working.
thank you carlos.
I am glad your problem was solved.
If you find our responses useful I encourage you to mark them as helpful or correct answer. This will help other members find the best answers as well.
Or, If you have only one LPTMR avaliable, you can set prescaler to 65536, count the upper 16 bits and then disable prescaler and count the lower 16 bits.
I dint get your answer exactly. After i set prescaler, how to count? can you briefly tell us; it will be helpuful.
Let's say you have uint32_t count value. What you need to do is to split counting in two steps:
In the first step you configure LPTMR to run 65536 times slower to count (count & 0xFFFF0000) clock cycles. Then you disable prescaler to count the remaining time - the lower 16 bits of your count value.
Thank you martin. its a helpful answer.
Retrieving data ...