Yahoo Groups archive

Lpc2000

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

Message

Re: LPC2132 SPI problem

2005-03-02 by johnsonnenberg99

You are both right.  One MUST enable the Slave Select pin for the 
SPI to work as a Master.  This is how the 210x processors work, but 
it was supposed to be changed in the 2132.  Per the 2132 manual, 
page 157: "One the LPC2132 (unlike earlier versions), the SSEL0 pin 
can be used for different functions with the SPI0 is is in Maser 
Mode."  WRONG!
Thank you all for your help. I've enjoyed lurking in the background 
on this group. 
John Sonnenberg

--- In lpc2000@yahoogroups.com, "haack0815" <lpc_arm@s...> wrote:
> 
> --- In lpc2000@yahoogroups.com, "johnsonnenberg99"
> <johnsonnenberg99@y...> wrote:
> > 
> > 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.
> 
> Hi,
>  you must use the SSEL0 input an apply a high to this pin to enable
> the SPI0 controller.
> 
> ANdreas

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.