trouble with S12XS128  SCI controller

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

trouble with S12XS128  SCI controller

1,080 次查看
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;
    }

}

标签 (1)
0 项奖励
1 回复

284 次查看
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 项奖励