Yahoo Groups archive

Lpc2000

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

Message

SPI on LPC2106

2005-02-23 by Mark Butcher

Hi All

Just a quick question about SPI.

Today I tried to use it for the first time but had no luck. Possibly 
someone has a tip.

Here's what I am doing:
1. Set SPI ports for SPI operation
     *(unsigned long*)*0xe002C000 |= 0x00000050 // PINSEL0
2. Setup SPI speed
     *(unsigned long*)*0xe002000C = 0x00000020  // SPCCR
3. Setup SPI to master mode
     *(unsigned long*)*0xe0020000 |= 0x00000020  // SPCCR 
4. Send a test byte    
     *(unsigned long*)*0xe0020008 = 0x00000055  // SPDR

After the last command the status register has the bit 0x80 (SPIF) 
set to 1, indicating that the transfer has completed (before it was 
at 0), but I see no data sent (neither signals on the clock line nor 
the data line nor the SSEL line). In fact they all seem to be in a 
high impedence state since I measure zero voltage (or 3V3 with a 
pull up resistor).

Therefore I conclude that I have problems setting the SPI ports to 
the correct mode but PINSEL0 seems to be correct (which I have 
verified several times to be sure).

So what is the trick involved to get it working?

Thanks in advance

regards

Mark Butcher

www.mjbc.ch

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.