MC9S12G128 wake up from Pseudo Stop Mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MC9S12G128 wake up from Pseudo Stop Mode

跳至解决方案
3,305 次查看
1090097669
Contributor III

MC9S12G128 wake up from Pseudo Stop Mode,After Wake up Where is the program running position? if MCU wakes up from Isr,How to make the chip rerun to the main function without resetting?

标签 (4)
0 项奖励
回复
1 解答
3,034 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

1)

the code continues with the interrupt which has woken the MCU up and the it goes to the next code after the instruction asm STOP where you put the MCU to stop/pseudo stop mode.

2) If you want to return to main then just use main();

Of course, if you want to go to start of the code which uses also Startup function (CodeWarrior) you should:

a) define the function in the module you will call the Startup() from.

For example modue main.c will contain:

void _Startup(void);

b) Call the function at the place you require.

Do not forget that some register are write once only so they will not be changed by new write.

Please look  into attached example it solves something similar....

Best regards,

Ladislav

在原帖中查看解决方案

6 回复数
3,034 次查看
vijayravi
Contributor II

Hi,

I tried to wakeup from STOP mode. After waking up from STOP mode using interrupt, if i call the main function as you said, the process is slow when compared to calling startup function. may i know why is that?Re: MC9S12G128 wake up from Pseudo Stop Mode

0 项奖励
回复
3,034 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

One more thing, however, came to my mind.

Thank you for response, one thing I would like only to highlight. If you go directly to the start of the code but behind the place where stack is initialized you have to process/reinitialize the stack (LDS).

If you want to find the original stack value then search for code LDS in the file start12.c.

Best regards,

Ladislav

0 项奖励
回复
3,034 次查看
1090097669
Contributor III

Hi Lama,

   Thank you for your Calling attention to that,However,Software restart function——_Startup() is before initializing the stack ,RAM and so on,so,I dont have to worry about the question.

    if I get error somewhere else,Please point it out,thank you.

0 项奖励
回复
3,035 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

1)

the code continues with the interrupt which has woken the MCU up and the it goes to the next code after the instruction asm STOP where you put the MCU to stop/pseudo stop mode.

2) If you want to return to main then just use main();

Of course, if you want to go to start of the code which uses also Startup function (CodeWarrior) you should:

a) define the function in the module you will call the Startup() from.

For example modue main.c will contain:

void _Startup(void);

b) Call the function at the place you require.

Do not forget that some register are write once only so they will not be changed by new write.

Please look  into attached example it solves something similar....

Best regards,

Ladislav

3,034 次查看
1090097669
Contributor III

Hi LAMA,

there is a question that after the chip sleeps(enter stop  Mode), power on again after a period of time (About 20s), it may automatically trigger a CAN wakeup interrupt, resulting in an incorrect process,How to avoid this phenomenon?

0 项奖励
回复
3,034 次查看
1090097669
Contributor III

Hi Lama,

   I have resoved the question alreadly,thank you very much!

0 项奖励
回复