S12X Real Time Interrupt

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

S12X Real Time Interrupt

2,609 Views
khumphri
NXP Employee
NXP Employee

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.

 

Posted: Mon Dec 12, 2005  10:44 pm

 

I am having some problem enabling the S12X Real time interrupt. My code below cut down to basics to see what is up.

 

Can someone point me to the error? It seems to me that I am missing a register setting somewhere however much reading I did to locate same.

 

Symptom:

INT_CFDATA0 ($128) sets to one but RTI does not interrupt as shown in my debug

 

0127 F0

0128 01

0129 01

012A 00

012B 00

012C 00

012D 00

012E 00

012F 00

 

Thanks for any feed back..

 

RTIInit

movb #%01110000,RTICTL ;Initialize RTI rate

movb #%10000000,CRGINT ;enable interrupt

 

movb #$F0,INT_CFADDR ;Place RTI -> Power on RESET into window

movb #%00000001,INT_CFDATA0 ;Set RTI to level 1 priority

rts

 

RTIISR

movb #RTIF,CRGFLG

com PTP ;toggle LED to diagnose problem

rti

 

;IVBR + $F0

VECTOR07 dc.w RTIISR ;Real Time Interrupt

VECTOR06 dc.w ResetFunc ;IRQ

VECTOR05 dc.w ResetFunc ;XIRQ

VECTOR04 dc.w ResetFunc ;SWI

VECTOR03 dc.w ResetFunc ;Instruction Trap

VECTOR02 dc.w ResetFunc ;COP failure

VECTOR01 dc.w ResetFunc ;Clock Monitor

VECTOR00 dc.w ResetFunc ;Power On RESET

 


 

Posted: Mon Dec 12, 2005  11:50 pm

 

Do you do a "CLI" after calling the "RTIInit" function to clear the I-Bit in the status register to enable interrupts??

 


 

Posted: Tue Dec 13, 2005  12:59 am

 

> Do you do a "CLI" after calling the "RTIInit" function to clear the I-Bit in the status

> register to enable interrupts??

 

Yes I did. The "CLI" and "DDRP" are setup somewhere else before going into a main loop spinning wheels.

 

A side note. I got the SCI0 interrupt working on S12X but the RTI is stubbornly refusing to be enabled so I figure something must be silly with my code, else lack of info in the docs to be found.

 


 

Posted: Thu Dec 15, 2005  8:53 pm

 

> stubbornly refusing to be enabled so I figure something must be silly

> with my code, else lack of info in the docs to be found.

 

An update. Got the RTI, SCI0 and OC6 working now. My experience on this is Lack of info on how to scheme the various interrupts together made difficult how to understand/implement to this new hardware.

 


 

Posted: Fri Dec 16, 2005  8:38 pm

 

> An update. Got the RTI, SCI0 and OC6 working now. My experience on

> this is Lack of info on how to scheme the various interrupts together

> made difficult how to understand/implement to this new hardware.

 

What does that mean--could you be more specific as to what you were doing wrong?

 


 

Posted: Sat Dec 17, 2005  12:23 am

 

 

> After much head scratching and debugging, just for the fun of it, I

> decided to change priority level SC1O to level 3, RTI to level 4, and

> OC6 to level 2. Voila! it works. I do not yet fully comprehend why,

> to me an interrupt is an interrupt regardless of priority. The

> document MC9S12XDP512_V2.pdf is hinting at even if an interrupt

> happens to occur, it maynot be serviced at all. Perhaps I ran across

> that smack in the face.

 

The problem arises that when you are servicing an interrupt others can occur, so when you return from the current interupts you have to decide which one to service next, hence priority.

 

If your interrupts service routine is too time consuming there could be interrupts that never get done.

 

I decided to drop incoming communication if busy, works usually, except when it result in a retransmission of the incoming string, such as a S1S9, it gets busy very quickly:-)

 

Cheers,

 


 

Posted: Sat Dec 17, 2005  1:45 am

 

> If your interrupts service routine is too time consuming there could be interrupts that

> never get done.

 

Not too extensive, Real Time Interrupts every 16ms, OC6 at 10Khz, SCI0 just parsing a single letter command then set a flag to process later. When I set Priority level 1 to all, none of the ISR are serviced. All ISR are around 5 assembly line of codes.

 

Right now I am just getting to know the MCUs quirks.

Labels (1)
0 Kudos
0 Replies