About the question of low power consumption

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

About the question of low power consumption

Jump to solution
2,203 Views
jinchengxie
Contributor I

After 9S12 into waiting mode, how to keep the GPIO level,Thanks!!

Labels (1)
0 Kudos
Reply
1 Solution
1,736 Views
kef2
Senior Contributor V

It looks like you keep COP enabled in WAIT mode and COP times out while you are in WAIT mode. Of course each reset resets all I/O settings. I think also that you didn't define COP reset vector, at least your map file shows defined only vector 66 @ 0xFF7A. No wonder than that MCU on COP reset can land in state you wrote: "crash", "no boot" , "no wake" etc.

COP can be disabled in WAIT mode. Look at COPWAI bit in CLKSEL. Please keep in mind that COPWAI bit is write once bit in normal (non debug) mode, so first write to CLKSEL (any CLKSEL bit) must initialize COPWAI to desired level.

Edward

View solution in original post

0 Kudos
Reply
10 Replies
1,736 Views
jinchengxie
Contributor I

@Edward Karpicz ,@iggi

  

After I debug, found out the problem.Please refer to my attached example.

If the program does not open the COP, after entering the WAIT mode, PE4 output is normal,And through external interrupt( PIN->PP2) awakening,PE4 can switch level and keep it.

But,When I open the COP, after the program is run into the waiting mode, Program is abnormal(Program crashes, and not to boot),And PE4 output of about 2.5V level,And the external interrupt doesn't wake up.What is the problem?   Thanks!

Note: the test is not BDM connection.because PE4 is also called ECLK and so it has two functions. One is GPIO (PE4), and the other is a free-running clock (ECLK).

Regards,

xjc

0 Kudos
Reply
1,737 Views
kef2
Senior Contributor V

It looks like you keep COP enabled in WAIT mode and COP times out while you are in WAIT mode. Of course each reset resets all I/O settings. I think also that you didn't define COP reset vector, at least your map file shows defined only vector 66 @ 0xFF7A. No wonder than that MCU on COP reset can land in state you wrote: "crash", "no boot" , "no wake" etc.

COP can be disabled in WAIT mode. Look at COPWAI bit in CLKSEL. Please keep in mind that COPWAI bit is write once bit in normal (non debug) mode, so first write to CLKSEL (any CLKSEL bit) must initialize COPWAI to desired level.

Edward

0 Kudos
Reply
1,736 Views
jinchengxie
Contributor I

@Edward Karpicz ,@iggi

Thank you, your answer is great, I have already solved the problem.

0 Kudos
Reply
1,736 Views
jinchengxie
Contributor I

 I configured as you said.GPIOE4 also has a high output in Run mode,But after entering wait mode GPIOE4 was lower,Without any operation.However after I through external interrupt awakens the MC9S12, GPIOE4 high level has been resumed.Why it is the case?

Regards,

xjc

0 Kudos
Reply
1,736 Views
iggi
NXP Employee
NXP Employee

I didn't notice that earlier, it's a bit tricky with the PE4 pin, because this pin is also called ECLK and so it has two functions. One is GPIO (PE4), and the other is a free-running clock (ECLK).

The free-running clock is actually a bus clock on ECLK pin and this is used as a timing reference.

When MCU is in Special mode (BDM connected), ECLK is enabled after reset and so GPIO function is 'masked'.

Without BDM connection, MCU is in Normal mode, the ECLK is disabled and GPIO function works normally.

See MC9S12XEP100 ref. manual and chapters 2.3.15 ECLK Control Register (ECLKCTL) and 5.1.1 Glossary or Terms.

0 Kudos
Reply
1,736 Views
jinchengxie
Contributor I

I'm sorry, I didn't say clearly MCU.I use the MCU is MC9S12XET256.But Is not this reason.Beacause When I test, no connection BDM.And I also try PB4, also have the same problem.

Regards,

xjc

0 Kudos
Reply
1,736 Views
kef2
Senior Contributor V

Jin,

S12XE family wait mode doesn't affect pin states in any way. You must be doing something wrong. Please provide code which could reproduce your problem. Please also use oficial pin and port names, there are no pins called GPIO in S12XE!

Edward

0 Kudos
Reply
1,736 Views
iggi
NXP Employee
NXP Employee

The previously attached example does exactly what you describe, except that Port A (GPIOA) is used instead of Port E (GPIOE) and we enter Stop mode instead of Wait.
So if you want to set Port E pin 4 and enter Wait mode, then do following:

DDRE_DDRE4 = 1; //set port pin as output

PORTE_PE4 = 1; //set high level on pin output.

asm wai;  //enter wait mode

Regards,

iggi

0 Kudos
Reply
1,736 Views
iggi
NXP Employee
NXP Employee

On how you configure the port registers before low-power mode (stop or wait), that will be reflected in the low-power mode too.

See attached example. After configuring the Port A as output and setting logic one on the pins, MCU goes into stop mode and Port A output pins stay high as that is indicated by LEDs on the demo board.

Regards,

iggi

0 Kudos
Reply
1,736 Views
jinchengxie
Contributor I

Thank you for your answer。But I am sorry I mean could not express it clearly.

My question:Is it possible to keep the state of the GPIO(MC9S12) output at WAIT mode?If it can be ,Then how to configure the register?

[Ex, GPIOE4 ouput high (in Run mode) --> GPIOE4 output high (in Sleep mode)]——Keep the level

In fact, I'm in the process of using the MC9s12.Once in wait mode, GPIO all no output, all GPIO is low level.

Thanks!

Regards,

xjc

0 Kudos
Reply