DEEP SLEEP

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

DEEP SLEEP

2,277 Views
haroldvogel
Contributor II

Here is the code that I am using to put my MK36L256VLL4 chip into Deep Sleep but the system is drawing 175m volts.  Hope some one can tell me where I am going wrong:

Original Attachment has been moved to: deepSleep.c.zip

0 Kudos
31 Replies

1,415 Views
haroldvogel
Contributor II

Hello Ping,

I was able to figure out how to use the PE and PS values in setting the internal resisters to a pull -up or pull-down setting.

This seems to work in lowering the amps to the value required.

I am still having a problem, as I have said this is code that I inherited and when the A/C power is re-connected the unit would come alive automatically now I have to press the reset button.  I have tried running the code in debug mode but I don't see the code returning to the line after the 'wfi' call (not sure if I can do this in debug anyway).  I hope that you have some ideas on what I can check or what I have done to cause the unit to stop coming out of deep sleep mode.

John V.

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Harold,

Thanks for your reply.

The debug function definitely will break down after MCU enter some kind of the low power modes.

You should configure the wake up source prior to enter the low power mode, then you can check the related status register which indicates what the kind of interrupts had been caused, finally you can find out the wake-up source.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello Ping,

It appears that I was wrong I had the test equipment connect wrong and the unit is still using more power than it should.  Though it is not waking up like it should when power is re-applied.

John V.

0 Kudos

1,415 Views
haroldvogel
Contributor II

The problem has been fixed.

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Harold,

You can find the table on the page 185 in the attachment.

1. Internal pullup or pulldown resistor is enabled on the corresponding pin, if the pin is configured as a digital input."  Now, if the pin is configured as an output does this still work?

No, it will be disabled.

2. From reading this cryptic table I guess that both PS and PE have to be used to set the pullup or pulldown resister?

Yes


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello Ping,

Would like to know what document you got the table from.

I noticed that the PE 1 "Internal pullup or pulldown resistor is enabled on the corresponding pin, if the pin is configured as a digital input."  Now, if the pin is configured as an output does this still work?  From reading this cryptic table I guess that both PS and PE have to be used to set the pullup or pulldown resister?

John

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Harold,

Many pins are allowed to be pulled up with the internal pullup resistor, and you can configure the kind of feature through the PE and PS bit in the PORTx_PCRn register.

2016-05-17_10-29-17.jpg


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello,

The selection that you give me is in Chinese (I believe), I cannot read the page.  Please send me the link in English.

Did you have a chance to look over the other items that I have posted and sent to you?

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John,

I've already had a look through the other items, and you thought the kind of GPIO configuration may corrupt the MCU enter the low power mode.

However from my experience, to enter the low power mode hasn't be associated with the GPIO configuration, so I think you'd better to refer the demo code.

Click the link

FRDM-KL25Z|Freedom Development Platform|Kinetis MCU|NXP

Hope it helps.

Have a great day,

Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello Ping,

I have seen code like this before. The problem is that it does not look like anything that I inherited and which (as I have written before) puts the unit into Deep Sleep with a 4 micro amp code. After (I know that I have written this before) adding new pins to be used the system does not go into deep sleep.

So it seems to be something between the Processor Expert generated code and the code that I modified to turn off the pins when going into Deep Sleep which does not seem to be working. I don’t believe that it might be a GPIO MUX item since the turn off the system all seem to use the same ~(uint32_t)(PORT_PCR_MUX(MUX_MASK)).

Sincerely,

H. John Vogel

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John,

Let me clarify it.

According to your reply. the function Enter_Power_Save(void) can put the MCU enter the LLS mode with a 4 micro amp code if prior to remove the shutDownIO()  , and however the consumption will increase too much after add the shutDownIO() in the the function Enter_Power_Save(void).

Does it correct?

void Enter_Power_Save(void)

{

    shutDownIO();

   

    while(1){

   

        enter_lls();

        //

        // Do a partial restoration of I/O, enough to read the state of /ACOK

        //

        SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;

        PORTB_PCR7   |= (uint32_t)(PORT_PCR_MUX(MUX_GPIO));    // nACOK

   

        Delay_ms(200);

   

        if(RUNNING_FROM_BATTERY){

            //

            // If we're still running on battery, shut down I/O port B, go back to sleep

            //

            PORTB_PCR7   &= ~(uint32_t)(PORT_PCR_MUX(MUX_MASK));    // nACOK

            SIM_SCGC5 &= ~(SIM_SCGC5_PORTB_MASK);

        } else {

            //

            // Looks like AC power is restored, exit this loop...

            //

            break;

        }

    }

}


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello Ping,

Let me try this again.

The code that I inherited worked fine, when in Deep Sleep the current was in the 4-20 micro amps.

I have added 3 gpio lines that are being used now. I added them using Processor Expert and then I added the pins to the Shut Down function and the Start Up function, to turn them off and on. After adding the pins when I went to check the current in Deep sleep I find that it is now in the 400 micro amp area.

So I believe that it is with the new pins added and that I might have done something wrong with Processor Expert, being new to using this tool I just may have, or in some other part of the gpio line construction. The GPIO lines to function as they should.

Sincerely,

H. John Vogel

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Harold,

After several experiments, please assure all I/O pins be initialized to be either outputs driving or inputs with pullups enabled to achieve the lower power consumption.

The will ensure that there is no extra current consumption due to floating inputs, then measure the current consumption again.

Hope it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello Ping,

I have checked the pins and they are all configured correctly for Input or Output.

I don't not know how to insure that the pins have pull-ups enabled?

0 Kudos

1,414 Views
haroldvogel
Contributor II

Hello Ping,

I understand what you are saying but the fact that I took existing code and the sleep mode was okay. After adding a few new pins to be used the sleep current goes up to 440 micro amps. So the indication is that the configuration of the new pins is what caused the problem. As I have said, I am new to using Processor Expert and configuring items using the generated code.

John V.

0 Kudos

1,415 Views
haroldvogel
Contributor II

Hello Ping,

Some more information.  I am not sure how to send such information to you but I have add a number of pins using Processor Expert to the system.  When I load code that does not have these pins in processor expert nor the generated code the system goes to about 4 micro amps.

Now, I am new to Freescale and also Processor Expert so something might have gone wrong in the creation of the generated code.  I then added the pins that I used to the PowerManagement module (function).  I will gladly send you what code that you might like to look at to help me figure out what is wrong with the Deep Sleep.

John V.

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John,

Downloading the sample code package flow:

  1. Click the 面向Kinetis KL的Freedom开发平台|恩智浦
  2. Download the sample code package

2016-05-11_10-42-18.jpg

  3. After install the sample code package, you can find the PEx_low_power_demo which integrates with the PE.2016-05-11_10-46-35.jpg

Hope it helps.

Have a great day,

Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John,

You can disable the clock of the PORT prior to enter the low power mode, it will guarantee the enter low power operation execute well.

I'd highly recommend you to refer to the FRDM-KL25's sample code package which contains the low power demo, and I think it can help you out.

FRDM-KL25's sample code package: 面向Kinetis KL的Freedom开发平台|恩智浦

Hope it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,415 Views
haroldvogel
Contributor II

I have attached all the new code that has been generated from the new pins that have been added to the system.

I did not add this but I have added the TSS code which uses USART0 in the other version of the code it uses USART1.

John

0 Kudos

1,415 Views
haroldvogel
Contributor II

Also none of the code that I down loaded and have looked at explain anything to me about the use of PORT_PCR_MUX(MUX_MASK); and/or PORT_PCR_MUX(MUX_GPIO);

I am also not sure if that is why the unit is still running at 440 micro amps when it is in Deep Sleep mode.  The EE has looked over the pins and does not see any pins that I have missed.  The EE was wondering if there are any internal pull up resisters on ports which are not connected?

John

0 Kudos