Forum: ARM programming with GCC/GNU tools never ending interrupt?

Author: Greg (Guest)
Posted on:

Rate this post
0 useful
not useful

I have a problem with timer`s interrupt. I use Timer 1 to generate IRQ
interrupt. When ISR is done the next interrupt is generate and so on but
without any execution of others instructions (those outside of ISR). So
it seems to be never ending interrupt what is strange for me because I
clear the interrupt flag in ISR (see below).

void initVIC(void){
/*reset interrupts by writing a logic one to the corresponding IR bit*/
  T1IR = IR_MR0_INT;
/* Initialize VIC */
  VICIntSelect = ~(INT_TIMER1);  // Those interrupts selected as IRQ
  VICIntEnable = (INT_TIMER1);  // TIMER1 interrupt enabled

  VICVectCntl0 = SLOT_TIMER1;  // assign interrupt to slot 0

  VICVectAddr0 = (unsigned long)ISRtimer1;  // Address of the ISR

void initTIMER(void){
/* Initialize Timer1 */
  T1PR = 0x0;  //Prescaler Register - divide PCLK by (T1PR+1).
  T1MR0 = 2750;   //Match Register.
  T1MCR = 0x3;   //Match Control Register (interrupt & reset TC when
  T1TCR = 0x2;  //reset Timer Counter (I enable counter in main function
writing 0x1 to

this register)
      T1IR = 0x1;  //reset Timer0 interrupt

void ISRtimer1(void){
  uint16_t sample;
  T1IR = IR_MR0_INT; //clear interrupt flag


  if(PCMcount > 0){
    sample = (PCMbuf[PCMtail] + PCM_RANGE / 2) / (PCM_RANGE /
    DACR = ((sample << 6) | DAC_BIAS);

    if(PCMtail == PCMsize)
      PCMtail = 0;

    VICVectAddr = 0x00000000;  // clear this interrupt from the VIC
  ISR_EXIT();                     // recover registers and return

If it is important I set up the stack sizes in Crt0.S as follows:
// Stack Sizes

  .set  UND_STACK_SIZE, 0x00000004
        .set  ABT_STACK_SIZE, 0x00000004
        .set  FIQ_STACK_SIZE, 0x00000004
        .set  IRQ_STACK_SIZE, 0X00000100
        .set  SVC_STACK_SIZE, 0x00000004
        .set  USR_STACK_SIZE, 0x000006e0

and in linker script:
STACK_SIZE = 0x800;

I can`t understand it and I don`t know how to resolve this problem.
I use GCC 4.1.1 (WinARM) and LPC2138 uC.

Could someone help me to resolve this problem?
Thanks a lot.


Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
> void ISRtimer1(void){
>   uint16_t sample;
>   ISR_ENTRY();
>   T1IR = IR_MR0_INT; //clear interrupt flag

Since you are using the "Macro-approach" with ISR_ENTRY and ISR_EXIT:
Did you try to add the "naked" function-attribute to the ISRtimer1()
How are the exception-vectors configured?

Martin Thomas


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.