SPI slave ISR problem

OP #1171025
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

A question of your own? This thread is over 20 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.