trouble with S12XS128  SCI controller

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

trouble with S12XS128  SCI controller

1,033 Views
SOS
Contributor I

Hi everybody,

 

i have a situation with DEMO9S12XSFAME SCI interface.i'm developing an uart driver based on interrupts.When Debuging the module i've realized that during interrupt execution  Flags ;either TDRE or RDRF are automatically reset by just getting the status register address .On the other hand when exiting the ISR the program fails and the debugger indicates   ILLEGAL BP.

 



#if(Du16DUart_eController1Used)
void __near vDUart_iSci1_Isr(void)
{
    volatile void     *pvReg;
    volatile void     *pvReg1;
    volatile void    *pvReg2;
    TstDUart_iScisr1RegBits      stTmp;
    
    pvReg = (void *)(Ctu16DUart_iCtlBaseAdr[Ceu16DUart_eCtl0]+ Du16DUart_iSciSr1ROffset);          //Get Status register 1 address   : ALL FLAGS ARE RESET !!!!!!!!!!!!!!!
    pvReg1 = (void *)(Ctu16DUart_iCtlBaseAdr[Ceu16DUart_eCtl1]+ Du16DUart_iScidrlROffset);              //Get data low register address
    pvReg2 = (void *)(Ctu16DUart_iCtlBaseAdr[Ceu16DUart_eCtl1]+ Du16DUart_iSciCr2ROffset);
    

 

if ( ((*((TstDUart_iScisr1RegBits *)pvReg)).bTDRE) > 0 )
    {
        treating and writing to SCIDRL;
    }
  

 if(((*((TstDUart_iScisr1RegBits *)pvReg)).bRDRF) > 0 )
    {
       treating  and reading SCIDRL;
    }

}

Labels (1)
0 Kudos
1 Reply

237 Views
SOS
Contributor I

Ok rigth if no one is answering i'm gonna tell you that for the second point "programm fails when exiting

 

the ISR" i've disassembled the source file and i've realized that ISR dosen't end with the famous RTI

 

 instruction cause i've forgot to put "__interrupt" at the begining when declaring the routine so as

 

Codewarrior could recognize it as an ISR. Now the problem i'm facing is that soft is unable to

 

 

resetTDREflag.Once TDRE is set the ISR is turning in loop.i've really followed the steps listed in

 

Datasheet which

 

are:  reading SCI Status register and then writing to SCI Data Low register so i wish that anyone

 

could tell me what to do.

0 Kudos