Forum: ARM programming with GCC/GNU tools SPI slave ISR problem

Author: V. B. (bray)
Posted on:

Rate this post
0 useful
not useful
I have problem with SPI slave...and i think it is GCC interrupt problem
because it works in Keil.  :(
SPI ISR fires only once (on first SSEL0 toggle to low) and then
stops...main loop is running ok.
Is something wrong with interrupts or ISR routine?

this is my SPI init...

unsigned long spi0Init(void)
   S0SPCR = 0x00;
   PINSEL0 &= 0xFFFF00FF;
   PINSEL0 |= 0x00005500;

   VICIntSelect &= ~VIC_BIT(VIC_SPI0);  // UART0 selected as IRQ
   VICIntEnable = VIC_BIT(VIC_SPI0);    // UART0 interrupt enabled
   VICVectCntl8 = VIC_ENABLE | VIC_SPI0;
   VICVectAddr8 = (uint32_t)spi0ISR;    // address of the ISR

   return (S0SPSR & 0x08);

..and ISR

void _attribute_ ((interrupt("IRQ"))) spi0ISR(void);

void spi0ISR(void)
 DWORD regValue;
 static unsigned char cnt=0;

 S0SPINT = 0x0000001;        /* clear interrupt flag */

 regValue = S0SPSR;

 spi_in[cnt] = S0SPDR;
 S0SPDR = spi_out[cnt];
 if (++cnt>SPI_BUFFER-1) cnt=0;

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


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.