clocking LPTMR0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

clocking LPTMR0

556 Views
stefanomanca
Contributor III

Hi, I'm using kl14z64, when I clock the timer LPTMR0 by SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK; I observe that registers related to LPTMR0_XXX are initialized with not default value (see the pictures), in particular LPTMR0_CSR gets 0xC1 so when processor experts does  NVIC_ISER |= NVIC_ISER_SETENA(0x10000000);    starts a spurious interrupt.lptmr0_registers.jpg

Any idea?

Thank you

0 Kudos
4 Replies

415 Views
galadragos
Contributor III

Better do an actual power on, just to be sure.

0 Kudos

415 Views
bobpaddock
Senior Contributor III

LPTMR0 registers are initialized only at Power On Reset.  This is so they can maintain time across other resets.

"

The LPTMR is reset only on global Power On Reset (POR) or Low Voltage Detect

(LVD). When configuring the LPTMR registers, the CSR must be initially written with

the timer disabled, before configuring the PSR and CMR. Then, CSR[TIE] must be set as

the last step in the initialization. This ensures the LPTMR is configured correctly and the

LPTMR counter is reset to zero following a warm reset.
"

415 Views
stefanomanca
Contributor III

Hi Bob, I pray you to verify on your kinetis microcontroller if when you are at power-on LPTMR0_XXX registers are reset because in my case after power-on and after the SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK they are not zero. So something are going bad respect to the theory behavior. Anyway there is a bug in the processor expert initialization sequence. I hope in a freescale employ response.

Thank you.

Stefano M.

0 Kudos

415 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Stefano:

In fact I think the behavior you see is normal. To enter a debug session the MCU must be powered first (POR), and it runs enough time to configure LPTMR before you actually connect with the debugger. So the values you see are not those of Power-ON but the ones remaining after a reset by your tool (Multilink or similar).

To test this you can create a new empty project that just enables LPTMR with SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK and check the registers. You may need to close the first programming session and open another one for the Power-ON values to take effect.


Regards!,

Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos