Hi punith B,
Here are some driver code enter low power for your reference:
void PMC_Init(PMC_Type *pPMC, PMC_ConfigType *pPMC_Config)
{
pPMC->SPMSC1 = pPMC_Config->sCtrlstatus.byte;
pPMC->SPMSC2 = pPMC_Config->sDetectVoltSelect.byte;
}
void PMC_SetMode(PMC_Type *pPMC,uint8_t u8PmcMode)
{
switch(u8PmcMode & 0x3)
{
case PmcModeRun:
break;
case PmcModeWait:
/* Clear the SLEEPDEEP bit to make sure we go into WAIT (sleep) mode instead
* of deep sleep.
*/
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
/* Not using KEIL's uVision, so use the standard assembly command */
asm("WFI");
break;
case PmcModeStop4:
/* enable LVD in stop mode */
pPMC->SPMSC1 |= (PMC_SPMSC1_LVDE_MASK | PMC_SPMSC1_LVDSE_MASK);
/* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Not using KEIL's uVision, so use the standard assembly command */
asm("WFI");
break;
case PmcModeStop3:
/* disable LVD in stop mode */
pPMC->SPMSC1 &= ~(PMC_SPMSC1_LVDE_MASK | PMC_SPMSC1_LVDRE_MASK | PMC_SPMSC1_LVDSE_MASK);
/* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Not using KEIL's uVision, so use the standard assembly command */
asm("WFI");
break;
default:
break;
}
}
More details, you can refer to FRDM_KEA64_PMC sample code in this link:
Wish it helps you!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for support. and could you please let me know fallowing query.
How to put S9S12GA240 micro controller in sleep mode?. What is cpu current
taking in sleep and run mode?
On Fri, Jul 29, 2016 at 8:22 AM, kerryzhou <admin@community.freescale.com>
Hi punith,
I am the kinetis engineer, not the 16bit mcu engineer.
So, if you have the 16bit mcu question, please go to this link, and create a new question:
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jingjing
Ok I will ask in same. In run mode my board is taking 53mA. even if i put
in sleep mode the current is same.
Here how i did.
ICS->C1 &=~ICS_C1_IRCLKEN_MASK; /* Disable the internal reference clock*/
PMC->SPMSC1 = 0x80;
PMC->SPMSC2 = 0x00;
PMC->SPMSC1 &= ~PMC_SPMSC1_LVWIE_MASK;
/* disable LVD in stop mode */
PMC->SPMSC1 &= ~(PMC_SPMSC1_LVDE_MASK | PMC_SPMSC1_LVDRE_MASK |
PMC_SPMSC1_LVDSE_MASK);
/* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Not using KEIL's uVision, so use the standard assembly command */
__WFI;
while(1);
Please let me know what is the problem?.
On Fri, Jul 29, 2016 at 1:01 PM, kerryzhou <admin@community.freescale.com>
Hi punith,
What the test point you are measure the current in your board? You should make sure the test point just measure the KEA chip's currect, not include other external chip, you can post the schematic which shows your power measurement testpoint.
Before you enter the stop mode, what the internal module your are enabled? 53mA is high to MCU if you didn't enable any other peripheral according to the datasheet.
Did you enable the interrupt before enter sleep mode? interrupt will wake up the sleep mode, we need to know whether the chip is waked up immediately after entering the sleep mode.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jingjing,
Now I am able to generate the RTC interrupt which is working fine. Thank
you for your support. Could you please let me know what is current will
take by RTC in both wake and sleep mode?. In my board i am using internal
clock as bus clock.
Hi punith B,
For the detail RTC consumption, you need to test it on you side, because the datasheet normally just give the mcu consumption, and it didn't give the module consumption in detail situation.
Our datasheet just give the data in the stop mode with LPO clock:
RTC adder causes IDD to increase typically by less than 1 μA; RTC clock source is 1 kHz LPO clock.
So, if you want to use the internal bus clock, you can test it on your board.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi punith,
From the reference manual:
You can get that the interrupt can wake up the sleep mode, so you can use GPIO interrupt to wake up the sleep mode.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your support? Could you please let me know what all GPIO i
can use as GPIO interrupt for KEA64 controller to wake from sleep?.
On Wed, Aug 10, 2016 at 12:08 PM, kerryzhou <admin@community.freescale.com>
Hi Punith,
KEA64 don't have the GPIO interrupt, so you need to use IRQ or KBI interrupt.
IRQ is assigned to pin PTAB5 by default.
KBI pin can be PTA0,PTA1,PTA2,PTA3, PTB0-PTB3.
Wish it helps you!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jingjing,
I have used fallowing in my code for RTC in my code to comes out of sleep
mode but RTC interrupt not at all executing.
In main
/* Initialize RTC */
RTC_ConfigType RTC_Config=;
RTC_Config.u16ModuloValue = 3;
RTC_Config.bInterruptEn = 1; /* Enable interrupt */
RTC_Config.bClockSource = RTC_CLKSRC_1KHZ;/* Clock source is 1khz */
RTC_Config.bClockPrescaler = RTC_CLK_PRESCALER_1000; /* Prescaler is
100 */
RTC_SetCallback(RTC_Task);
RTC_Init(&RTC_Config); /* Initialization of RTC */
in interrupt
void RTC_Task(void)
{
/* toggle BLUE LED */
//OUTPUT_TOGGLE(PTE,PTE7); /* Toggle on BLUE LED *
//printf("\nRTC routine.\n"); /* Print Message */
}
I am using internal clock as main clock in my code which is 25MHZ.
could you please let me know why RTC interrupt is not working?.
Regards
Punith