AnsweredAssumed Answered

Lowering S32K148 Power Consumption using VLPS

Question asked by Stephan de Wit on Nov 29, 2017
Latest reply on Dec 19, 2017 by Stephan de Wit

Hello,

I have a "toy" program that blinks an LED several times before going to sleep. No other peripherals are used. I want to lower the power consumption of the MCU by as much as possible while the MCU sleeps to match the datasheet. I am running on our target hardware that has flash chips and the like lifted to isolate the MCU.

 

The problem is that I cannot get the current consumption lower then 0.86mA @12V. As well I do not see a change in current consumption between STOP and VLPS modes, which suggests I am not actually running in VLPS.

 

I have read and followed AN5425 (Power Management for S32K14x) but still cannot get current consumption down to ~60 uA that is mentioned in the datasheet. The code is below.

 

Thanks,

Stephan

 

 

#define STAT_RUN 0x01
#define STAT_STOP 0x02
#define STAT_VLPS 0x10

 

#define SMC_STOP 0U
#define SMC_VLPS 2U

void switch2Sleep()
{
    // Check Power Mode Status Register
    uint32_t runMode = (SMC->PMSTAT & SMC_PMSTAT_PMSTAT_MASK) >> SMC_PMSTAT_PMSTAT_SHIFT;

    if (runMode != STAT_VLPS)
    {
            // Set the SLEEPDEEP bit to enable deep sleep mode (STOP/VLPS)

            S32_SCB->SCR |= S32_SCB_SCR_SLEEPDEEP(1);

 

            // Power Mode Control Register
            SMC->PMCTRL = (SMC->PMCTRL & ~(SMC_PMCTRL_STOPM_MASK)) | SMC_PMCTRL_STOPM(SMC_VLPS); // VLPS

 

            // Disable system PLL clock
            SCG->SOSCCSR = 0;
            SCG->SPLLCSR = 0;

 

            // Wait For Interrupt: Cpu is going into deep sleep state
            STANDBY();

 

            systemClock_InitMedSpeed(); // configure to RUN mode at 80 MHz
        }
}

 

void main(void)
{
    watchdog_Disable();
    systemClock_InitMedSpeed(); // configure to RUN mode at 80 MHz

 

    SMC->PMPROT = 0xA0; // Allow high speed run & Allow Very-Low-Power Modes
    

    // Ensure disable of fast/slow internal reference clock
    SCG->FIRCCSR = 0;
    SCG->SIRCCSR = 0;

 

    // Enable Port E4 as output BLUE LED
    PCC->PCCn[PCC_PORTE_INDEX] |= PCC_PCCn_CGC(1);
    PTE->PDDR |= (1 << 4);
    PORTE->PCR[4] = 0x00000100;

 

    // This bit disables the bias currents and reference voltages for some clock modules in order to further
    // reduce power consumption in VLPS mode.
    PMC->REGSC |= PMC_REGSC_BIASEN(1) | PMC_REGSC_CLKBIASDIS(1) | PMC_REGSC_LPODIS(1);

 

    // wait several seconds so the LED blinks

    PTE->PSOR |= (1 << 4); /* Blue led off */

    // Disable port E prior to sleeping
    PCC->PCCn[PCC_PORTB_INDEX] |= PCC_PCCn_CGC(0);

 

    switch2Sleep();

 

    // never actually get here...

    PCC->PCCn[PCC_PORTE_INDEX] |= PCC_PCCn_CGC(1);
    PTE->PCOR |= (1 << 4); /* Blue led on */
}

Outcomes