Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] problem on LPC2138 + SPI

2006-02-20 by Marko Pavlin (home)

There is no difference between read and write. Just make dummy write if 
you want read. Look at ADC datasheet when it sends data back? Clock is 
allways generated by master (LPC in your case). I am using simple SPI 
transfer function:

unsigned char spi0_transfer(unsigned long dat) {
  S0SPDR  = dat;                    // send data
  while (!(S0SPSR & 0x80)) ;         // wait for transfer completed
  return S0SPDR;
}

I am not using ISR for SPI. Can you send your ISR for SPI?

Marko


sebfr74 wrote:

> Hi,
> I try to read a 24 bits A/D converter from burr brown (ADS1252) with
> SPI interface. The converter send value in continue. There is data
> ready signal before the value on the data pin. I synchronize the read
> with an external interrupt (P0.15/EINT2 and MISO pin are connected
> together). The external interrupt runs well. But i don't understand
> how the SPI controler work :
> I initialize the controler, the VIC interrupt for the SPI0 (see the
> code below).
> - My first problem is I don't find in the user manual what start the
> SPI clock for a read. In other controler (ATMEL 89C51 for example, a
> 0x00 write to the data register start the clock).
> - The second one is I have 8 clock bit on the SCLK line just at the
> startup an d before my first external interrupt (the one noramlly who
> start the SPI read...). I don't understand why I have got these 8
> clock bits ? After these clock the SPI seems to be blocked...
>
> Thanks for your help,
> Sebastien
>
> //My initialisation code...
> VICVectCntl0 = 0x0000002A;
> VICVectAddr0 = (unsigned)SPI_ISR;
> VICIntEnable = 0x00000400;     
>
> PINSEL0 |= 0x00005500;           
> S0SPCCR      = 20;           
> S0SPCR  = 0x000000A0;     
>
>
>
>
>
>
> SPONSORED LINKS
> Microcontrollers 
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=mfaAujKZXA2Z_vxre9sGnQ> 
> 	Microprocessor 
> <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=9jjd2D3GOLIESVQssLmLsA> 
> 	Intel microprocessors 
> <http://groups.yahoo.com/gads?t=ms&k=Intel+microprocessors&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=OMnZuqMZX95mgutt4B-tDw> 
>
> Pic microcontrollers 
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=Malspbd0T4Rq3M4Q0nHrfw> 
>
>
>
> 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/>.
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.