Unable to obtain MC9S08QE128 STOP3 mode datasheet current usage

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

Unable to obtain MC9S08QE128 STOP3 mode datasheet current usage

2,779 Views
BrunoTh111
Contributor I
I have been trying to put the MC9S08QE128 into STOP3 mode, but it still have a current usage of 21uA (datasheet: 450nA). I can get it into STOP2 mode with a current usage of 0.4uA (datasheet:350nA). The current measurement is done by putting a current meter in between the powersupply (3.1V) and VDD,VDD,VDDAD pins.

The init function is created using Device Initialization (DI) in CodeWarrior.

As reference I have used Application Note (AN3460) Low-Power Design Enabled by MC9S08QE128 and MCF51QE128 Flexis Microcontrollers.

The chip configuration:

Clock: internal oscillator 31.25kHz with FLL in bypassed low power and RTC uses a 1kHz low power oscillator.
Clock Gating: RTC and IRQ enable, all other disable.
GPIO: All pins are outputs without pullup resistors and logic low. The input only pin (port A pin 1) is used as IRQ1 with internal pullup resistor, with an external connection to a switch on the demo board (DEMOEQ).
The chip package on the demoboard is only 64 pins, but I am using the 80 pins layout in DI, so I can config all I/O ports.
Beans: Most beans have been initialized as disabled in the DI, but some require an input to init in the DI util (SPI1,SPI2,IIC1,IIC2,ACMP1.ACMP2). Those beans have been manually disabled in main().

Program:
RTC generate an interrupt each 5sec and toggle output number 1.
IRQ generate an interrupt when the switch is pushed and toggle output number 1.
Each main loop run toggle output number 2.

During current measurement the status LEDs on output number 1 and 2 are disconnected.
The two outputs toggle at the same time, so the MCU is not executing any instructions in the main loop after the stop instruction.

After loading the software onto the MCU, I push the IRQ switch to start it, since the debug software looses its input pin and are unable to start the code execution.


Any suggestions to what might help cut the extra 20uA of the current usage?

Best regards
Bruno.

Code attached.

 

 

stop31.zip

Message Edited by t.dowe on 2009-10-27 01:28 PM
Labels (1)
0 Kudos
Reply
4 Replies

716 Views
Sam_1979
Contributor I
Hi,
 
   How do you execute the code, debugger control or just reset the part ?
  
  
0 Kudos
Reply

716 Views
BasePointer
Contributor II
Hi,
 
First enter stop1 mode (all modules automatically disabled and all pins are input) and check your hardware. If you measure about 100nA in this mode, try to switch STOP3 mode and then
 
- check you pin directions (no floating)
- close SPI
- close SCI
- close IIC
- close ADC
- close internal bandgap ref
- close rti
- close clock monitor
- close watchdog and internal 1Khz
- close timer1 and 2
 
that works for me.
 
Good lucks..
 
0 Kudos
Reply

716 Views
BrunoTh111
Contributor I
As far as I can see the S08QE128 dont have STOP1, only STOP2 and STOP3.

I can put it down in STOP2 when I change SPMSC2: PPDE=1 and PPDC=1. When RTC and IRQ are activated it only use about 0.4uA in STOP2.

But when I put it down in STOP3 the current increases dramatically to about 21uA.

> - check you pin directions (no floating)

They should all be output and logic low.

  /* Common initialization of the CPU registers */
  /* SCGC2: DBG=0,FLS=0,IRQ=1,KBI=0,ACMP=0,RTC=1,SPI2=0,SPI1=0 */
  SCGC2 = 0x24;                                     
  /* PTADD: PTADD5=0 */
  PTADD &= (unsigned char)~0x20;                    
  /* PTAPE: PTAPE5=1 */
  PTAPE |= (unsigned char)0x20;                              
  /* SCGC1: TPM3=0,TPM2=0,TPM1=0,ADC=0,IIC2=0,IIC1=0,SCI2=0,SCI1=0 */
  SCGC1 = 0x00;                                     
  /* PTASE: PTASE7=1,PTASE6=1,PTASE4=1,PTASE3=1,PTASE2=1,PTASE1=1,PTASE0=1 */
  PTASE |= (unsigned char)0xDF;                              
  /* PTBSE: PTBSE7=1,PTBSE6=1,PTBSE5=1,PTBSE4=1,PTBSE3=1,PTBSE2=1,PTBSE1=1,PTBSE0=1 */
  PTBSE = 0xFF;                                     
  /* PTCSE: PTCSE7=1,PTCSE6=1,PTCSE5=1,PTCSE4=1,PTCSE3=1,PTCSE2=1,PTCSE1=1,PTCSE0=1 */
  PTCSE = 0xFF;                                     
  /* PTDSE: PTDSE7=1,PTDSE6=1,PTDSE5=1,PTDSE4=1,PTDSE3=1,PTDSE2=1,PTDSE1=1,PTDSE0=1 */
  PTDSE = 0xFF;                                     
  /* PTESE: PTESE7=1,PTESE6=1,PTESE5=1,PTESE4=1,PTESE3=1,PTESE2=1,PTESE1=1,PTESE0=1 */
  PTESE = 0xFF;                                     
  /* PTFSE: PTFSE7=1,PTFSE6=1,PTFSE5=1,PTFSE4=1,PTFSE3=1,PTFSE2=1,PTFSE1=1,PTFSE0=1 */
  PTFSE = 0xFF;                                     
  /* PTGSE: PTGSE7=1,PTGSE6=1,PTGSE5=1,PTGSE4=1,PTGSE3=1,PTGSE2=1,PTGSE1=1,PTGSE0=1 */
  PTGSE = 0xFF;                                     
  /* PTHSE: PTHSE7=1,PTHSE6=1,PTHSE5=1,PTHSE4=1,PTHSE3=1,PTHSE2=1,PTHSE1=1,PTHSE0=1 */
  PTHSE = 0xFF;                                     
  /* PTJSE: PTJSE7=1,PTJSE6=1,PTJSE5=1,PTJSE4=1,PTJSE3=1,PTJSE2=1,PTJSE1=1,PTJSE0=1 */
  PTJSE = 0xFF;                                     
  /* PTADS: PTADS7=0,PTADS6=0,PTADS5=0,PTADS4=0,PTADS3=0,PTADS2=0,PTADS1=0,PTADS0=0 */
  PTADS = 0x00;                                     
  /* PTBDS: PTBDS7=0,PTBDS6=0,PTBDS5=0,PTBDS4=0,PTBDS3=0,PTBDS2=0,PTBDS1=0,PTBDS0=0 */
  PTBDS = 0x00;                                     
  /* PTCDS: PTCDS7=0,PTCDS6=0,PTCDS5=0,PTCDS4=0,PTCDS3=0,PTCDS2=0,PTCDS1=0,PTCDS0=0 */
  PTCDS = 0x00;                                     
  /* PTDDS: PTDDS7=0,PTDDS6=0,PTDDS5=0,PTDDS4=0,PTDDS3=0,PTDDS2=0,PTDDS1=0,PTDDS0=0 */
  PTDDS = 0x00;                                     
  /* PTEDS: PTEDS7=0,PTEDS6=0,PTEDS5=0,PTEDS4=0,PTEDS3=0,PTEDS2=0,PTEDS1=0,PTEDS0=0 */
  PTEDS = 0x00;                                     
  /* PTFDS: PTFDS7=0,PTFDS6=0,PTFDS5=0,PTFDS4=0,PTFDS3=0,PTFDS2=0,PTFDS1=0,PTFDS0=0 */
  PTFDS = 0x00;                                     
  /* PTGDS: PTGDS7=0,PTGDS6=0,PTGDS5=0,PTGDS4=0,PTGDS3=0,PTGDS2=0,PTGDS1=0,PTGDS0=0 */
  PTGDS = 0x00;                                     
  /* PTHDS: PTHDS7=0,PTHDS6=0,PTHDS5=0,PTHDS4=0,PTHDS3=0,PTHDS2=0,PTHDS1=0,PTHDS0=0 */
  PTHDS = 0x00;                                     
  /* PTJDS: PTJDS7=0,PTJDS6=0,PTJDS5=0,PTJDS4=0,PTJDS3=0,PTJDS2=0,PTJDS1=0,PTJDS0=0 */
  PTJDS = 0x00;                                     
  /* ### Init_GPIO init code */
  /* PTCD: PTCD7=0,PTCD6=0,PTCD5=0,PTCD4=0,PTCD3=0,PTCD2=0,PTCD1=0,PTCD0=0 */
  PTCD = 0x00;                                     
  /* PTCPE: PTCPE7=0,PTCPE6=0,PTCPE5=0,PTCPE4=0,PTCPE3=0,PTCPE2=0,PTCPE1=0,PTCPE0=0 */
  PTCPE = 0x00;                                     
  /* PTCDD: PTCDD7=1,PTCDD6=1,PTCDD5=1,PTCDD4=1,PTCDD3=1,PTCDD2=1,PTCDD1=1,PTCDD0=1 */
  PTCDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTBD: PTBD7=0,PTBD6=0,PTBD5=0,PTBD4=0,PTBD3=0,PTBD2=0,PTBD1=0,PTBD0=0 */
  PTBD = 0x00;                                     
  /* PTBPE: PTBPE7=0,PTBPE6=0,PTBPE5=0,PTBPE4=0,PTBPE3=0,PTBPE2=0,PTBPE1=0,PTBPE0=0 */
  PTBPE = 0x00;                                     
  /* PTBDD: PTBDD7=1,PTBDD6=1,PTBDD5=1,PTBDD4=1,PTBDD3=1,PTBDD2=1,PTBDD1=1,PTBDD0=1 */
  PTBDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTAD: PTAD7=0,PTAD6=0,PTAD4=0,PTAD3=0,PTAD2=0,PTAD1=0,PTAD0=0 */
  PTAD &= (unsigned char)~0xDF;                    
  /* PTAPE: PTAPE7=0,PTAPE6=0,PTAPE4=0,PTAPE3=0,PTAPE2=0,PTAPE1=0,PTAPE0=0 */
  PTAPE &= (unsigned char)~0xDF;                    
  /* PTADD: PTADD7=1,PTADD6=1,PTADD3=1,PTADD2=1,PTADD1=1,PTADD0=1 */
  PTADD |= (unsigned char)0xCF;                              
  /* ### Init_GPIO init code */
  /* PTDD: PTDD7=0,PTDD6=0,PTDD5=0,PTDD4=0,PTDD3=0,PTDD2=0,PTDD1=0,PTDD0=0 */
  PTDD = 0x00;                                     
  /* PTDPE: PTDPE7=0,PTDPE6=0,PTDPE5=0,PTDPE4=0,PTDPE3=0,PTDPE2=0,PTDPE1=0,PTDPE0=0 */
  PTDPE = 0x00;                                     
  /* PTDDD: PTDDD7=1,PTDDD6=1,PTDDD5=1,PTDDD4=1,PTDDD3=1,PTDDD2=1,PTDDD1=1,PTDDD0=1 */
  PTDDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTED: PTED7=0,PTED6=0,PTED5=0,PTED4=0,PTED3=0,PTED2=0,PTED1=0,PTED0=0 */
  PTED = 0x00;                                     
  /* PTEPE: PTEPE7=0,PTEPE6=0,PTEPE5=0,PTEPE4=0,PTEPE3=0,PTEPE2=0,PTEPE1=0,PTEPE0=0 */
  PTEPE = 0x00;                                     
  /* PTEDD: PTEDD7=1,PTEDD6=1,PTEDD5=1,PTEDD4=1,PTEDD3=1,PTEDD2=1,PTEDD1=1,PTEDD0=1 */
  PTEDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTFD: PTFD7=0,PTFD6=0,PTFD5=0,PTFD4=0,PTFD3=0,PTFD2=0,PTFD1=0,PTFD0=0 */
  PTFD = 0x00;                                     
  /* PTFPE: PTFPE7=0,PTFPE6=0,PTFPE5=0,PTFPE4=0,PTFPE3=0,PTFPE2=0,PTFPE1=0,PTFPE0=0 */
  PTFPE = 0x00;                                     
  /* PTFDD: PTFDD7=1,PTFDD6=1,PTFDD5=1,PTFDD4=1,PTFDD3=1,PTFDD2=1,PTFDD1=1,PTFDD0=1 */
  PTFDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTGD: PTGD7=0,PTGD6=0,PTGD5=0,PTGD4=0,PTGD3=0,PTGD2=0,PTGD1=0,PTGD0=0 */
  PTGD = 0x00;                                     
  /* PTGPE: PTGPE7=0,PTGPE6=0,PTGPE5=0,PTGPE4=0,PTGPE3=0,PTGPE2=0,PTGPE1=0,PTGPE0=0 */
  PTGPE = 0x00;                                     
  /* PTGDD: PTGDD7=1,PTGDD6=1,PTGDD5=1,PTGDD4=1,PTGDD3=1,PTGDD2=1,PTGDD1=1,PTGDD0=1 */
  PTGDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTHD: PTHD7=0,PTHD6=0,PTHD5=0,PTHD4=0,PTHD3=0,PTHD2=0,PTHD1=0,PTHD0=0 */
  PTHD = 0x00;                                     
  /* PTHPE: PTHPE7=0,PTHPE6=0,PTHPE5=0,PTHPE4=0,PTHPE3=0,PTHPE2=0,PTHPE1=0,PTHPE0=0 */
  PTHPE = 0x00;                                     
  /* PTHDD: PTHDD7=1,PTHDD6=1,PTHDD5=1,PTHDD4=1,PTHDD3=1,PTHDD2=1,PTHDD1=1,PTHDD0=1 */
  PTHDD = 0xFF;                                     
  /* ### Init_GPIO init code */
  /* PTJD: PTJD7=0,PTJD6=0,PTJD5=0,PTJD4=0,PTJD3=0,PTJD2=0,PTJD1=0,PTJD0=0 */
  PTJD = 0x00;                                     
  /* PTJPE: PTJPE7=0,PTJPE6=0,PTJPE5=0,PTJPE4=0,PTJPE3=0,PTJPE2=0,PTJPE1=0,PTJPE0=0 */
  PTJPE = 0x00;                                     
  /* PTJDD: PTJDD7=1,PTJDD6=1,PTJDD5=1,PTJDD4=1,PTJDD3=1,PTJDD2=1,PTJDD1=1,PTJDD0=1 */
  PTJDD = 0xFF;




Message Edited by BrunoTh111 on 2007-12-10 04:20 PM


Message Edited by BrunoTh111 on 2007-12-10 04:20 PM
0 Kudos
Reply

716 Views
BrunoTh111
Contributor I

> - close SPI

Closed in main before loop.

SPI2C1_SPE = 0;

> - close IIC

Closed in main before loop.

IIC1C1_IICEN = 0;

> - close ADC

  /* ### Init_ADC init code */
  /* ADCCFG: ADLPC=1,ADIV1=0,ADIV0=0,ADLSMP=0,MODE1=0,MODE0=0,ADICLK1=0,ADICLK0=1 */
  ADCCFG = 0x81;                                     
  /* ADCSC2: ADACT=0,ADTRG=0,ACFE=0,ACFGT=0 */
  ADCSC2 = 0x00;                                     
  /* ADCCV: ADCV11=0,ADCV10=0,ADCV9=0,ADCV8=0,ADCV7=0,ADCV6=0,ADCV5=0,ADCV4=0,ADCV3=0,ADCV2=0,ADCV1=0,ADCV0=0 */
  ADCCV = 0x00;                                     
  /* ADCSC1: COCO=0,AIEN=0,ADCO=0,ADCH4=1,ADCH3=1,ADCH2=1,ADCH1=1,ADCH0=1 */
  ADCSC1 = 0x1F;

> - close internal bandgap ref

Should be closed by bit 0 (BGBE) in SPMSC1.

  /* ### MC9S08QE128_80 "Cpu" init code ... */
  /*  PE initialization code after reset */
  /* Common initialization of the write once registers */
  /* SOPT1: COPE=0,COPT=1,STOPE=1,RSTOPE=0,BKGDPE=0,RSTPE=0 */
  SOPT1 = 0x60;                                     
  /* SOPT2: COPCLKS=0,SPI1PS=0,ACIC2=0,IIC1PS=0,ACIC1=0 */
  SOPT2 = 0x00;                                     
  /* SPMSC1: LVDF=0,LVDACK=0,LVDIE=0,LVDRE=1,LVDSE=0,LVDE=1,BGBE=0 */
  SPMSC1 = 0x14;                                     
  /* SPMSC2: LPR=0,LPRS=0,LPWUI=0,PPDF=0,PPDACK=0,PPDE=0,PPDC=0 */
  SPMSC2 = 0x00;                                     
  /* SPMSC3: LVDV=0,LVWV=0,LVWIE=0 */
  SPMSC3 &= (unsigned char)~0x38;                    
  /*  System clock initialization */
  /* ICSC1: CLKS=1,RDIV=0,IREFS=1,IRCLKEN=0,IREFSTEN=0 */
  ICSC1 = 0x44;                        /* Initialization of the ICS control register 1 */
  /* ICSC2: BDIV=3,RANGE=0,HGO=0,LP=1,EREFS=1,ERCLKEN=0,EREFSTEN=0 */
  ICSC2 = 0xCC;                        /* Initialization of the ICS control register 2 */

> - close rti

Do you mean the RTIE (Real-Time Interrupt Enable) in RTC?

It doesnt lower the current usage when RTC disabled.

  /* ### Init_RTC init code */
  /* RTCMOD: RTCMOD=4 */
  RTCMOD = 0x04;                                     
  /* RTCSC: RTIF=1,RTCLKS=0,RTIE=1,RTCPS=0x0F */
  RTCSC = 0x9F;

> - close clock monitor

Do you mean the clock gating?

I only enable RTC and IRQ beans.

  /* SCGC2: DBG=0,FLS=0,IRQ=1,KBI=0,ACMP=0,RTC=1,SPI2=0,SPI1=0 */
  SCGC2 = 0x24;                                     
  /* SCGC1: TPM3=0,TPM2=0,TPM1=0,ADC=0,IIC2=0,IIC1=0,SCI2=0,SCI1=0 */
  SCGC1 = 0x00;  

> - close watchdog and internal 1Khz

The watchdog (COP) is disabled by bit 7 (COPE) in SOPT1. But the low power 1kHz is used by the RTC, and when it can run in STOP2 with a current usage of 0.4uA so its not that.

  /* ### Init_COP init code */
  SRS = 0xFF;                          /* Clear WatchDog counter */
  /* SOPT1: COPE=0,COPT=1,STOPE=1,RSTOPE=0,BKGDPE=0,RSTPE=0 */
  SOPT1 = 0x60;                                     
  /* SOPT2: COPCLKS=0,SPI1PS=0,ACIC2=0,IIC1PS=0,ACIC1=0 */
  SOPT2 = 0x00;

> - close timer1 and 2

I think it got 3 timers (TPM1. TPM2, TPM3).

  /* ### Init_TPM init code */
  /* TPM3SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  TPM3SC = 0x00;                       /* Stop and reset counter */
  TPM3MOD = 0x00;                      /* Period value setting */
  (void)(TPM3SC == 0);                 /* Overflow int. flag clearing (first part) */
  /* TPM3SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  TPM3SC = 0x00;                       /* Int. flag clearing (2nd part) and timer control register setting */
  /* ### Init_TPM init code */
  /* TPM1SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  TPM1SC = 0x00;                       /* Stop and reset counter */
  TPM1MOD = 0x00;                      /* Period value setting */
  (void)(TPM1SC == 0);                 /* Overflow int. flag clearing (first part) */
  /* TPM1SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  TPM1SC = 0x00;                       /* Int. flag clearing (2nd part) and timer control register setting */
  /* ### Init_TPM init code */
  /* TPM2SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  TPM2SC = 0x00;                       /* Stop and reset counter */
  TPM2MOD = 0x00;                      /* Period value setting */
  (void)(TPM2SC == 0);                 /* Overflow int. flag clearing (first part) */
  /* TPM2SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  TPM2SC = 0x00;                       /* Int. flag clearing (2nd part) and timer control register setting */


The diagram... Its a demoboard from freescale called: DEMOQE with a MC9S08QE128 daughter card. All jumpers have been removed (not vcc)

As far as I can see, I have done all on your list. But thanks for the input.

Best regards,
Bruno

Did you know: Message cannot exceed 20000 characters... :smileywink:


Message Edited by BrunoTh111 on 2007-12-10 04:20 PM
0 Kudos
Reply