MCF5213 stopmode

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

MCF5213 stopmode

2,823 Views
jean-marcneuvil
Contributor I

Hello

(I'm a french eng. developping on MCF5213 and CW10.6 IDE).

 

How can I enter the STOP mode to reduce consumption ?

 

I configured the PROCESSOR EXPERT, but when executing

 

          asm(stop #0x2000);

nothing occurs... it doesn't enter the STOP mode at all.

How to manage this stop mode with the IDE ?

 

Thx for any help

JM

Labels (1)
0 Kudos
Reply
7 Replies

2,558 Views
TomE
Specialist II

> …I’m sorry to ask you again what to do “simply” to try to reduce the

> consumption to the lowest possible to save power.

"Simply" is to change to a CPU that makes it easy. Going to low power on old silicon is difficult.

> Do you think it might be an idea to go in the way: changing dynamically the clock speed ?

That is always difficult when you consider the peripherals. Are you sure you can't just RUN at a low speed? If you (say) run at 20MHz 10% of the time you'll get the same number of CPU instruction cycles and approximate current consumption as if you just run all the time at 2MHz, and the latter will be far simpler to get working. Or 1MHz as you've noticed in the Data Sheet.

For low current you want the slowest external crystal as that drops the oscillator current consumption. So you might want to try and use a 2MHz crystal. Another possibility (I'm not familiar with this chip) might be to use a fast crystal, but turn it off completely and run from the "on chip relaxation oscillator" with the PLL disabled and with the Low Power Divider getting you down to 1MHz or even lower. When you want to power up you have to enable the crystal, wait, switch to the crystal, wait, enable the PLL, wait, switch to the PLL and then run. Or something like that. You won't be able to rely on processor Expert for this, you'll have to learn how to do it yourself. And run from RAM in low power mode and not from FLASH.

> Is it possible to dynamically switch from 80 to 1 MHz when I want to save power, and be waked

> from my PIT modulus normally, and then come back to 80MHz ?

Anything is possible. Sure you can't just run slow? What does your device do? Does it wait for hours then have to do something quickly for a short time?

Why not add an external oscillator that turns your main voltage regulator on. Then the chip boots, does whatever it has to do and then powers itself off completely with the external oscillator waking it up some milliseconds (or seconds) later? That's how some early laptops worked. It your device has to wake up on an external "trigger" then have that power it on. It might be more reliable and easier to debug than getting all the power modes and clock switching working.

> For sure, it sounds good, but once more, it’s not immediate and it doesn’t work.

> I tried to setup... and a connection through a PE-multilink

You can't run low power modes and low speed AND use a debugger module. They don't work at slow (or stopped) clock rates. That's one of the things that makes this difficult. You have to go back to "debugging on bare metal" by burning code, unplugging, turning it on, watching it fail and then reverting to blinking LEDs and printing on a serial port to debug it. It might work if you don't slow down the CPU too much (or go into clock-stopping modes) and don't stop clocks the debugger depends on, AND you may have to reconfigure the debugger to run slower. Read this link:

https://community.nxp.com/message/27566#comment-27566

0 Kudos
Reply

2,558 Views
jean-marcneuvil
Contributor I

Dear Tom

I begin to come to the complete redesign of the structure, adding to a MC9S08 managing the power for all the rest of the board.

The 9S08 consumption will be at least at 3mA, and will be able to analyze an external pwm input coming from an external RSSI (radio) and wake up correctly the MCF.

For the moment, it will be difficult to go to a K60 due to the small time to market dedicated to this prototype.

Anyway, your indications are clear and helpful, thanks a lot.

Best regards and thank you for your implication in my posts ;o) so much.

(and sorry for my poor English in case of !)

JM

Jean-Marc NEUVILLE

Responsable Activités Electroniques / Electronic Activities Manager

jean-marc.neuville@tas.fr<mailto:jean-marc.neuville@tas.fr>

Mobile : +33 (0)6 99 70 39 56

www.tas.fr<http://www.tas.fr/>;

NOTICE TO RECIPIENT : This e-mail and any attachment hereto are confidential and are meant for the intended recipient of the transmission only. If you received this e-mail in error, any review, use, dissemination, distribution or copying of this e-mail is strictly prohibited. Please notify us immediately of the error by return e-mail and please delete this message and any attachment from your system. Thank you in advance for your cooperation.

De : TomE

Envoyé : mercredi 15 juin 2016 09:21

À : Jean-Marc Neuville

Objet : Re: - MCF5213 stopmode

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

MCF5213 stopmode

reply from Tom Evans<https://community.nxp.com/people/TomE?et=watches.email.thread> in ColdFire/68K Microcontrollers and Processors - View the full discussion<https://community.nxp.com/message/719260?et=watches.email.thread#comment-719260>

0 Kudos
Reply

2,558 Views
TomE
Specialist II

> developping on MCF5213

That chip has a "10 year life" starting in 2005. You shouldn't be starting on this chip if you can use something newer. And the newer ones have better low power modes if that is important for you.

> the MCF5213 seems to reduce the consumption to at least 30 ma.

> Its too much.

So how low do you need to go in your design?

Low current is very hard and a real battle. For what to expect, read this:

Whac-A-Mole - Wikipedia, the free encyclopedia

Are you sure the CPU chip is drawing the 30mA? Have you accounted for (or better, actually measured) the current taken by the rest of the board? You probably have power supply chips (regulators) that have a static current. Any I/O chips like Ethernet, USB (you don't have these on-chip), CAN or RS-232 will draw power. Even something like a 5.6V "protection zener diode" on a power supply will leak a lot more current than you'd expect.

Note that from the Reference Manual, all the GPIO Pins have pullups on them. This is NOT mentioned at all in the GPIO chapter, but the GPT module mentions it in Table 18.2, and "Note 2" on "Table 2-1. Pin Functions by Primary and Alternate Purpose" says "All signals have a pull-up in GPIO mode". What is that going to do to your power consumption? The current from each pin is only 100uA or so, but they might be turning things on you didn't expect.

If any CPU (or other peripheral) pins are floating or at an intermediate level you can get relatively high leakage currents through the input gates. I've had this happen on ADC inputs on one device. The only way to get low current was to program all the ADC inputs as GPIO outputs and drive them. That was a bad chip design (not Freescale), but you may need to check what your ADC pins are doing.

Here's an example of what can happen (but not to me). A Buffer chip driving some LEDs, with the buffer disabled to make sure all were off. The board drew way too much current when exposed to light, but was OK in the dark. When light shone on the LEDs they generated 1.5V and pushed the buffer pins to the "intermediate level" where the receivers (it was a bidirectional buffer chip) started drawing a lot of current. See what I mean by "Whac-a-Mole"?

> but the pit modulus doesnt wake it up

There are a few things here. All of the clocks into the PIT have to be active. Make sure you haven't shut off an "upstream clock". A good summary is "Table 17-1. PIT Module Operation in Low-power Modes". The PIT can't wake from STOP mode, only DOZE mode. And DOZE takes 30mA at 80MHz. You can get it down to 11mA at 8MHz. Is that low enough? There are WAKE bits that have to be set. As well, the PIT Interrupt has to be enabled, and the PIT interrupt level has to be higher than the CPU's IPL level set by the STOP instruction immediate value. Make sure the PIT can interrupt without stopping before seeing it can interrupt it out of stop.

Did you note that running the "STOP" instruction from RAM gives lower power than running it from FLASH? Have you tried that?

If you have to get to STOP mode levels, then you can't use the PIT to wake. You can't use the GPT or PWM to wake in ANY modes. You have to use an external (low power) oscillator connected to an Edge Port Pin. You could use a GPIO pin, diode, resistor, capacitor and a schmitt trigger. So have the GPIO normally pulling the capacitor down. When you want to go to low power, let go the GPIO and STOP. When the capacitor charges up enough to trip the schmitt trigger it causes an edge-port interrupt one or more milliseconds later, depending on the RC time constant.

Tom

0 Kudos
Reply

2,558 Views
jean-marcneuvil
Contributor I

Hello Tom’E

Difficult for me to go ahead, and unfortunately, I have just a few time on this subject (always out of office), and I had to delay my reply to your post (sorry for this).

è Once more, thank you for the time you spent on my topic, and for the quality of your response.

We consider an existing design based on this MCF5213, for sure if I have the opportunity to redesign this board, I will look toward a K60 to better manage the power.

I have an idea of the controller consumption itself, because I made measurements with and without the chip, taking care of the hardware to be as passive as possible.

Then:

…I’m sorry to ask you again what to do “simply” to try to reduce the consumption to the lowest possible to save power.

Do you think it might be an idea to go in the way: changing dynamically the clock speed ?

I would just try to reduce the consumption of the MCF to just a few milliamps, and in the electrical characteristics, its given for less than 4mA for Typical Active Current Consumption if running at 1MHz core & I/O, in place of 64mA at 80MHz. 4mA should be acceptable for me.

- Is it possible to dynamically switch from 80 to 1 MHz when I want to save power, and be waked from my PIT modulus normally, and then come back to 80MHz ?

For sure, it sounds good, but once more, it’s not immediate and it doesn’t work.

I tried to setup my configuration (with Processor Expert), so I did the test this morning with processor expert and a connection through a PE-multilink : after executing the setReg16(SYNCR, 0x6607U);

then the consumption decreases at an acceptable level, but the debugger loose the control.

Here is the function Cpu_SetLowSpeed coming from Processor Expert:

void Cpu_SetLowSpeed(void)

{

if (CpuMode != LOW_SPEED) { /* Is an actual cpu mode other than low speed mode? */

EnterCritical(); /* If yes then disable global interrupts */

/* SYNCR: LOLRE=0,MFD=6,LOCRE=0,RFD=6,LOCEN=0,DISCLK=0,FWKUP=0,??=0,??=0,CLKSRC=1,PLLMODE=1,PLLEN=1 */

setReg16(SYNCR, 0x6607U); /* Set the SYNCR register */

while (!(SYNSR & SYNSR_LOCK_BITMASK)){} /* Wait until the PLL is locked. */

/* LPDR: ??=0,??=0,??=0,??=0,LPD=0 */

setReg8(LPDR, 0x00U); /* Set the low power divider */

ExitCritical(); /* Enable global interrupts */

CpuMode = LOW_SPEED; /* Set cpu mode */

}

WakingCycle_SetLow(); /* Set all beans in project to the low speed mode */

}

I cannot know what happen, it looks like if the PLL hangs when below 8MHz.

Can you see something particular ?

How can I investigate ?

May be, more basically, the system hangs if I change the original configuration for clocking below 16MHz (system clock)/8MHz(bus clock).

How to go to 2/1 MHz ???

Once more, Thanks so much…

JM

Jean-Marc NEUVILLE

Responsable Activités Electroniques / Electronic Activities Manager

jean-marc.neuville@tas.fr<mailto:jean-marc.neuville@tas.fr>

Mobile : +33 (0)6 99 70 39 56

www.tas.fr<http://www.tas.fr/>;

NOTICE TO RECIPIENT : This e-mail and any attachment hereto are confidential and are meant for the intended recipient of the transmission only. If you received this e-mail in error, any review, use, dissemination, distribution or copying of this e-mail is strictly prohibited. Please notify us immediately of the error by return e-mail and please delete this message and any attachment from your system. Thank you in advance for your cooperation.

De : TomE

Envoyé : dimanche 12 juin 2016 13:47

À : Jean-Marc Neuville

Objet : Re: - MCF5213 stopmode

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

MCF5213 stopmode

reply from Tom Evans<https://community.nxp.com/people/TomE?et=watches.email.thread> in ColdFire/68K Microcontrollers and Processors - View the full discussion<https://community.nxp.com/message/669170?et=watches.email.thread#comment-669170>

0 Kudos
Reply

2,558 Views
TomE
Specialist II

> it doesn't enter the STOP mode at all.

How do you know? What are you expecting to happen when you execute that instruction?

You should read through the entire Chapter 6 and Chapter 7 to understand how this works. I'd recommend reading the entire manual cover to cover first before coding on these complicated chips.

> I configured the PROCESSOR EXPERT,

You configured it to WHAT? Does it have pages of settings for low power mode or does it just set a few defaults? Have you looked at the generated code (and compared it to the Reference Manual) to see if it set it up the way you want it set up?

How have you (or PE) set the LPMD and STPMD bits in the LPCR? By default and out of reset these are set to do NOTHING on "stop mode".

LMPD selects RUN/WAIT/DOZE/STOP power modes on execution of the STOP instruction. STPMD determines what else gets turned off in STOP mode.

Section 2.2 of the DATA SHEET details the current consumption in the various modes.

In the "default mode" the CPU stops, and the current should drop from 45mA to 33mA (at 80MHz). Enabling more severe "stop modes" can get the current down to 5mA, 2mA and 130uA.

The more severe the stop mode, the more complicated your code has to be and the more restrictive, with you having to turn peripherals off and then turn them on again when waking.

0 Kudos
Reply

2,558 Views
jean-marcneuvil
Contributor I

Hello Tom

Thx for your reply I m sure this will help

Im not in front of the code now.

As soon as I can on monday I will look in details, but here is what I can say for the moment :

I have set the Lpcr/Lpicr to enter in stopmode when encountering the asm stop instruction and, you are right, the MCF5213 seems to reduce the consumption to at least 30 ma.

Its too much.

In this case, my pit modulus interrupt doesnt even wake up the MCF5213 despite the config of the wake up condition for any levels of interrupt in the corresponding register

I removed the periph clocks by setting the corresponding 1 in the dedicated registers but the consumption is always the same

In a few words my situation is:

The controller seems to enter in stop

+ but the pit modulus doesnt wake it up

+ the consumption has to decrease

On monday please let me tell you more precisely about my PE configuration for the pit irq, the different control registers and so on

For the moment I wanted to ack to your help and wish you a good week end

Thx so much

Jm

(Envoyé depuis un mobile Samsung)

0 Kudos
Reply

2,558 Views
miduo
NXP Employee
NXP Employee

Hi,

I am not quite familiar with the PE. Anyway, you may look at the attached sample code on how to enter into the STOP mode for save the power.

0 Kudos
Reply