jayanthyk192
Full Member level 3
- Joined
- Sep 17, 2010
- Messages
- 179
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,298
- Activity points
- 2,580
Hi,
I'm trying to get the SPI on my LPC2106 to work but it doesn't.
I'm trying the above code i wrote. I left the SSEL pin floating, MISO and MOSI shorted. The infinite loop is running and I get data serially continuously. This data is only 0xff. So, i connected the MISO to ground and got 0x00 as data. I checked the SCK and MOSI pins, both of them are floating. I even pulled up the SSEL, but still no change.
Additional info: I tried selecting the SSEL function also. I even tried CPOL=CPHA=0.
Please help me,
Thank you.
I'm trying to get the SPI on my LPC2106 to work but it doesn't.
Code:
#include <LPC210x.H> /* LPC21xx definitions */
void delay (void)
{ /* wait function */
int d;
for (d = 0; d < 1000000; d++); /* only to delay for LED flashes */
}
int main (void)
{
unsigned char temp;
U0LCR=0x83;
U0DLM=1; // 0 for 32MHz
U0DLL=105; //208 for 32MHz
U0LCR=0X03;
U0FCR=1;
PINSEL0=PINSEL0 | 5;
S0SPCCR=12; //divide by 12
S0SPCR=0x38; //Master, CPOL=CPHA=1
PINSEL0=PINSEL0 | (0x15 << 8); // Select MISO MOSI SCK functions
IODIR = IODIR | (1<<3); //SPI CS pin for external slave select.
IOSET=IOSET|(1<<3);
while(1)
{
S0SPDR=0X8f;
while(!(S0SPSR & 0x80));
U0THR=S0SPDR;
delay();delay();delay();delay();
}
}
I'm trying the above code i wrote. I left the SSEL pin floating, MISO and MOSI shorted. The infinite loop is running and I get data serially continuously. This data is only 0xff. So, i connected the MISO to ground and got 0x00 as data. I checked the SCK and MOSI pins, both of them are floating. I even pulled up the SSEL, but still no change.
Additional info: I tried selecting the SSEL function also. I even tried CPOL=CPHA=0.
Please help me,
Thank you.