Yahoo Groups archive

Lpc2000

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

Message

SPI NOT RESPONDING

2005-03-14 by rockraj_2003

HELLO FRIENDS,

No body giving me suggestion on how to program SPI.
My real task is to configure "DP1203" by using LPC2104.
The only way to configure DP1203 is throu "SPI".
I got an example file from Keil. 
Its working and producing SCK(Serial Clock).
I fixed the Clk Frequency at 100Khz. But I am getting only 40 Mhz.
I just Send an 8 bit Data After if i send other Data its not 
reponding.
The SCK pin is in low State.
The "DP1203" has got 8 address bit and 8 data bit.
So totally 16 bit for One Configuration of Registers.
But I want to Configure more than 20 Registers.
Can any one Suggest me where i am doing the mistake.

Here is the Code
#include <LPC210x.H>

#define SPI_SPCR       (*((volatile unsigned char *) 0xE0020000))
#define SPI_SPSR       (*((volatile unsigned char *) 0xE0020004))
#define SPI_SPDR       (*((volatile unsigned char *) 0xE0020008))
#define SPI_SPCCR      (*((volatile unsigned char *) 0xE002000C))
#define SPI_SPTCR      (*((volatile unsigned char *) 0xE0020010))
#define SPI_SPTSR      (*((volatile unsigned char *) 0xE0020014))
#define SPI_SPTOR      (*((volatile unsigned char *) 0xE0020018))
#define SPI_SPINT      (*((volatile unsigned char *) 0xE002001C))

int main (void) 
{
int i;
VPBDIV = 1; 
IODIR = 0x80; 
IOSET = 0x80;
PINSEL0 = 0x5500;
SPI_SPCCR = 0x93; 
SPI_SPCR = 0x20;
while (1) {
do SPI_SPDR = 0x55; 
while((SPI_SPSR & 0x80)==0); 
for(i=0;i<10000;i++);
SPI_SPSR = 0x00;
do SPI_SPDR = 0x0F; 
while((SPI_SPSR & 0x80)==0);
goto OUT;
}

OUT: for(i=0;i<1000;i++);

while (1) {
do SPI_SPDR = 0xF0; 
while((SPI_SPSR & 0x80)==0);
for(i=0;i<100000;i++);
goto OUT;
}
}






Thank U,

with Regards,
Rajendra R

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.