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 */
}
Hello, I set it up according to your method. The current consumption when the single-chip microcomputer 3.3V enters VLPS is 1.2mA, and it cannot be reduced to 60uA. How did you do it?
Hello,
Does the S32K148 run in the debug mode? Because debug in low-power modes, with debug enabled, transitions from Run directly to VLPS are not allowed and result in the system entering Stop mode instead.
How do you measure current consumption?
Best regards,
Diana
Hi Diana,
Thanks for your reply and sorry for my late response back.
I am running the S32K148 with the debugger disconnected after programming, is that what you mean by debug mode?Otherwise I am not sure what you mean by debug mode, could you explain? I do think there is something like you describe happening because the current consumption does not change when I change the code to sleep in either STOP or VLPS modes.
I am compiling with S32 Design Studio and have created a "Release" build configuration based on the default release configuration. However this build has the same current consumption values as my debug build. I do notice a drop in current consumption when the JTAG debugger is disconnected but the consumption still seems higher then it should.
We have modified the target board so that the MCU is isolated from the other peripherals. We have now also removed some power components so that I need to use a 5V supply to the board. When sleeping the current consumption is 0.425 mA at 5V. I am measuring the current draw by having a precision digital multimeter inline with the power supplied to the board and MCU. Do you recommend another approach?
I am less concerned that my current measurement only current the MCU current draw but more concerned that I am not putting the MCU in its lowest possible current consuming mode.
Thanks,
Stephan
Hi Stephan,
Yes, if you have debugger disconnect, you are not in the debug mode. More information in the RM – chapter 53.13 Debug in low-power modes.
I assume, you are in the VLPS mode because power consumption according to datasheet in the STOP mode is higher.
Have you met the conditions in the AN5425 - chapter 7.3 Tips for making low-power measurements on the bench?
Best regards,
Diana
Hi Diana,
I understand debug mode equates with having the debugger connected.
I have read AN5425 and trying to follow it as best I can.
I agree it does seem like the power measurement indicates running in VLPS
mode, but I would expect the power measurement to be even lower.
hate to bring up a different issue but in my quest to reduce power
consumption while the MCU is sleeping I have seemingly bricked my board. I
have disabled some of the JTAG pins (see below) and now I can no longer
connect to the device.
I am using a PE Micro USB Multilink Universal programmer connected to the
following pins on our board.
PTA4 JTMS_SWDIO (now disabled)
PTC4 JTCLK_SWDCLK
PTA10 JTDO (now disabled)
PTC3 JTDI
PTA5 nRST (now disabled)
Do you have any suggestions on how to reconnect to the board? I need a way
to clear the S32K148 flash so that I can prevent the JTAG pins from being
disabled. I have found the tool "Flash magic" but it does not support the
S32K1xx family.
UPDATE
I have been able to recover debugger access to the S32K148 MCU after I downloaded firmware that reassigned the JTAG and nRESET pins.
To recover I did the following.
1 - Attempt a flash download to the device. If the connection fails I see a P&E Connection assistant window providing options to retry the connection or abort.
2 - Now repeatedly click the “retry” button while also repeatedly power cycling the device (or press reset button if there is one). Keep doing this until the flash download begins and the “P&E Connection Assistant” no longer appears. This might take dozens of attempts to get the timing just right.
The goal is to prevent any of the code on the S32K148 to execute prior to the debugger forcing the S32K148 into debug. This allowed me to flash the MCU with "fixed" firmware and continue using the devugger for further firmware programming.
On Tue, Dec 19, 2017 at 5:12 AM, dianabatrlova <admin@community.nxp.com>