AnsweredAssumed Answered

S08 Family -- Stop3 Mode change I/O pins state (Problem) 

Question asked by Marios Pelekis on Feb 3, 2016

Hi

I am using the MC9S08PA8 microcontroller from S08 Family.

I have already enable the Stop3 mode and works fine with an RTC (LPO~1KHz) every 1sec interrupt .

When RTC Interrupt occurred Stop3 mode stops and I toggle an I/O pin(Aseg Led) in order to watch the RTC timing.

After the Toggling of the Aseg Led  I execute the Stop3 instruction in order to stop the microcontroller again, so every 1sec the Aseg Led toggle its state.

All the above are working perfectly, BUT the Problem is that after 15sec(about) seems that the I/O pins change their state in a known state, different from their initialized state.

 

First, in the code i have set all I/O pins in an " known state " (Output Enable-Data Register=0).

 

Main LOOP:

void main(void) {

  DisableInterrupts;

  wdog_disable();

  ICS_FEI();

  Disp_Init();

  RTC_Init();

  KBI0P5_Init();

  asm stop;

  for(;;) {  }

}

------------------------------------------------------------------------------------------------------------------

CLOCK INIT:

void ICS_FEI(void)

{

  ICS_C1 = 0x04;   

  ICS_C2 = 0x20;   

  while(!ICS_S_LOCK);                 // wait clock to lock

  SYS_SOPT1_STOPE=1;

  PMC_SPMSC1_LVDE=0;

  SCG_C1=0x01;                          //RTC=1;

  SCG_C2=0x10;                          //NVM=1;

  SCG_C3=0x00;

  SCG_C4=0x00;                          //IRQ=0;

}

------------------------------------------------------------------------------------------------------------------

 

RTC INIT:

void RTC_Init(void){

  RTC_SC2=0x46;

  RTC_SC1=0x40;

  RTC_MOD=0x0001;

}

interrupt VectorNumber_Vrtc void  RTC_ISR(void)

{

  if(RTC_SC1_RTIF)RTC_SC1_RTIF = 1;

  Aseg^=1;                                       //LED Status

  asm stop;

}

------------------------------------------------------------------------------------------------------------------

Disp INIT:              //I/O Pins Initialize

void Disp_Init(void){

  Aseg_Init();

  Bseg_Init();

  Cseg_Init();

  Dseg_Init();

  Eseg_Init();

  Fseg_Init();

  Gseg_Init();

  ONEseg_Init();

  SUBseg_Init();

  DOseg_Init();

  UPseg_Init();

  TradeL_Init();

  ClrAllSeg();

}

void ClrAllSeg(void){

  Aseg=0;

  Bseg=0;

  Cseg=0;

  Dseg=0;

  Eseg=0;

  Fseg=0;

  Gseg=0;

  ONEseg=0;

  SUBseg=0;

  DOseg=0;

  UPseg=0;

  TradeL=0;

}

* everything is in this part is Defined in header file, for Example:

#define Aseg_Init()PORT_PTBOE_PTBOE6=1
#define AsegPORT_PTBD_PTBD6

------------------------------------------------------------------------------------------------------------------

Thanks in advance

     Pelekis Marios    

     Intelco Electronics

Original Attachment has been moved to: Stop3.rar

Outcomes