Problem with timer in low power mode

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

Problem with timer in low power mode

780 Views
Embionics
Contributor III

Hello ,

I am working with KL25Z freedom board.

I run the code for wake up from LLS mode using wakeup timer component from the component library library and its working.

I set the config 0 = PEE and Config 1=BLPI mode .

I need to run the code on config 1 (BLPI mode) and 0 both.

I set the configuration so that when i wakeup from LLS mode it should remain into config 1 means VLPR mode only.

Now when i wakeup from LLS and i am in VLPR mode i need nother timer for sending the data on UART after timer expire.

It seems that i m not able to use LPTMR timer as it is already used by wakeup timer component.

alo not able use in config1 setting.

1) Is it true that i cant use LPTMR again?

and if i am using some other timer TPM0 and in setting i enabled config 0 and 1 for TPM0.

I m not able to set the counter frequency and the overrun period as shown in the attachment.

2) How can i use other timer in VLPR mode?

Regrds,

Amreen

3 Replies

428 Views
perlam_i_au
Senior Contributor I

Hello, I read your post and I am trying to figure out why you have this problem, I would like to confirm with you your set up, please see information below and let me know if I get the correct idea.

1.-Your microcontroller successfuly enter to LLS mode

2.-You have configured (previously) LLWU module to use the wake up source LLWU_P4 = LPTMR. Based on the count of LPTMR  wake up signal will be generated to get out from LLS mode

Here is were I am not sure what is going on....then I am guessing the next part...

3.-Your microcontroller enter to VLPR mode and you want to use the LLWU whit LPTMR or another timer like TMP0 to get out of this mode??? (please let me know if I am right)

Another thing you mention is your MCG mode transitions, when your microcontroller is on Power mode LLS your MCG mode should be PEE, for change to VLPR microcontroller mode your MCG mode should change from PEE to PBE and finally to BLPE or BLPI


Could you please check if your MCG configuration modes change in the appropriate way?.

Also I will be glad to take a look of your project if you want to share it :smileygrin:


Have a nic day :P,
Perla

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

0 Kudos

428 Views
Embionics
Contributor III

Hello Perla,

  1. Yes my microcontroller successfully enters to LLS mode.
  2. I have configured LLWU module to use the wake up source LLWU_P4 = LPTMR. Based on the count of LPTMR wake up signal will be generated to get out from LLS mode
  3. At power on My microcontroller will run on MCG mode PEE.

In main routine, my microcontroller enter to VLPR mode as I set MCG mode BLPI by  using

“Cpu_SetClockConfiguration(CPU_CLOCK_CONFIG_1);” this function.

After this my microcontroller entering into LLS mode using “Cpu_SetOperationMode(DOM_STOP, NULL, NULL);” this function.

Now when my microcontroller come out of LLS mode using wake uptimer (LPTMR) it stays in VLPR mode.

In VLPR mode I want use a free running timer as a counter. Also I want to use same timer when I will come out of VLPR mode.

Is it possible to use same timer in VLPR (MCG mode BLPI) and MCG mode PEE i.e TPM0?.

And while trying this I got the error as attached in my previous discussion

Also I am attaching my code for your reference.

Thanks,

Amreen

0 Kudos

429 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Amreen:

I checked your project together with perlam.i.au, and here is some feedback:

1) Regarding LPTMR, the Wakeup_Timer component already adds a TimerUnit_LDD component using LPTMR0 (TU1 under Referenced_Components), so you cannot add a new component (e.g. TU2) that uses the same LPTMR0. If you need to use LPTMR both as wake-up source and also as simple timer, then it is better if instead of Wakeup_Timer component, you simply remove it and add a TimerUnit_LDD component using LPTMR0; with this you will have full control of the timer. The disadvantage with this approach is that you will have to manually add code to enable LPTMR as LLWU wakeup source.

2) Now, if instead of LPTMR, you decide to use TPM, the problem you showed with your picture is because the TPM Counter Frequency property (in this case 3 MHz) cannot be achieved with both Clock configurations (0 and 1). If you click in the button (...), it will open the Timing Dialog Box. At the right side you will see the possible clock frequency options. If the list is empty, this means that there is not a common frequency you can select. To solve this you need to play with the clock configurations in the CPU component. Here are some pictures I took from your project to show you my point:

Timing_Dialog_Box.png

Timing_Dialog.png

Hope this helps. Let us know if you need more details.


Regards!,
Jorge Gonzalez

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