EmbeddedRelated.com
Forums

SCI Rx Interrupt Only Works Once On S12DP256

Started by jmey...@emittechnologies.com November 14, 2008
I'm working on a Dragon12-P board from evbplus.com containing the mc9s12dp256 and using CW 5.9.0 for a compiler. I'm a beginner, too. :)

I've got a C program that collects data from about 10 inputs, concats the data into a single string, and transmits the data upon receiving anything on SCI1. Eventually, I want to send specified data based on different string inputs.

I am using Receiver Interrupt Enable(RIE) for my interrupt, and it works but just once. I've done several things to figure out it out, and I know for sure it will not interrupt at all after it interrupts the first time. Here is my ISR:

__interrupt void SCI1_isr(void) {

//clearing
c = SCI1SR1;
c = SCI1DRL;

SCI1_OutString(message);

engineData();
}

Reading SR1 and DR clears the RDRF flag right? Why can't I continue to use this interrupt after only using it one time?

Thanks in advance!
It could be something like old DP256 maskset errata MUCts00510:

The SCI interrupt is only asserted if an odd number of interrupts are
enabled and set.

For example, if a transmit data register empty and a receive ready
interrupt are active at the same time, the CPU interrupt request is not
asserted. This can lead to missing interrupts or spurious interrupts where
the request gets deasserted before the CPU fetches the interrupt vector.
These spurious interrupts will be handled by direction via the SWI interrupt
vector.

Edward
----- Original Message -----
From:
To: <6...>
Sent: Saturday, November 15, 2008 00:58
Subject: [68HC12] SCI Rx Interrupt Only Works Once On S12DP256
> I'm working on a Dragon12-P board from evbplus.com containing the
> mc9s12dp256 and using CW 5.9.0 for a compiler. I'm a beginner, too. :)
>
> I've got a C program that collects data from about 10 inputs, concats the
> data into a single string, and transmits the data upon receiving anything
> on SCI1. Eventually, I want to send specified data based on different
> string inputs.
>
> I am using Receiver Interrupt Enable(RIE) for my interrupt, and it works
> but just once. I've done several things to figure out it out, and I know
> for sure it will not interrupt at all after it interrupts the first time.
> Here is my ISR:
>
> __interrupt void SCI1_isr(void) {
>
> //clearing
> c = SCI1SR1;
> c = SCI1DRL;
>
> SCI1_OutString(message);
>
> engineData();
> }
>
> Reading SR1 and DR clears the RDRF flag right? Why can't I continue to use
> this interrupt after only using it one time?
>
> Thanks in advance!
>
Hey man,
Actually, I don't think reading them resets the flag...

I dont' have time to look at it right now, but I know that the RTI at least
has a flag that you have to manually reset in your code at the end of the
interrupt. I would look into possibly needing to manually reset some flag
as that seems to be the most likely cause for your interrupt to only ever
fire once.

On Fri, Nov 14, 2008 at 2:58 PM, wrote:

> I'm working on a Dragon12-P board from evbplus.com containing the
> mc9s12dp256 and using CW 5.9.0 for a compiler. I'm a beginner, too. :)
>
> I've got a C program that collects data from about 10 inputs, concats the
> data into a single string, and transmits the data upon receiving anything on
> SCI1. Eventually, I want to send specified data based on different string
> inputs.
>
> I am using Receiver Interrupt Enable(RIE) for my interrupt, and it works
> but just once. I've done several things to figure out it out, and I know for
> sure it will not interrupt at all after it interrupts the first time. Here
> is my ISR:
>
> __interrupt void SCI1_isr(void) {
>
> //clearing
> c = SCI1SR1;
> c = SCI1DRL;
>
> SCI1_OutString(message);
>
> engineData();
> }
>
> Reading SR1 and DR clears the RDRF flag right? Why can't I continue to use
> this interrupt after only using it one time?
>
> Thanks in advance!
>
>
>

It does sound like a flag not being cleared. I'll do some debugging. It should clear with the following:

//clearing
c = SCI1SR1;
c = SCI1DRL;

I'm still fighting it. Any other experience or suggestions are welcome!

Also, I check my part ID. It was $0033 which indicates my mask set number is 0L01Y. This set doesn't fall into the errata problem.
>Hey man,
>Actually, I don't think reading them resets the flag...

>I dont' have time to look at it right now, but I know that the RTI at least
>has a flag that you have to manually reset in your code at the end of the
>interrupt. I would look into possibly needing to manually reset some flag
>as that seems to be the most likely cause for your interrupt to only ever
>fire once.

I checked the PARTID and it came out $33 which means I have the 0L01Y mask set. It shouldn't have any errata.

It does sound like there is a flag not being cleared. I'll do some more debugging. I've been clearing it as follows:

> //clearing
> c = SCI1SR1;
> c = SCI1DRL;

I'm still having problems, so any advice or experience is welcome! :)

Try to clear it like this...Worked for me....

c = SCI1DRL; SCI1SR1 = SCI1SR1 & 0xDF;


I'm watching SC1SR1 on my LEDs. The RDRF flag is clearing just fine.

After it does the job in the ISR, the IDLE flag goes on in SC1SR1. When the IDLE flag goes on, it's not going to the ISR anymore at all. I don't know why it would be receiving 10 consecutive logic 1's at the receiver! I'm digging around right now trying to figure out why this is happening or how to clear the IDLE flag.

Any ideas?
I got IDLE to clear, but it still just refuses to enter my ISR after the first time.

The SC1SR1 only has the TDRE and TC flags on before and after the interrupt.

> -----Original Message-----
> From: 6... [mailto:6...]
> On Behalf Of j...@emittechnologies.com
> Sent: Monday, November 17, 2008 7:13 PM
> To: 6...
> Subject: [68HC12] Re: SCI Rx Interrupt Only Works Once On S12DP256
>
> I got IDLE to clear, but it still just refuses to enter my
> ISR after the first time.
>
> The SC1SR1 only has the TDRE and TC flags on before and after
> the interrupt.
>

Just to check, will the problem remain if you comment out the other function
calls in the isr?

Regards,
Anders

>
Ummmm...I still don't have time to work on this...
But at the risk of being worse than useless...

You could try manually setting the flag? Throw in a ...

RDRF=0xFF; and see how that works?
On Fri, Nov 14, 2008 at 2:58 PM, wrote:

> I'm working on a Dragon12-P board from evbplus.com containing the
> mc9s12dp256 and using CW 5.9.0 for a compiler. I'm a beginner, too. :)
>
> I've got a C program that collects data from about 10 inputs, concats the
> data into a single string, and transmits the data upon receiving anything on
> SCI1. Eventually, I want to send specified data based on different string
> inputs.
>
> I am using Receiver Interrupt Enable(RIE) for my interrupt, and it works
> but just once. I've done several things to figure out it out, and I know for
> sure it will not interrupt at all after it interrupts the first time. Here
> is my ISR:
>
> __interrupt void SCI1_isr(void) {
>
> //clearing
> c = SCI1SR1;
> c = SCI1DRL;
>
> SCI1_OutString(message);
>
> engineData();
> }
>
> Reading SR1 and DR clears the RDRF flag right? Why can't I continue to use
> this interrupt after only using it one time?
>
> Thanks in advance!
>
>
>