Yahoo Groups archive

Lpc2000

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

Message

RE: [lpc2000] LPC2132 SPI problem

2005-03-02 by Ronnie Leighty

Hi John,

	I had a similar problem with the LPC2119/29. Once I enabled the SSEL in the
pin block, it worked fine. Also - just in case - ensure the TRST,TDI,TMS,
AND TDO are tied high avia 10k. TCK tied low via 10k.

Regards

Ronnie Leighty
Principle Engineer
2802 Leslie Rd
Tampa, FL 33619
voice (813) 630-1229 ext. 111
fax     (813) 630-2619


-----Original Message-----
From: johnsonnenberg99 [mailto:johnsonnenberg99@...]
Sent: Wednesday, March 02, 2005 3:57 AM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] LPC2132 SPI problem




I just can't get the SPI port on the 2132 to work (master mode).
Any help would be MUCH appreciated!
I've setup the pin connect block per the manual, enable the SPI port
in the PCONP register, programmed the SPI registers, and then try to
send a byte.  It appears to send in software, and the SPIF bit get
set, but nothing comes out the MOSI pin or the SCK pin (both stuck
low).  I don't think I have a short on the PCB.

Here's the main sections of code


//********************************************
//********************************************
void OpenMasterSPI0(void)
{
  PCONP_bit.PCSPI0 = 1;               // enable the SPI hardware
  PINSEL0 = PINSEL0 & 0xFFFF00FF;     // set the pin-select
regisgters to enable the SPI pins
  PINSEL0 = PINSEL0 | 0x00001500;     // Enable SPI pins, but do not
use the Slave Select Pin.  It is GPIO.
  // set the pins to SPI
  SPCCR0 = 128;                       // clk for the SPI clock.
  SPCR0 = 0x20 ;                      // master mode, active high
clock, no IRQ
}


//*****************************************************
// Write a byte to the SPI, and also read one in.
//*****************************************************
char WriteReadSPI0(char b)
{
  int i=0;
  SPDR0 = b;                // this write starts the spi transmission
  i=0;
  while( i == 0 )
        i = (SPSR0 & 0xff);   // wait till we are done.
  return SPDR0;
}

Thanks in advance for any ideas.







Yahoo! Groups Links

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.