AnsweredAssumed Answered

Problems using LPTMR with 32kHz XTAL

Question asked by Michael Maclean on Jan 30, 2017
Latest reply on Feb 13, 2017 by Mark Butcher

Hi all, 


im trying to setup the FRDM-K22 board, to use VLPS mode running off the external 32k xtal, using the LPTMR to interupt and wake up at 8192Hz.  The LPTMR IRQ will be kept less than 30us. 


i have set up the ERCLK32K to be output on pin PTE0, and set the LPTMR IRQ to pulse another GPIO. 

I can see them both on the scope, the gpio shows a 20us pulse, every 122us, and the clock shows 32kHz. 


The current consumption is 1.22mA, which is very high, but im not sure where im going wrong? 

I used BOARD_BootClockVLPR() from the example code, then use SMC_SetPowerModeVlps(SMC) in the main while loop. 


I expected to see that the scope pin would go high every fourth clock period, with a small delay. But, there is a lot of jitter.

  • if i trigger from the 32k clock, the gpio pin trace does not seem synced at all.
  • if i increase the trigger holdoff there is a range which gets it in sync, and there is a 23us delay from the clock rising edge to the gpio pin rising edge.
  • If i trigger from the gpio pin, the clock jitters a little, and there is also the 23us delay from the clock rising edge to the gpio pin rising edge.


Is the large delay to be expected? something to do with the delay in the NVIC?  i tried in VLPW and VLPR and got the same 23us delay. 


I cant use the debugger as it wont let me get into VLPS mode (i get a 'STOPA' error). 


Can anyone give any ideas?