<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to put s08 Microcontroller in sleep mode(stop3) and wakeup it? in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1591053#M23640</link>
    <description>&lt;P&gt;Thanks a lot for your reply,&lt;/P&gt;&lt;P&gt;I set this register:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void _EntryPoint(void)
{
  setReg8(SOPT1, 0x20U);                
  setReg8(SOPT2, 0x00U);                
  setReg8(SPMSC1, 0x1CU);               
  setReg8(SPMSC2, 0x00U);               

  if (*(uint8_t*)0xFFAFU != 0xFFU) {   
    MCGTRM = *(uint8_t*)0xFFAFU;   
    MCGSC = *(uint8_t*)0xFFAEU;       
  }

  setReg8(MCGC2, 0x26U);          
  setReg8Bits(MCGC3, 0x10U);            
  setReg8(MCGC1, 0x9AU);          
  setReg8(MCGC3, 0x14U);            
  setReg8(MCGT, 0x00U);             
  while(MCGSC_OSCINIT == 0U) {      
  }
  while(MCGSC_IREFST != 0U) {        
  }
  while((MCGSC &amp;amp; 0x0CU) != 0x08U) {  
  }

  setReg8(MCGC2, 0x2EU);  
  setReg8(MCGC1, 0x92U); 

  clrReg8Bits(MCGC3, 0x10U);            
  setReg8(MCGC3, 0x44U);              
  while(MCGSC_PLLST == 0U) {       
  }

  clrReg8Bits(MCGC2, 0x08U);            
  while(MCGSC_LOCK == 0U) {        
  }
  setReg8(MCGC1, 0x12U);     
  while((MCGSC &amp;amp; 0x0CU) != 0x0CU) {  
  }
  
  __asm   jmp _Startup ;       
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the command "__asm stop;" in main(), has no effects.&amp;nbsp;The project file is attached.&amp;nbsp;&lt;BR /&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2023 12:50:57 GMT</pubDate>
    <dc:creator>mehdializadeh</dc:creator>
    <dc:date>2023-02-01T12:50:57Z</dc:date>
    <item>
      <title>How to put s08 Microcontroller in sleep mode(stop3) and wakeup it?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1590527#M23636</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;SPAN&gt;I am using mc9s08dz96 microcontroller with 8 MHz external clock osc. I have read&amp;nbsp;&lt;A href="https://www.nxp.com/docs/en/application-note/AN3387.pdf" target="_self"&gt;This document&lt;/A&gt;&amp;nbsp;and I have try to write a function, When the timer value reaches a certain value, the function is executed and I expect the microcontroller to go to stop3.&lt;BR /&gt;&lt;/SPAN&gt;First I try to set this register:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void stop3(){
	setReg8(SPMSC1, 0x14U);
	setReg8(SPMSC2, 0x00U); 
	setReg8(SOPT1, 0x23U);
	setReg8(MCGC1, 0x04U);
	setReg8(MCGC2, 0x26U);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;With this function, the power consumption did not decrease.&amp;nbsp;I tried to set the registers in more detail with the help of &lt;A href="https://www.nxp.com/docs/en/data-sheet/MC9S08DZ128.pdf" target="_self"&gt;datasheet&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void stop3(){       
    MCGC1_IRCLKEN = 1;
	SPMSC1_LVDSE = 1;
	SPMSC1_LVDE = 1;
	SOPT1_STOPE = 1;
	SPMSC2_PPDC = 0;
	SPMSC1_LVDRE = 1;
	SPMSC1_LVWACK = 1;
	SOPT1_STOPE = 1;
	MCGC1_IREFS = 1;
	MCGC2_ERCLKEN = 1;
	MCGC2_EREFS = 1;
	MCGC2_HGO = 1;
	MCGC2_RANGE = 1;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this code didn't work either. Does anyone have experience doing this?&lt;BR /&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 12:01:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1590527#M23636</guid>
      <dc:creator>mehdializadeh</dc:creator>
      <dc:date>2023-01-31T12:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to put s08 Microcontroller in sleep mode(stop3) and wakeup it?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1590830#M23638</link>
      <description>&lt;P&gt;To enter &lt;STRONG&gt;stop&lt;/STRONG&gt; mode(stop2,stop3),just use the following instruction:&lt;/P&gt;
&lt;P&gt;_asm stop;&lt;/P&gt;
&lt;P&gt;You can place these to instruction at wherever you want.&lt;/P&gt;
&lt;P&gt;The &lt;STRONG&gt;stop&lt;/STRONG&gt; mode configuration is determined by SOPT1:STOPE ,this bit should be enabled to enable &lt;STRONG&gt;stop&lt;/STRONG&gt; mode SPMSC2:PPDC,configure to enter stop2 or stop3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice:If you want to enter stop2,you should disable the LVD or you will enter stop3.After wake up from stop2,you shold clear the PPDF by write a one to PPDACK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 22:40:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1590830#M23638</guid>
      <dc:creator>vicentegomez</dc:creator>
      <dc:date>2023-01-31T22:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to put s08 Microcontroller in sleep mode(stop3) and wakeup it?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1591053#M23640</link>
      <description>&lt;P&gt;Thanks a lot for your reply,&lt;/P&gt;&lt;P&gt;I set this register:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void _EntryPoint(void)
{
  setReg8(SOPT1, 0x20U);                
  setReg8(SOPT2, 0x00U);                
  setReg8(SPMSC1, 0x1CU);               
  setReg8(SPMSC2, 0x00U);               

  if (*(uint8_t*)0xFFAFU != 0xFFU) {   
    MCGTRM = *(uint8_t*)0xFFAFU;   
    MCGSC = *(uint8_t*)0xFFAEU;       
  }

  setReg8(MCGC2, 0x26U);          
  setReg8Bits(MCGC3, 0x10U);            
  setReg8(MCGC1, 0x9AU);          
  setReg8(MCGC3, 0x14U);            
  setReg8(MCGT, 0x00U);             
  while(MCGSC_OSCINIT == 0U) {      
  }
  while(MCGSC_IREFST != 0U) {        
  }
  while((MCGSC &amp;amp; 0x0CU) != 0x08U) {  
  }

  setReg8(MCGC2, 0x2EU);  
  setReg8(MCGC1, 0x92U); 

  clrReg8Bits(MCGC3, 0x10U);            
  setReg8(MCGC3, 0x44U);              
  while(MCGSC_PLLST == 0U) {       
  }

  clrReg8Bits(MCGC2, 0x08U);            
  while(MCGSC_LOCK == 0U) {        
  }
  setReg8(MCGC1, 0x12U);     
  while((MCGSC &amp;amp; 0x0CU) != 0x0CU) {  
  }
  
  __asm   jmp _Startup ;       
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the command "__asm stop;" in main(), has no effects.&amp;nbsp;The project file is attached.&amp;nbsp;&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 12:50:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-put-s08-Microcontroller-in-sleep-mode-stop3-and-wakeup-it/m-p/1591053#M23640</guid>
      <dc:creator>mehdializadeh</dc:creator>
      <dc:date>2023-02-01T12:50:57Z</dc:date>
    </item>
  </channel>
</rss>

