EmbDev.net

Forum: ARM programming with GCC/GNU tools AT91SAM7X256 - interrupts doesn't work?


Author: Tomasz Klonowski (klombi)
Posted on:

Rate this post
0 useful
not useful
Hi.
I configure interrupts:
  AT91C_BASE_AIC->AIC_IDCR = 0x1 << AT91C_ID_PIOB;
  AT91C_BASE_AIC->AIC_SVR[AT91C_ID_PIOB] = (unsigned long) pio_handler ;
  AT91C_BASE_AIC->AIC_SMR[AT91C_ID_PIOB] =
AT91C_AIC_SRCTYPE_POSITIVE_EDGE|1;
                                          //src_type | priority
  AT91C_BASE_AIC->AIC_ICCR = 0x1 << AT91C_ID_PIOB;
Enable it:
  AT91C_BASE_PIOB->PIO_IER = AT91C_PIO_PB28;
  AT91C_BASE_AIC->AIC_IECR = 0x1 << AT91C_ID_PIOB;

My handler:
  __ramfunc void pio_handler(void)
  {
  AT91F_PIO_SetOutput(AT91C_BASE_PIOA,LED);
  AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);
  return;
  }
I can see, that handler is in RAM (in .map file):
  (...)
.data           0x00200000       0xcc load address 0x00101610
                0x00200000                _data = .
 *(.vectram)
 .vectram       0x00200000       0x58 startup_SAM7X.o
 *(.data)
 .data          0x00200058        0x0 startup_SAM7X.o
 .data          0x00200058        0x0 projekt.o
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_udivsi3 
.o)
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_divsi3. 
o)
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_umodsi3 
.o)
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_dvmd_tl 
s.o)
                0x00200058                . = ALIGN (0x4)
 *(.fastrun)
 .fastrun       0x00200058       0x74 projekt.o
                0x00200058                timer0_c_irq_handler
                0x0020006c                pio_handler
                0x0020009c                sys_handler
                0x00200084                fiq_handler
                0x002000b4                irq_handler
                0x002000cc                . = ALIGN (0x4)
                0x002000cc                _edata = .
                0x002000cc                PROVIDE (edata, .)
  (...)

...but it doesn't work properly.
It seems that ARM reacts for interrupt (the programm stops), but it
doesn't call my handler routine. Led turned on in main programm is not
turned off in handler.
Any idea why it doesn't work??

Author: Tomasz Klonowski (klombi)
Posted on:

Rate this post
0 useful
not useful
Tomasz Klonowski wrote:
> Hi.
> (...)


It is working now .. ISRs should be compiled in ARM-mode :)

Author: Duy-ky Nguyen (duykyng)
Posted on:

Rate this post
0 useful
not useful
Remember interrupt works ONLY for ARM mode, so do not thumb mode at all.
It may help

Reply

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.