Problem with SPI CLOCK in ARM lpc2368

Hi to all

I am using LPC2368 for communicating an SPI based ADC.

I write all the code and dump into the board but I am not getting the clock from the clk pin …

here is my code Just observe this …

void SPI_init(void)

{

PINSEL0|=0xC0000000; /Select spi clock pin/

PINSEL1|=0x0000003C; /Select spi slave select,miso,mosi pins/

IODIR0 |=0x00010000;

// PINMODE1|=0x00000003;

S0SPCR=0x00000824; /Select clk phase low, clk polarity as low(clk active high)/

S0SPCCR=0x0C; /Clk is divided with 8 so spi clk is 1.5Mhz/

}

void SPI_write(unsigned char address,unsigned long int data,unsigned char length)

{

unsigned char read=0;

unsigned long int data2=data;

IOCLR0|=0x00010000;

address=(address|0x80);

S0SPDR=address; /Write data inti SPI data register/

while(!((S0SPSR)&&(0x80))); /Poll the SPIF flag for data completion/

read=S0SPDR; /Read the data register for clear the SPIF flag/

spi_delay();

if(length==12)

{

length=16;

}

do

{

length=length-8;

data2=(data>>length)&(0xFF);

S0SPDR=data2; /Write data inti SPI data register/

while(!((S0SPSR)&&(0x80))); /Poll the SPIF flag for data completion/

read=S0SPDR; /Read the data register for clear the SPIF flag/

spi_delay();

}while(length!=0);

}

void spi_delay(void)

{

unsigned int dd;

for(dd=0;dd<65000;dd++);

}

Any body please tell me Why clock is not generated…

You will find some examples of how to use SPI in the Yahoo LPC2000 group file collection.