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?
已解决! 转到解答。
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
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
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
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.
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
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?