Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | LPC2000 | SPI problem

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

SPI problem - kender_a - Oct 1 3:02:31 2009


Colleagues,

I've written a small program in IAR EWARM to test SPI. It runs, but
SCLK and MOSI do not show up on the oscilloscope. Here's the code,
which actually makes SPI transactions:

while(1)

{

S0SPCCR = 32; // SCLK rate

S0SPCR =

0x00000000 | // MOSI valid on raising edge of SCLK
(CPOL=CPHA=0)

0x00000020 | // master (AD7390 DAC is the slave)

0x00000000 | // MSbit first

0x00000000 | // SPI interrupt inhibited

0x000C0004; // transmit 12 bits (BitEnable, BITS)

DAC_xLD_FSET = DAC_xLD_MASK; // drive LD# high

S0SPDR = 0x7FF; // write to the data register (this will start the
transmission and clear the SPIF bit)

while ( !(S0SPSR & 0x80) ); // poll SPIF bit for the end of
transaction

DAC_xLD_FCLR = DAC_xLD_MASK; // drive LD# low (data gets written
from serial shift register to DAC register)

}

Here's the initialization of my SPI peripheral:

void SPI_Init()

{

PCONP_bit.PCSPI = 1;

PINSEL3 = 0x0003CF00;

}

With a scope, I can see the LD# line toggle up and down, so this program
doesn't hang while polling for SPIF. Rang-out the wiring - it seems
to be correct. Nothing is shorted to Vcc or GND. Added a pullup and
enabled SSEL in PINSEL3, following this advice:
http://tech.groups.yahoo.com/group/lpc2000/message/4363
<../../../message/4363> . Checked that PINSEL doesn't get
overwritten. But still no clock.

Could anyone spot an error? What else can I check?

Thanks,

- Nick

[Non-text portions of this message have been removed]

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: SPI problem - leon Heller - Oct 1 3:16:22 2009

----- Original Message -----
From: "kender_a"
To:
Sent: Thursday, October 01, 2009 8:00 AM
Subject: [lpc2000] SPI problem
>
> Colleagues,
>
> I've written a small program in IAR EWARM to test SPI. It runs, but
> SCLK and MOSI do not show up on the oscilloscope. Here's the code,
> which actually makes SPI transactions:

Have you initialised the interface?

Leon
------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: SPI problem - kender_a - Oct 1 3:19:45 2009

My initialization code is in the second half of the original post.

- Nick
--- In l...@yahoogroups.com, "leon Heller" wrote:
>
> ----- Original Message -----
> From: "kender_a"
> To:
> Sent: Thursday, October 01, 2009 8:00 AM
> Subject: [lpc2000] SPI problem
> >
> > Colleagues,
> >
> >
> >
> > I've written a small program in IAR EWARM to test SPI. It runs, but
> > SCLK and MOSI do not show up on the oscilloscope. Here's the code,
> > which actually makes SPI transactions:
>
> Have you initialised the interface?
>
> Leon
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: SPI problem - kender_a - Oct 3 1:26:09 2009

Well, it was a hardware problem. I have mixed-up SSP0 pins (34, 37, 38) and SPI pins (60, 61, 62). This is my 1st design with LPC2000.

The LPC23XX user manual says that SSP can be an SPI master. Out of curiosity: why does the chip have 2 SSPs, which can do all SPI functions, and a redundant dedicated SPI peripheral ? Which one is preferable?

- Nick

--- In l...@yahoogroups.com, "kender_a" wrote:
> Colleagues,
>
> I've written a small program in IAR EWARM to test SPI. It runs, but
> SCLK and MOSI do not show up on the oscilloscope. [...]

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )