> Same experience here. Tried to do the interrupt thing, now I
> just start the SPI transfer, do some other stuff and then
> poll until the transfer is ready. Is there anybody that has
> used the SPI interrupt successfully???
I use SPI interrupts for SPI transactions and haven't run into any
issues as yet.
Mind you it's on a lpc2124, not an lpc2138. My SPI module is part of the
lpc newlib extensions.
> Richard Duits.
>
>
> drb5599 wrote:
>
> > I believe you Gary. I had the same problem. I have been using the
> > MCB2130 (2138) and LPC2131 (my hardware). I finally gave up on the
> > SPI interrupt and now just use polling. Not very
> efficient, but in my
> > application it is acceptable.
> > Strange thing to me was the fact that it is just the SPI interrupt
> > that has caused problems. I have been able to configure
> and use every
> > other interrupt available, no problem.
> >
> > -Dave
> >
> >
> > --- In lpc2000@yahoogroups.com, "ee_gary" <ee_gary@y...> wrote:
> > >
> > > --- In lpc2000@yahoogroups.com, Sten <list@n...> wrote:
> > > >
> > > > ee_gary wrote:
> > > > > Long time lurker, first time poster...
> > > > >
> > > > > I've set the SPIE bit in the Control Register. I can see the
> > SPIF bit
> > > > > get set in the Status Register. However, I do NOT
> see the SPI
> > > > > Interrupt bit get set in the Interrupt Register. Shouldn't
> > this occur
> > > > > as soon as the SPIF bit is set, regardless of how the VIC is
> > set up?
> > > > > I have the VIC set up "correctly", but the ISR never executes
> > > > > (presumably because the SPI Interrupt never fires). I've had
> > > > > interrupts working correctly for UART0 and a timer, so I know
> > that
> > > > > interrupts can work (they just aren't in this occasion).
> > > > >
> > > > > I can do non-interrupt SPI transmits (i.e. the 1st byte of an
> > > > > interrupt-based multibye transfer) so I know the
> hardware is ok
> > (SSEL
> > > > > = 1). I've duplicated this on the MCB2130 and a LPC2214 dev
> > board.
> > > > >
> > > > > Any insight from those that have implemented interrupt based
> > SPI is
> > > > > appreciated.
> > > > >
> > > > > Stumped in Seattle...
> > > > >
> > > >
> > > > Please can you send a small portion of source code? It sounds
> > > unbelievable.
> > > >
> > > > Sten
> > > >
> > > > --
> > > > /************************************************
> > > > Do you need a tiny and efficient real time operating system
> > > > (RTOS) with a preemtive multitasking for LPC2000 or AT91SAM7?
> > > >
> > > > http://nanortos.net-attack.de/
> > > >
> > > > Or some open-source tools and code for LPC2000?
> > > >
> > > > http://www.net-attack.de/
> > > >
> > > > ************************************************/
> > > >
> > >
> > > It'd be my pleasure. Here's the init function:
> > > void spi0Init(void)
> > > {
> > > // Set port pins for SPI0
> > > PINSEL0 = (PINSEL0 & ~S0_PINMASK) | S0_PINSEL;
> > >
> > > // Set SPI Registers
> > > S0SPCR = 0; // Clear all bits
> > > S0SPCR |= SPCR_CPHA; // Data sampled on rising edge
> > > S0SPCR |= SPCR_CPOL; // SCK active low
> > > S0SPCR |= SPCR_MSTR; // Master mode
> > >
> > > S0SPSR; // Cleared by a read of this register
> > > S0SPDR; // Cleared by a read of this register
> > > S0SPCCR = 128; // 8 is max speed
> > > S0SPINT = 1; // Cleared by writing a 1 to it
> > >
> > > // initialize the interrupt vector
> > > VICIntSelect = 0; // Select IRQ
> > > VICIntEnable = 0x00000400;
> > > VICVectAddr0 = (unsigned long)spi0ISR;
> > > VICVectCntl0 = 0x0000002A;
> > >
> >
> > > // initialize the transmit data queue
> > > spi0_tx_extract_idx = spi0_tx_insert_idx = 0;
> > > spi0_tx_running = 0;
> > > }
> > >
> > > and the transmit function:
> > > int spi0Putch(int ch)
> > > {
> > > uint16_t temp;
> > > unsigned cpsr;
> > >
> > > temp = (spi0_tx_insert_idx + 1) % SPI0_TX_BUFFER_SIZE;
> > >
> > > if (temp == spi0_tx_extract_idx)
> > > return -1; // no room
> > >
> > > cpsr = disableIRQ(); // disable global
> interrupts
> > > S0SPCR &= ~SPCR_SPIE; // disable TX interrupts
> > > restoreIRQ(cpsr); // restore global
> interrupts
> > >
> > > // check if in process of sending data
> > > if (spi0_tx_running){
> > > // add to queue
> > > spi0_tx_buffer[spi0_tx_insert_idx] = (uint8_t)ch;
> > > spi0_tx_insert_idx = temp;
> > > }
> > > else{
> > > // set running flag and write to output register
> > > spi0_tx_running = 1;
> > > S0SPDR = (uint8_t)ch;
> > > }
> > > cpsr = disableIRQ(); // disable global
> interrupts
> > > S0SPCR |= SPCR_SPIE; // enable TX interrupts
> > > restoreIRQ(cpsr); // restore global
> interrupts
> > >
> > > return (uint8_t)ch;
> > > }
> > >
> > > and finally, the ISR that never fires...
> > > void spi0ISR(void)
> > > {
> > > // perform proper ISR entry so thumb-interwork works properly
> > > ISR_ENTRY();
> > >
> > > // check if more data to send
> > > if (spi0_tx_insert_idx != spi0_tx_extract_idx){
> > > S0SPDR = spi0_tx_buffer[spi0_tx_extract_idx++];
> > > spi0_tx_extract_idx %= SPI0_TX_BUFFER_SIZE;
> > > }
> > > else{ // No more to transmit
> > > S0SPCR &= ~SPCR_SPIE;
> > > spi0_tx_running = 0;
> > > }
> > >
> > > S0SPINT = 1;
> > > VICVectAddr = 0x00000000;
> > >
> > > ISR_EXIT();
> > > }
> > >
> > > It seems like it should be something simple. Everything
> looks okay,
> > > but the ISR never fires.
> > >
> > > Thanks,
> > >
> > > Gary
> > >
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Microprocessor
> >
> <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Micropr
ocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051>
+microprocessor&c=4&s=93&.sig=tsVC-J9hJ5qyXg0WPR0l6g>
> > Microcontrollers
> >
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Micro
processor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051>
+microprocessor&c=4&s=93&.sig=DvJVNqC_pqRTm8Xq01nxwg>
> > Pic microcontrollers
> >
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microproc
> >
> essor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocess
> > or&c=4&s=93&.sig=TpkoX4KofDJ7c6LyBvUqVQ>
> >
> > 8051 microprocessor
> >
> <http://groups.yahoo.com/gads?t=ms&k=8051+microprocessor&w1=Microproce
> >
> ssor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocesso
> > r&c=4&s=93&.sig=1Ipf1Fjfbd_HVIlekkDP-A>
> >
> >
> >
> >
> ----------------------------------------------------------------------
> > --
> > YAHOO! GROUPS LINKS
> >
> > * Visit your group "lpc2000
> > <http://groups.yahoo.com/group/lpc2000>" on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > lpc2000-unsubscribe@yahoogroups.com
> >
> <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >
> ----------------------------------------------------------------------
> > --
> >
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~--> Get Bzzzy! (real tools to help you
> find a job). Welcome to the Sweet Life.
> http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/dN_tlB/TM
> --------------------------------------------------------------
> ------~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>Message
RE: [lpc2000] Re: SPI Interrupt not firing?
2005-10-13 by Bruce Paterson
Attachments
- No local attachments were found for this message.