ben smida hamdi

trouble with S12XS128  SCI controller

Discussion created by ben smida hamdi on Apr 7, 2009
Latest reply on Apr 9, 2009 by ben smida hamdi

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.


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;