10 years, 6 months ago.

KL25Z and LPC8xx low power modes

Is there any code for these chips to put them in low power mode? Considering these chips are more suited for low power I'm surprised the Mbed library does not appear to have this available or am I missing something?

Hello,

really there's nothing for KL25Z? What is your case to use low power for KL25Z? Provide some details, somebody (probably me) can write something.

posted by Martin Kojtal 08 Oct 2013

Hi Martin, The KL25z does lend itself to low power functions. I want to drop the MCU power level as low as possible for solar/battery use only to 'wake up' up to run higher speed functions. For instance I have a DCF77 atomic clock program that displays on a low power lcd display using the standard 1602 library. The task is to power up the DCF77 receiver (only needs 100uA) using one of the 3.3v digital pins, run my code to synchronise the external RTC clock once every 24 hours, then go into to low power (speed) mode to display the time. My display is 3.3v 100uA but the MCU comes in at 9mA so what I need to do is control the MCU and embedded parts to operate at the lowest power state only to drive the digital pins to for the display and I2c to read the RTC clock. I have made a production board (only the KL25z MCU and Xtal titted) and I use the FRDM board to link the code so no other peripherals to power. I need to use the external Xtal to accurately run the Ticker ISR part of my code during DCF77 synchronising, but can switch to IRC clock if it further reduces the power the rest of the time. It does not need to be in the form of a library just a few of lines code to switch in and out of power modes as I need. If you can get me started I can test and expand this to a library to post on Mbed. What do you think? Regards Paul.

posted by Paul Staron 10 Oct 2013

Paul, please check what anthony posted (that's awfully code made by processor expert :-)), also I would check sample code for kinetis L where should be low power functionality covered at least by one demo.. Can pm me here, so we can discuss this more. I would like to see a low power library for KL25 here on mbed.

Might not be that easy because it's depends on peripheral setup, low power module setup, proper clocking as well..

posted by Martin Kojtal 15 Oct 2013

another information about that: http://mcuoneclipse.com/2013/10/20/tutorial-using-the-frdm-kl25z-as-low-power-board/ regards, Anthony

posted by anthony harivel 21 Oct 2013

3 Answers

10 years, 4 months ago.

This may be interesting http://mcuoneclipse.com/2013/10/20/tutorial-using-the-frdm-kl25z-as-low-power-board/ It brings the KL25Z current from 20 mA down to 0.132 mA. Unfortunately not written in c++

Accepted Answer

Also for this one :P. Recently sleep/deepsleep code was added for the LPC812, which greatly reduces current consumption (especially deepsleep, to 2uA). Besides that for the LPC812 there is a register that determines which peripherals are clocked, you can disable the ones which you don't need.

posted by Erik - 22 Dec 2013

Since the last Mbed update, Erik's deep sleep/wake functions have been added. I have results now down to just under 3uA with no peripheral devices attached. I put together a board to test Waking every second to read an i2c RTC clock IC and update a low power i2c LCD (sub 300uA). This has now been running for several days with no lock outs or corruption. The deep sleep power is 297uA including the LCD display, RTC IC and low trickle charge of the RTC back up cell. This also includes utilising the in chip 3.3v MCU regulator. All powered by a 3.7v Li-Ion mobile phone battery. The 'wake' update process is taking 12.8mS and strangely this comes in at 3.6mA not at the reset level that is 8mA. This gives an average consumption of about 343uA. If I disconnect the LCD display it reduces to 50uA.

posted by Paul Staron 22 Dec 2013
10 years, 6 months ago.

Excellent question ! Sorry I can't help but this message will help me follow this thread and not forget about it. GL. Anthony

Paul Staron
poster
10 years, 6 months ago.

Hi Martin, I have been initialising the LPC812 chip to run on 12Mhz external Xtal rather than default IRC clock as detailed below. The reason I needed this was the accuracy of the IRC clock is not good enough for synchronising a Ticker ISR to an external signal source (i.e. DCF77 atomic clock signal) over a period of time. This appears to be working okay. Now I intend to add and change code here to change the clock source and speed of the chip and take power measurements. NXP provide a very good user manual for their products so I thought I would start with this chip first then move onto the KL25z. I will look at Anthony's example for ideas with an aim to achieve something simple and short. One problem I have is with calculating the PLL M and P values (see page 30 of manual). If you have any information (that makes sense to me :) ) on how to calculate these values, please let me know.

Regards

Paul

LPC812 Enable external Xtal

#include "mbed.h"
#include "TextLCD.h"

int i;
extern int stdio_retargeting_module;
extern "C" void $Sub$$SystemInit (void)
{
  LPC_SYSCON->SYSAHBCLKCTRL |= ( (0x1 << 7) | (0x1 << 18) ); 
  LPC_IOCON->PIO0_8 &= ~(0x3 << 3);
  LPC_IOCON->PIO0_9 &= ~(0x3 << 3);
  LPC_SWM->PINENABLE0 &= ~(0x3 << 4);
  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 5);          /* Power-up System Osc      */
  LPC_SYSCON->SYSOSCCTRL    = 0x00;
  for (i = 0; i < 200; i++) __NOP(); 
  LPC_SYSCON->SYSPLLCLKSEL  = 0x01;                 /* Select PLL Input         */
  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;                 /* Update Clock Source      */
  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));       /* Wait Until Updated       */
  LPC_SYSCON->SYSPLLCTRL    = 0x00000040;           /* Set PLL, not sure if this is correct value but works   */
  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 7);          /* Power-up SYSPLL          */
  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));         /* Wait Until PLL Locked    */ 
  LPC_SYSCON->MAINCLKSEL    = 0x03;                 /* Select PLL Clock Output  */
  LPC_SYSCON->MAINCLKUEN    = 0x01;                 /* Update MCLK Clock Source */
  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));         /* Wait Until Updated       */ 
  LPC_SYSCON->SYSAHBCLKDIV  = 0x01;
}


// now running on external 12Mhz Xtal


int main()
{

// main program code

)