AnsweredAssumed Answered

PTA4 always ON

Question asked by Corominas Marc on Jun 4, 2013
Latest reply on Jun 6, 2013 by Corominas Marc


Dear all,

 

I'm using a S9S08QD4 and developing the code with codewarrior. I have abig problem with PTA4, it's alway ON.

 

Following this thread (https://community.freescale.com/thread/306908) about PTA4 and PTA5. Solved with bigmac contrbution, now I'm using a BSS131 to drive my relay. But now I'm facing a "problem" with PTA4, I can program and debug the code, but when I set the BKGPE to zero and start the normal operation the PTA4 goes HIGH and stays there. this is my init code for periphericals:

 

void periphInit (void){


              asm SEI;        //disable interrupt mask
              //I/O
             
              PTASE=0x00;     // No slew rate
              PTADS=0x00;     // no DS
              PTAPE=0x00;     // No pull-up
            
              PTAD=0x00;      // Sortides a 0
              PTADD=0x11;                  
                         
              //RTI
             
              SRTISC=0x10;       //1kHz OSC intern amb time-out 1seg.
             
              // MTIM ( Base de Temps : 1,008ms)
             
              /* TPMSC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
              TPMSC = 0x00;                        /* Stop and reset counter */
              TPMMOD = 0x3E;                       /* Period value setting */
              (void)(TPMSC == 0);                  /* Overflow int. flag clearing (first part) */
            
             
             
              SOPT1 = 0x92;         //0x92 BKG 0X90 No BKG
              SOPT2 = 0x00;
             
              SPMSC1 = 0x00;
              SPMSC2 = 0x00;                                     
             
              /*  System clock initialization */
             
              ICSTRM = *(unsigned char*far)0xFFAF; /* Initialize ICSTRM register from a non volatile memory */
              ICSSC = *(unsigned char*far)0xFFAE;  /* Initialize ICSSC register from a non volatile memory */
             
             
              /* Initialization of the ICS control register 1 */
              /* Initialization of the ICS control register 2 */
              ICSC1 = 0x06;                        /* ICSC1: CLKS=0,IREFSTEN=0 */
              ICSC2 = 0x00;                        /* ICSC2: BDIV=1,LP=0 */
             
              asm CLI;  //interrupt on and return
            
              clrWD();
             

}

 

 

Just after power ON the system PTA4 goes HIGH and the relays switches ON and if I force it to goes LOW it stays HIGH, and I don't see why, What I'm making wrong? Any hint?

 

Br.

 

Marc

Outcomes