MCF5213 Pulse accumulator interrupt problems

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

MCF5213 Pulse accumulator interrupt problems

895 Views
jrowland
Contributor I
Hello,
    I cam currently working on a MCF5213 coldfire microcontroller. I was wondering if anyone can link me an example code to set up a pulse accumulator interrupt for both over flow and event driven rising edge detection.

currently I have the following registers set at.

GPTSCR1 = 0x90;
GPTPACTL = 0x5B;

my handlers are defined as

mcf5xxx_set_handler(64+42, pulse_handler);
mcf5xxx_set_handler(64+43, overflow_handler);

then i set

mcf5xxx_irq_enable();

on my main function i have an infinite while loop that constantly reads the pulse accumulator counter. I have a line that outputs the pulse accumulator counter, the GPTPAFLG, and I also have two variables that are in the pulse_handler function ad the overflow_handler function that are set to a specific number if those functions are called. To test my code I set a high signal to the input and watch the output values. The counter seems to be working fine and so does the GPTPAFLG. Everytime I set a high signal  the PAIF flag gets set in the GPTPAFLG register. However what's not happenging is that the variables  for the pulse_handler or the overflow_handler are not being set. This tells me that an interrupt never happened. What I don't understand is why the PAIF flag gets set in the GPTPAFLG register and an interrrupt service request never gets called. Thank you all in advance fo any advice you can give me.


Labels (1)
0 Kudos
1 Reply

201 Views
jrowland
Contributor I
I figured out what the problem was. It turns out that i needed to enable the Interrupt mask register, more specifically IMRH. On boot up IMRH is set default to disable all registers it controlls. After setting the specific bits to "0" for the specific vector source I attempted to run in again but still had no response from the interrupt. So then i had to set the interrupt control registers for the specific iterrupts like this:

MCF_INTC_INCR42 | MCF_INTC_INCR_IL(0x04) | MCF_INTC_INCR_IP(0x00)
MCF_INTC_INCR43 | MCF_INTC_INCR_IL(0x04) | MCF_INTC_INCR_IP(0x08)

After setting these registers my interrupts started working fine. I was wondering if anyone could answer the following questions.
1) Is there a default setting written somewhere for the Interrupt control module?
2) Does the software not set the ICR when an interrupt is used?

Thanks in advance for any help provided.
0 Kudos