Power Management on Kinetis MCUs: LLS and VLLS modes

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

Power Management on Kinetis MCUs: LLS and VLLS modes

Power Management on Kinetis MCUs: LLS and VLLS modes

Hello All,

Power consumption of devices and implications around designing on embedded systems is a common topic nowadays. Kinetis MCUs offer different power modes to fit user's needs. Among these low power modes, we can find the lowest consumption modes: Low-Leakage Stop (LLS) and Very Low-Leakage Stop modes (VLLS).

Attached document provides a brief introduction/explanation on these modes and lists the steps needed to configure MCU to operate in any of these modes. It is a bare-board project for FRDM-KL26Z but same principle applies to other Kinetis families. Also, two projects for KDS v3.2 are attached for reference.

I hope you can find them useful!

Regards,

Isaac

Labels (1)
Attachments
Comments

Hi Isaac,

Thank you very much for creating this very helpful doc and code!

I am trying to port to the frdm-k22f and notice that the header file is different for register accessess.  I have cleard most of the errors but am stuck with this error in the gpio.c file.  

I had to change this line to the following:

static PORT_MemMapPtr g_portPtrs[] = PORT_BASE_PTRS;

Changed to:
static PORT_Type g_portPtrs[] = PORT_BASE_PTRS;

But get an error on this line which I do not understand:

 g_portPtrs[port]->PCR[pin] = PORT_PCR_MUX(1);

Error:

../source/gpio.c:75:25: error: invalid type argument of '->' (have 'PORT_Type')
g_portPtrs[port]->PCR[pin] = PORT_PCR_MUX(1);

I will upload working code once I get it running in case it is useful to anyone else.  

Edit:  Found the problem to be that the definition needed to be deferenced as below:

static PORT_Type * g_portPtrs[] = PORT_BASE_PTRS;

Also see we had overlapping posts.  Thanks!

Hello,

PORT_MemMapPtr is a pointer to structure and PORT_Type is only the structure. You need to define an array of pointer to structures, in this case, you will need to replace:

   static PORT_Type g_portPtrs[] = PORT_BASE_PTRS;

by:

   static PORT_Type *g_portPtrs[] = PORT_BASE_PTRS;

And it should work well!

Regards,

Isaac

%3CLINGO-SUB%20id%3D%22lingo-sub-1106525%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPower%20Management%20on%20Kinetis%20MCUs%3A%20LLS%20and%20VLLS%20modes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1106525%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20All%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EPower%20consumption%20of%20devices%20and%20implications%20around%20designing%20on%20embedded%20systems%20is%20a%20common%20topic%20nowadays.%20Kinetis%20MCUs%20offer%20different%20power%20modes%20to%20fit%20user's%20needs.%20Among%20these%20low%20power%20modes%2C%20we%20can%20find%20the%20lowest%20consumption%20modes%3A%20Low-Leakage%20Stop%20(LLS)%20and%20Very%20Low-Leakage%20Stop%20modes%20(VLLS).%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAttached%20document%20provides%20a%20brief%20introduction%2Fexplanation%20on%20these%20modes%20and%20lists%20the%20steps%20needed%20to%20configure%20MCU%20to%20operate%20in%20any%20of%20these%20modes.%20It%20is%20a%20bare-board%20project%20for%20FRDM-KL26Z%20but%20same%20principle%20applies%20to%20other%20Kinetis%20families.%20Also%2C%20two%20projects%20for%20KDS%20v3.2%20are%20attached%20for%20reference.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20hope%20you%20can%20find%20them%20useful!%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EIsaac%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1106525%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EKinetis%20L%20Series%20MCUs%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1106527%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Power%20Management%20on%20Kinetis%20MCUs%3A%20LLS%20and%20VLLS%20modes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1106527%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EPORT_MemMapPtr%20is%20a%20pointer%20to%20structure%20and%20PORT_Type%20is%20only%20the%20structure.%20You%20need%20to%20define%20an%20array%20of%20pointer%20to%20structures%2C%20in%20this%20case%2C%20you%20will%20need%20to%20replace%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3Bstatic%20PORT_Type%20g_portPtrs%5B%5D%20%3D%20PORT_BASE_PTRS%3B%3C%2FP%3E%3CP%3Eby%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3Bstatic%20PORT_Type%20*g_portPtrs%5B%5D%20%3D%20PORT_BASE_PTRS%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAnd%20it%20should%20work%20well!%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EIsaac%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1106526%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Power%20Management%20on%20Kinetis%20MCUs%3A%20LLS%20and%20VLLS%20modes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1106526%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Isaac%2C%3C%2FP%3E%3CP%3EThank%20you%20very%20much%20for%20creating%20this%20very%20helpful%20doc%20and%20code!%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20port%20to%20the%20frdm-k22f%20and%20notice%20that%20the%20header%20file%20is%20different%20for%20register%20accessess.%20%26nbsp%3BI%20have%20cleard%20most%20of%20the%20errors%20but%20am%20stuck%20with%20this%20error%20in%20the%20gpio.c%20file.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20had%20to%20change%20this%20line%20to%20the%20following%3A%3C%2FP%3E%3CP%3Estatic%20PORT_MemMapPtr%20g_portPtrs%5B%5D%20%3D%20PORT_BASE_PTRS%3B%3C%2FP%3E%3CP%3EChanged%20to%3A%3CBR%20%2F%3Estatic%20PORT_Type%20g_portPtrs%5B%5D%20%3D%20PORT_BASE_PTRS%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EBut%20get%20an%20error%20on%20this%20line%20which%20I%20do%20not%20understand%3A%3C%2FP%3E%3CP%3E%26nbsp%3Bg_portPtrs%5Bport%5D-%26gt%3BPCR%5Bpin%5D%20%3D%20PORT_PCR_MUX(1)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EError%3A%3C%2FP%3E%3CP%3E..%2Fsource%2Fgpio.c%3A75%3A25%3A%20error%3A%20invalid%20type%20argument%20of%20'-%26gt%3B'%20(have%20'PORT_Type')%3CBR%20%2F%3E%20g_portPtrs%5Bport%5D-%26gt%3BPCR%5Bpin%5D%20%3D%20PORT_PCR_MUX(1)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20will%20upload%20working%20code%20once%20I%20get%20it%20running%20in%20case%20it%20is%20useful%20to%20anyone%20else.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EEdit%3A%20%26nbsp%3BFound%20the%20problem%20to%20be%20that%20the%20definition%20needed%20to%20be%20deferenced%20as%20below%3A%3C%2FP%3E%3CP%3Estatic%20PORT_Type%20*%20g_portPtrs%5B%5D%20%3D%20PORT_BASE_PTRS%3B%3C%2FP%3E%3CP%3EAlso%20see%20we%20had%20overlapping%20posts.%20%26nbsp%3BThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎09-15-2016 01:56 PM
Updated by: