I need your help. plz. about interrupt.

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

I need your help. plz. about interrupt.

3,323 Views
Jeremy
Contributor I
Hello.
 
I'm graduated student in korea.
 
I need your help strongly!! for using coldfire interrupt handling especially in M52233DEMO board.
 
We're studying how to handle the coldfire interrupt in M52233DEMO board for our class.
 
So, I tried to find something to which I refer, but I didn't find any information about that.
 
Anybody, could you help me?
 
If anybody have any example for interrupt handling with M52233DEMO board, it will be very useful to me.
 
Please.. Help me..
 
 
regards.
 
Labels (1)
0 Kudos
3 Replies

375 Views
mjbcswitzerland
Specialist V
Hi

Here is one example which may help.

1. Configure a peripheral to use an interrupt.
Here is a routine to set up the PIT timer 0 and enable its interrupt.

extern void fnStartTick(void)
{
PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD); // prepare for load
PIT_PMR_0 = TICK_DIVIDE; // load interval value

IC_ICR_0_55 = (INTERRUPT_LEVEL_4 | INTERRUPT_PRIORITY_0); // define interrupts level and priority
IC_IMRH_0 &= ~(PIT_0_PIF_INT_H | MASK_ALL_INT); // unmask interrupt source

PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD | PIT_PIE | PIT_EN); // start PIT with interrupt enabled
}

Notes: Each interrupt has an ICR where its level and priority is defined. Here they are 4 and 0 respectively. Then the interrupt source is unmasked (in IMRH). Finally the interrupt in the peripheral is enabled (how it is performed depends on the peripheral). You will need to read the users' manual (interrupt section and corresponding peripheral section). [Note that the user is responsible for avoiding more that one source using particular level/priority setting.]


2. The interrupt vector table must include the interrupt service routine.

Here is a small extract from the interrupt vector table (MCF52235_vectors.s) where the handling routine has been set. The PIT 0 uses vector77 (see the users' manual to see which vectors are used by which interrupt)


vector74: .long _irq_handler
vector75: .long _irq_handler
vector76: .long _irq_handler
vector77: .long _RealTimeInterrupt /* TICK timer interrupt */
vector78: .long _irq_handler
vector79: .long _irq_handler
vector7A: .long _irq_handler

3. Finally the interrupt routine must be programmed. It is called when the interrupt occurs and must usually also reset the interrupt so that it only enters once per interrupt. In the following example the first line resets the interrupt flag.

/**************************** Real Time Clock interrupt ******************************************/

__interrupt__ void RealTimeInterrupt(void)
{
PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD | PIT_PIE | PIT_EN); // Reset interrupt request flag
fnRtmkSystemTick(); // operating system tick
}


As a student you qualify for free use of the uTasker operating system and integrated TCP/IP stack. Go to www.uTasker.com and request an educational license and you can receive complete project code. The project runs on your M52233DEMO (you can also load the binary to test it immediately from http://www.utasker.com/software/software.html ). There is a tutorial at http://www.utasker.com/docs/M5223X/uTaskerV1.2-Tutorial-M5223X.PDF with step-by-step instruction sfor the CodeWarrior and your board.

To see what it does, visit an on-line demo here http://212.254.22.36 and see it via web cam at http://212.254.22.36:8080. You can Telnet it, control things via Browser, receive Emails from it etc...

Regards

Mark

www.mjbc.ch / www.uTasker.com
0 Kudos

375 Views
ak_mnpp
Contributor I
Hello! I have a M52233DEMO with a NicheTask. I can't understand how to handle interrupts in the operating system running the tasks. Can somebody explain to me?
0 Kudos

375 Views
J2MEJediMaster
Specialist I
Go the Freescsl web page for the MCF52233, located here. Scroll down and you'll find an archive named Coldfire_TCIPI_Lite provided by InterNiche. The source contains some information on interrupt vectors that may be of use to you. Also, if you use the Codewarrior development tools, there are some example programs provided with them.

HTH,

---Tom
0 Kudos