SPI slave ISR problem

OP #1171025
Rate this post
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;
   S0SPCR = SPI0_SPIE;

   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 */
 ISR_ENTRY();


 regValue = S0SPSR;
 spi_tmpcnt++;

 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
VIC
}

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now