EmbeddedRelated.com
Forums

lpc2106 - SPI - i need help

Started by arturo_tramontini December 11, 2003
first - sorry for english mistake.

i'm try to use SPI in master mode.
i dont see any activity on relative pin.
here my code ( i'm use KEIL uvison3) have someone some suggestion?

thanks

----------------------
#include <LPC210x.H>

unsigned long j,g;

int main (void) {

unsigned char pin;
unsigned long i;

PCONP = 0x3FE;

IODIR = 0xff; // P0.0..7 defined as Outputs

SPI_SPCCR = 8; // rate spi

PINSEL0 = 0x5500; // enable spi i/o

SPI_SPCR = 0x20; // master mode

pin = 0;

while (1) {

for(i=0;i<8;i++){

if (pin) IOSET = 0x20; else IOCLR = 0x20;
pin ^= 1; SPI_SPDR = 0x55;// i'm expect to see some activity

}
}
}



An Engineer's Guide to the LPC2100 Series

--- In , "arturo_tramontini" <a.t@t...> wrote:
> first - sorry for english mistake.
>
> i'm try to use SPI in master mode.
> i dont see any activity on relative pin.
> here my code ( i'm use KEIL uvison3) > have someone some suggestion?
>
> thanks
>
> ----------------------
> #include <LPC210x.H>
>
> unsigned long j,g;
>
> int main (void) {
>
> unsigned char pin;
> unsigned long i;
>
> PCONP = 0x3FE;
>
> IODIR = 0xff; // P0.0..7 defined as Outputs
>
> SPI_SPCCR = 8; // rate spi
>
> PINSEL0 = 0x5500; // enable spi i/o
>
> SPI_SPCR = 0x20; // master mode
>
> pin = 0;
>
> while (1) {
>
> for(i=0;i<8;i++){
>
> if (pin) IOSET = 0x20; else IOCLR = 0x20;
> pin ^= 1;
>
// here i have put code for about 1 msec. delay
// to allow the flow for spi

>
> SPI_SPDR = 0x55;// i'm expect to see some activity
>
> }
> }
> }




If you are configuring the LPC to operate as SPI master you MUST
select SSEL functionality on the apropriate pin and have HIGH level
on this pin in order to act as a master.

Richard --- In , "arturo_tramontini" <a.t@t...> wrote:
> first - sorry for english mistake.
>
> i'm try to use SPI in master mode.
> i dont see any activity on relative pin.
> here my code ( i'm use KEIL uvison3) > have someone some suggestion?
>
> thanks
>
> ----------------------
> #include <LPC210x.H>
>
> unsigned long j,g;
>
> int main (void) {
>
> unsigned char pin;
> unsigned long i;
>
> PCONP = 0x3FE;
>
> IODIR = 0xff; // P0.0..7 defined as Outputs
>
> SPI_SPCCR = 8; // rate spi
>
> PINSEL0 = 0x5500; // enable spi i/o
>
> SPI_SPCR = 0x20; // master mode
>
> pin = 0;
>
> while (1) {
>
> for(i=0;i<8;i++){
>
> if (pin) IOSET = 0x20; else IOCLR = 0x20;
> pin ^= 1; > SPI_SPDR = 0x55;// i'm expect to see some activity
>
> }
> }
> }




If you are configuring the LPC to operate as SPI master you MUST
select SSEL functionality on the apropriate pin and have HIGH level
on this pin in order to act as a master.

Richard
--- In , "arturo_tramontini" <a.t@t...> wrote:
> first - sorry for english mistake.
>
> i'm try to use SPI in master mode.
> i dont see any activity on relative pin.
> here my code ( i'm use KEIL uvison3) > have someone some suggestion?
>
> thanks
>
> ----------------------
> #include <LPC210x.H>
>
> unsigned long j,g;
>
> int main (void) {
>
> unsigned char pin;
> unsigned long i;
>
> PCONP = 0x3FE;
>
> IODIR = 0xff; // P0.0..7 defined as Outputs
>
> SPI_SPCCR = 8; // rate spi
>
> PINSEL0 = 0x5500; // enable spi i/o
>
> SPI_SPCR = 0x20; // master mode
>
> pin = 0;
>
> while (1) {
>
> for(i=0;i<8;i++){
>
> if (pin) IOSET = 0x20; else IOCLR = 0x20;
> pin ^= 1; > SPI_SPDR = 0x55;// i'm expect to see some activity
>
> }
> }
> }