Ameya Tipnis

SCI Interrupt issues on S12XDP512

Discussion created by Ameya Tipnis on Oct 8, 2010
Latest reply on Oct 11, 2010 by Ameya Tipnis

Hi Forum,

 

Problem: SCI transmission using interrupts, but TC / TDRE flags never clear, even after reading the Status register.

 

I am a new Freescale user (experienced Embedded developer), and I am trying to get a feel of the S12X processor, by configuring a simple serial communication with the PC. Before posting I read through the forum for almost the whole day today, some posts were pretty similar to my problem but I did not get an answer. Hence all help will be deeply appreciated.

 

I am using the Softec ZK-S12-B starter kit with a MC9S12XDP512 device and a Softec Indart-one BDM interface. For the moment I have just written code which has a timer interrupt and an SCI interrupt. I am using the SCI0 module to send some characters to the hyperterminal. Below is the SCI configuration and associated ISR.

 

    // Configure the SCI0 module
    SCI0BDH = 0x01;                // bus clock = 8 Mhz
    SCI0BDL = 0xA1;                // baud rate = 1200 baud
    SCI0CR2_TE = 1;            // enable transmitter
    SCI0CR2_TIE = 1;            // enable transmitter interrupt

    EnableInterrupts;

    for(;:smileywink:;

 

    #pragma CODE_SEG __NEAR_SEG NON_BANKED
    interrupt void SCI0_ISR(void)
    {

        temp = SCI0SR1;               /* read the status register */

        SCI0DRL = 0x42;               /* write some data */

    }

    #pragma CODE_SEG DEFAULT

 

    VECTOR ADDRESS 0xFFD6 SCI0_ISR                    // in the .prm file

 

But the problem is, even though I read the status register as suggested by the Datasheet, the TC / TDRE flags never clear and the written data is never seen neither in the Data register nor on the hyperterminal. Infact what happens is, since the flags are not cleared, the CPU keeps on looping in the SCI ISR all the time unless some other interrupt occurs.

 

I also tired removing the debugger, changing baud rates, changing board jumper settings, hyperterminal settings, and many more stuff. I am using extremely slow Baud rates to avoid any other unwanted errors too. But still I am never able to get that data written into the SCI data register and send it successfully.

 

Please do help me out of this situation. Eagerly waiting for assistance.

 

Ameya Tipnis.

Outcomes