2003-09-17 08:55 PM
2011-05-17 02:34 AM
I notice that, sometimes, my micro doesn't wake up from stop mode.
Here is my code: disable_interrupt(); // Set wake-up lines set_page_pointer(WU_PG); WU_WUTRL = 0x00; WU_WUTRH = 0x00; WU_WUPR &= (int)0x00; // clear all the pending bit WU_WUMRL = 0x00; WU_WUMRH = 0xF9; // set mask register WU_CTLR |= WUm_wuit; // set Wake Up interrupt lines set_page_pointer(EXINT_PG); EIPLR &= ~(EIm_ipd1m | EIm_ipd0m); // Priority level 0 EITR |= EIm_ted1m; EIMR &= ~EIm_id1m; // Mask INTD1 interrupt channel (safety) set_page_pointer(WU_PG); WU_CTLR |= WUm_id1s; // Select INTD1 interrupt as Wake Up // interrupt (not necessary) set_page_pointer(EXINT_PG); EIPR = 0x00; // clear all pending bit to be removed EIPR &= ~EIm_ipd1m; // ?????? //EIMR |= EIm_id1m; // do not enable WU interrupt ! set_page_pointer(WU_PG); WU_CTLR &= ~WUm_stop; set_page_pointer(RCCU_PG); CLK_FLAG &= ~Cm_xtstop; set_page_pointer(WU_PG); WU_CTLR |= WUm_stop; WU_CTLR &= ~WUm_stop; WU_CTLR |= WUm_stop; no_operation(); // .... Stop no_operation(); no_operation(); no_operation(); Sometimes wkae up lines don't let me exit from Stop Is there something wrong? Many thanks in advance!2011-05-17 02:34 AM
If ST9 didnot enter in stop mode it is necessary to reloop the procedure from the begining. To check wheathe ST9 has entered in stop mode or not check the status of STOP bit and RCCU EX_STP bit.
2011-05-17 02:34 AM
After further tests, I think I have a problem in clock stabilization.
In fact, sometimes, if I cause a wake up from one of the wakeup lines, the subsequent instructions are not ''well executed'' (for example port configuration... ). In other words it seems that stop mode is not exited in a clear way. A way for bypassing this problem seems to be the execution of a delay immediately after the exit from stop mode. Only after tha I redo the hardware inizialization (PLL configuration, port configuration and so on). WU_CTLR |= WUm_stop; WU_CTLR &= ~WUm_stop; WU_CTLR |= WUm_stop; no_operation(); // .... Stop no_operation(); no_operation(); no_operation(); // Exit from Stop for (j=0;j { // Wait for clock stabilization delay_us(DEL_100US_run); } hw_ini(); CanWakeUp(); CanOnline(); ...... But this is a patch..... Please, do you have idea which is the best way to resolve this issue? Any idea and suggestions is well accepted. Thanks again!2011-05-17 02:34 AM
I enter stop with no problems...
the problem is that I don't exit from that. May be I have to wait the clock stabilization? Many thanks2011-05-17 02:34 AM
Hi
First of all I would like to know how are you making sure that you entered in stop mode. Is it losing of PLL clock or ???. Because its recommended to test for whether you entered in stop mode by checking for EX_STP bit in CLK_FLG register immediately after your code for entering in stop mode. (Should be '1' if you correctly entered in stop mode) and should be reset by software. And may be the wakeup pending bits can also be reset by sw.And then after I don't think there is any need for delay introduction through sw because ST9 takes care of that. (Clock is started only after the delay needed for oscillator to restart.) And may be after that you might have to set CSU_CKSEL bit of CLK_FLG register if you want to keep on using PLL as clock source for your application because it gets reset when you wake up from stop mode.