Yahoo Groups archive

Lpc2000

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

Message

Re: spi in lpc2106

2005-04-08 by aumat123

Hello
I have the same problem a days ago.
You need:
 -Apply 3v3 to pin SSEL0 (SSEL1)
 - In the pin Connect block put this pin as connected to SPI
 - Use another pin as CS

Regards

--- In lpc2000@yahoogroups.com, "Jeetendra Singh" <jeet77_7@y...> 
wrote:
> 
> Hi friends
> 
> i am working in Lpc2106 and facing problem in spi mdule.
> Actualy  i am using spi module in master mode. i checked my code in 
> jtag debugger(wiggler in CrossStudio)and found that when writing 
data 
> to the SPDR register then SPif bit in SPSR also sets showing that 
> data is transmitted. 
>     
> But the problem is that nither data nor clocks in the MOSI & SCK 
pins.
> 
> 
> If some body can help me i will be very thank ful to him.
> 
> jeetendra  
> 
> My source code attached
> int main (void){
> 
> 
>       IOSET=0x80;  
>       IODIR=0x00;
> 
>       PINSEL0 = 0x00005500; 
>                 
> //Config over 
>         init_spi();
>                 
>         IOSET = MMC_CS; // Chip select High
>         MmCardSendByte(0xAA);
>         IOCLR = MMC_CS; // Chip select Low
> 
>         while (1);
> }
> 
> void init_spi(){
>     unsigned char ch;
> 
> 
>     IODIR |= MMC_CS; // io direction of mc chip select
>     IOSET = MMC_CS; // Chip select High   
>     
>     SPCCR = 0xfe; // clock counter
>     SPCR =  0x20; // spi master mode, 
> 
>  //   ch = SPDR;// data read
>     
> }
> 
> BYTE MmCardSendByte(BYTE bt)
> {
>   BYTE input;
>   SPDR =  bt;  
>   while (!(SPSR & 0x80)); 
>   input = SPDR;
> 
>   return input; 
> }

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.