PWM in LLS mode on a FRDM-KL26 board

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

PWM in LLS mode on a FRDM-KL26 board

Jump to solution
1,490 Views
florianackerman
Contributor I

Hi Guys,

 

I am trying to implement a low power application and therefore I'm using the LPTMR to switch between RUN mode and LLS mode. The problem is, that during the LLS mode, the tpm for the pwm is not operational and the pwm turns off. I can see at the oscilloscope that the pwm is turned off during LLS. Also when executing the code, the led is blinking. It is supposed to run all the time, though..

 

I've attached an example project that shows the problem.

 

Does anyone know how to solve this problem? Any help is greatly appreciated!

 

Regards

Flo

Original Attachment has been moved to: TestProject.zip

Labels (1)
Tags (5)
0 Kudos
1 Solution
1,010 Views
mjbcswitzerland
Specialist V

Hi Florian

The binary that I had attached is for the FRDM-KL26Z (although will presumably also run on a FRDM-KL25Z but uses different outputs).

To move to a low leakage mode you need to command this on the serial interface in the "administration" menu - you can then switch to which ever one you would like try.

When switching to VLPS the PWM output continues to operate. The application will however move automatically between RUN and VLPS mode whenever it needs to, and can.

In the meantime I have however noticed the following in the KL25/26 user's manuals which is probably actually declaring that the TPM can't be used in LLS. Interpreting this as listing the 'possible' low power modes where the module is operational (and in all others it isn't) I now believe that the restriction is that VLPS is OK but LLS not, even if the clock used by the TPM continues to operate in the LLS mode. Of course in VLPS the clock used must also still be enabled for it to work.

pastedImage_2.png

Therefore I think that the VLPS mode is indeed the lowest power mode possible with operational PWM output.

Regards

Mark

Kinetis: µTasker Kinetis support

KL26: µTasker Kinetis FRDM-KL26Z support / µTasker Kinetis Teensy LC support

LLWU: µTasker LLWU Support

PWM: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market


View solution in original post

0 Kudos
6 Replies
1,010 Views
mjbcswitzerland
Specialist V

Hi Florian

In order to use the PWM in LLS power mode you need to clock the TPM from OSCERCLK (or possibly from TPM_CLKIN0/1 from an external source) since other clock sources will be disabled in LLS mode.

As reference I have attached a FRDM-KL26Z binary that generates a 20% PWM output at 1kHz on the RED LED (green blinks at 2.5Hz controlled by SW when it is running).

There is a menu on the Virtual COM UART (115'200Baud) where low power modes can be controlled from the administrator menu, including LLS mode.

Pressing SW1 wakes from LLS.

Alternatively you can set a RTC alarm to wake:

- "set_alarm +10" sets an alarm 10s in the future (or "set_alarm +2:22 sets in 2 minutes and 22 seconds in the future - or "set_alarm 16:25:22" will set the alarm at an absolute time, or "set_alarm 24.2.15 8:54:00" ses it at a specific date/time).

- "set_lp 5" moves to LLS

- when the alarm fires the RUN mode is also restored.

Regards

Mark

Kinetis: µTasker Kinetis support

KL26: µTasker Kinetis FRDM-KL26Z support / µTasker Kinetis Teensy LC support

LLWU: µTasker LLWU Support

PWM: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
1,010 Views
florianackerman
Contributor I

Hi Mark,

Thanks for your reply.

So.. waking up from LLS is no problem. I'm doing this, using a LPTMR and LLWU. Unfortunately I still can't get the TPM to work.

I am using the OSCERCLK with 8MHz. I'm simply initiating and starting a pwm. After that I am calling Cpu_SetOperationMode(DOM_STOP, NULL, NULL); If I don't switch to LLS mode, the pwm burns on, otherwise it turns off.

I want the pwm to stay turned on during LLS mode. I double-checked everything several times. Everything seems to be correct, though.

If you have an operational example project, would it be possible to post it here, for me to compare it?

Regards

Flo

0 Kudos
1,010 Views
mjbcswitzerland
Specialist V

Hi Florian

Could you run the binary that I attached to see whether it operates correctly?

Unfortunately my FRDM-KL26Z board died recently (the OpenSDA K20 doesn't start anymore) so I could only test on a KL25 and simulate the KL26. If you find that the PWM stops in LLS I think that there may be a problem/restriction with the chip. My explanation is as follows:

- From my tests on the FRDM-KL25Z it is seen that the 8MHz OCS continues to operate in LLS (the signal is seen on the crystal) - it will stop in VLLS0, which is what is expected.

- OSCERCLK is being used to clock the TPM and this should continue to operate in LLS according to the user manuals.

- In the case of the FRDM-KL25Z the PWM output doesn't continue in LSS - it will randomly stop at '1' or '0'

- However I am not sure about the KL26 because it is a little different with respect to the OSCERCLK in LLS. The KL25 can use this clock in LLS but only when in the low frequency mode (that is, when driven by 32kHz). This restriction doesn't apply to the KL26 in LLS where it can also use the OSCERCLK at 8MHz.

This is where I cannot be sure because it may in fact be normal that the FRDM-KL25Z's PWM doesn't operate (since the OSCERCLK is in the invalid high frequency range), although the OSC itself certainly continues.

There is however a further question in whether the TPM is in fact running but the PWM output doesn't work because the port output is frozen in LLS?

What I know from the KL25 is that if you configure the RTC_CLKOUT (also needs the port module to operate and be configured for the MUX setting) to be driven by the OSCERCLK (8MHz clock output seen in normal mode) this clock output will stop in LLS although the OSC is obviously still running (again it could be due to the out-of-spec clock range on the KL25 (?)).

If my FRDM-KL26Z hadn't decided to give up its ghost two days ago I wouldn't need to guess (or rely on someone checking) but there may be the factor of ports involved that don't allow the outputs to run rather that the TPM itself stopping (difficult to check).

Should the KL26Z not work as expected I would also suggest that there is either a restriction that is not otherwise documented or the port output factor is restricting the actual outputs from being effective (which may also be an undocumented practical restriction) - it depends on the TPM output design as to whether it passes through the 'frozen' port or can bypass it in LLS, which is not specifically stated anywhere... My gut feeling is that PWM outputs may be inoperable due to the ports being frozen in LLS and not due to the TPM not continuing, but until I can verify on a real KL26 there is a still a glimmer of hope that this analysis is not fully correct.

Regards

Mark

Kinetis: µTasker Kinetis support

KL26: µTasker Kinetis FRDM-KL26Z support / µTasker Kinetis Teensy LC support

LLWU: µTasker LLWU Support

PWM: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market

1,010 Views
florianackerman
Contributor I

Hello Mark,

When running your example binary on a KL25 board (since the pins for the pwm are different on the KL26 and I wanted to see something :smileywink: ), the pwm was indeed turned on. The MCU wasn't in STOP mode though, as seen on the oscillograph, so I dropped the approach.

I can confirm that the OSCERCLK is used in LLS and running.

The RTC is not needed on my approach, so I left it out.

Today I was trying out the VLPS mode in which the pwm is working pretty good. The interesting thing is, that the ports are controlled by the bus clock. The bus clock on the other hand is turned off in both modes (VLPS and LLS), so the assumption could be that the ports are always available. I did not check the TPM timer yet (as you already mentioned, that's a little difficult).

I will keep you up-to-date if I can make it run.

Regards

Florian

0 Kudos
1,011 Views
mjbcswitzerland
Specialist V

Hi Florian

The binary that I had attached is for the FRDM-KL26Z (although will presumably also run on a FRDM-KL25Z but uses different outputs).

To move to a low leakage mode you need to command this on the serial interface in the "administration" menu - you can then switch to which ever one you would like try.

When switching to VLPS the PWM output continues to operate. The application will however move automatically between RUN and VLPS mode whenever it needs to, and can.

In the meantime I have however noticed the following in the KL25/26 user's manuals which is probably actually declaring that the TPM can't be used in LLS. Interpreting this as listing the 'possible' low power modes where the module is operational (and in all others it isn't) I now believe that the restriction is that VLPS is OK but LLS not, even if the clock used by the TPM continues to operate in the LLS mode. Of course in VLPS the clock used must also still be enabled for it to work.

pastedImage_2.png

Therefore I think that the VLPS mode is indeed the lowest power mode possible with operational PWM output.

Regards

Mark

Kinetis: µTasker Kinetis support

KL26: µTasker Kinetis FRDM-KL26Z support / µTasker Kinetis Teensy LC support

LLWU: µTasker LLWU Support

PWM: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market


0 Kudos
1,010 Views
florianackerman
Contributor I

Hi Mark,

Yes, I can confirm that it's not working whatever way I try it.

Although the manuals I looked at (Data Sheet, Reference Manual, User Guide), seem not as specific regarding TPM as the one you have. Thank you for sharing this information.

And thanks for the interesting and helpful discussion, as well!

Have nice day.

Regards

Flo

0 Kudos