SPI on LPC2106
2004-09-13 by teunvandeberg
Yahoo Groups archive
Index last updated: 2026-04-28 23:31 UTC
Thread
2004-09-13 by teunvandeberg
I'm going to start writing an SPI driver for the Philips LPC2106 micro controller, but before doing so I wanted to check if no one else has done this so if anyone has, please let me know. Teun
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.ch2005-02-23 by Robert Adsett
At 05:07 PM 2/23/05 +0000, Mark Butcher wrote:
>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?
SSEL must a - be an input and b - be pulled high.
See http://www.open-research.org.uk/ARMuC/index.cgi?LPC2100Tips
Robert
" 'Freedom' has no meaning of itself. There are always restrictions,
be they legal, genetic, or physical. If you don't believe me, try to
chew a radio signal. "
Kelvin Throop, III2005-02-24 by Mark Butcher
Thank you Robert The pull up on SSEL cured the problem!! Regards Mark Butcher --- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> wrote: > At 05:07 PM 2/23/05 +0000, Mark Butcher wrote: > >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? > > > SSEL must a - be an input and b - be pulled high. > > See http://www.open-research.org.uk/ARMuC/index.cgi?LPC2100Tips > > Robert > > " 'Freedom' has no meaning of itself. There are always restrictions, > be they legal, genetic, or physical. If you don't believe me, try to
> chew a radio signal. " > > Kelvin Throop, III
2005-02-25 by Ronnie Leighty
Hi Mark, I am having similar issue with the 2119 part where I noticed your PINSEL0 setting of 0x00000050 is misaligned with p78 or P127 of the 2119 user manual. I'm I reading the table incorrectly? I register the value of 0x00001505 to have SPI 0 and UART 0 selected. But hey, mine is not working... Help anyone?? Regards Ronnie Leighty Principle Engineer 2802 Leslie Rd Tampa, FL 33619 voice (813) 630-1229 ext. 111 fax (813) 630-2619
-----Original Message-----
From: Mark Butcher [mailto:M_J_Butcher@...]
Sent: Wednesday, February 23, 2005 12:07 PM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] SPI on LPC2106
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
Yahoo! Groups Links