Forums

LPC2138 SPI Problem

Started by johnleerberg February 9, 2006
Hi All
      I have been working with the LPC2138 for about 12 months on and 
off and have had NO problems with getting any of the peripherals 
working until now. 

I have two LPC2138's connected via SPI0 and am intending to setup one 
as a master and the other a slave that adds two serial ports to my 
master.

There are two issues:

1) With MOSI to MOSI, P1.24 (master) to SSEL0 (slave), SCLK0 to SCLK0 
and MISO floating i am seeing a mirror of what is being transmitted 
by the master on the MISO pin of the slave????? And i mean a perfect 
mirror with no time shift, with the 4 channel CRO i am using i can 
overlay one waveform ontop of the other and they match perfectly. Yes 
i have put a multimeter across the pins to check for conductivity and 
no there is no solder across the MOSI and MISO.

2) I can get the SPI interrupt the fire on both the master and the 
slave but randomly the master will just lock up (something i have 
never had happen before). Also the upon power reset the SPI wont 
start but the serial port start perfectly everytime.
My program has three basic sections
a) In main i call an init interrupt routine which initialises the SPI 
port on the master.
b) In my ISR i read the S0SPSR (clear it), write 0xA0 to S0SPCR, 
clear the interrupt by writing 0x01 to S0SPINT, clear the VicVectAddr.
c) In main i write 0x5A to S0SPDR then wait 4ms and repeat (while(1) 
loop)

If anyone can help me it would be greatly appreciated.
	

An Engineer's Guide to the LPC2100 Series

I am looking for an emacs mode script that understands gnu arm
assembler.
The default asm-mode.elc does not highlight the comment "@" or process
lines that start with a label that does not start with an letter.

George
	
	
Make sure the SSEL0 pin on the MASTER is configured for SPI usage and
is pulled-up.

Regards
-Bill Knight
R O SOftWare &
http://www.theARMPatch.com
	On Thu, 09 Feb 2006 23:22:36 +0000, johnleerberg wrote:

>Hi All
>      I have been working with the LPC2138 for about 12 months on and 
>off and have had NO problems with getting any of the peripherals 
>working until now. 

>I have two LPC2138's connected via SPI0 and am
intending to setup one 
>as a master and the other a slave that adds two serial ports to my 
>master.

>There are two issues:

>1) With MOSI to MOSI, P1.24 (master) to SSEL0
(slave), SCLK0 to SCLK0 
>and MISO floating i am seeing a mirror of what is being transmitted 
>by the master on the MISO pin of the slave????? And i mean a perfect 
>mirror with no time shift, with the 4 channel CRO i am using i can 
>overlay one waveform ontop of the other and they match perfectly. Yes 
>i have put a multimeter across the pins to check for conductivity and 
>no there is no solder across the MOSI and MISO.

>2) I can get the SPI interrupt the fire on both the
master and the 
>slave but randomly the master will just lock up (something i have 
>never had happen before). Also the upon power reset the SPI wont 
>start but the serial port start perfectly everytime.
>My program has three basic sections
>a) In main i call an init interrupt routine which initialises the SPI 
>port on the master.
>b) In my ISR i read the S0SPSR (clear it), write 0xA0 to S0SPCR, 
>clear the interrupt by writing 0x01 to S0SPINT, clear the VicVectAddr.
>c) In main i write 0x5A to S0SPDR then wait 4ms and repeat (while(1) 
>loop)

>If anyone can help me it would be greatly
appreciated.

>
	> 
>Yahoo! Groups Links
	>
	
Hi John,
   
  Your mail has releived me. I thought i was the only one to face problems with
the SPI of phillips. I was facing a similar problem like yours. I have been able
to solve the problem partly.
  i.e.
  1. The miror image problem. can be solved by using the opposite modes in the
master and slave side i.e if master is MSB the slave should be LSB.
   
  I am still facing a similar problem like yours, which i have not been able to
solve as yet.
  I am unable to get the SPI working on power up reset, i.e all the other
peripherals work perfect other than SPI. I have used SPI interrupts, & I
have to short the reset pin momentarily to ground and reset the controller to
make the SPI start working. I hope some one can help me with this problem. 
   
  SPI is really nagging me. Its been over a month now, and i have not been able
to get the SPI work on power UP.
   
  Regards,
  Jerome
	johnleerberg <johnleerberg@john...> wrote:
  Hi All
      I have been working with the LPC2138 for about 12 months on and 
off and have had NO problems with getting any of the peripherals 
working until now. 

I have two LPC2138's connected via SPI0 and am intending to setup one 
as a master and the other a slave that adds two serial ports to my 
master.

There are two issues:

1) With MOSI to MOSI, P1.24 (master) to SSEL0 (slave), SCLK0 to SCLK0 
and MISO floating i am seeing a mirror of what is being transmitted 
by the master on the MISO pin of the slave????? And i mean a perfect 
mirror with no time shift, with the 4 channel CRO i am using i can 
overlay one waveform ontop of the other and they match perfectly. Yes 
i have put a multimeter across the pins to check for conductivity and 
no there is no solder across the MOSI and MISO.

2) I can get the SPI interrupt the fire on both the master and the 
slave but randomly the master will just lock up (something i have 
never had happen before). Also the upon power reset the SPI wont 
start but the serial port start perfectly everytime.
My program has three basic sections
a) In main i call an init interrupt routine which initialises the SPI 
port on the master.
b) In my ISR i read the S0SPSR (clear it), write 0xA0 to S0SPCR, 
clear the interrupt by writing 0x01 to S0SPINT, clear the VicVectAddr.
c) In main i write 0x5A to S0SPDR then wait 4ms and repeat (while(1) 
loop)

If anyone can help me it would be greatly appreciated.
	  SPONSORED LINKS 
        Microcontrollers   Microprocessor   Intel microprocessors     Pic
microcontrollers 
    
---------------------------------
  YAHOO! GROUPS LINKS
	---------------------------------
	---------------------------------
 Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.


	
I had problems with the SPI port months ago as well.  I gave up and wrote
my own bit banging code to do the same thing.  SPI is very easy to implement
manually.  All I recall right now is that it did not seem to handle 8, 16, 
and/or 24 bit data correctly.  Different word sizes seemed to be a problem.  I
was very unhappy with the SPI port overall and finally dumped it, switched the
pins to I/O, and handled it myself.  That worked right from the start so I never
went back to the built-in SPI mode.

Chris.
	---- Original Message ----- 
  From: jk jlkj 
  To: lpc2000@lpc2... 
  Sent: Sunday, February 12, 2006 8:44 PM
  Subject: Re: [lpc2000] LPC2138 SPI Problem
	  Hi John,
     
    Your mail has releived me. I thought i was the only one to face problems
with the SPI of phillips. I was facing a similar problem like yours. I have been
able to solve the problem partly.
    i.e.
    1. The miror image problem. can be solved by using the opposite modes in the
master and slave side i.e if master is MSB the slave should be LSB.
     
    I am still facing a similar problem like yours, which i have not been able
to solve as yet.
    I am unable to get the SPI working on power up reset, i.e all the other
peripherals work perfect other than SPI. I have used SPI interrupts, & I
have to short the reset pin momentarily to ground and reset the controller to
make the SPI start working. I hope some one can help me with this problem. 
     
    SPI is really nagging me. Its been over a month now, and i have not been
able to get the SPI work on power UP.
     
    Regards,
    Jerome
	  johnleerberg <johnleerberg@john...> wrote:
    Hi All
        I have been working with the LPC2138 for about 12 months on and 
  off and have had NO problems with getting any of the peripherals 
  working until now. 

  I have two LPC2138's connected via SPI0 and am intending to setup one 
  as a master and the other a slave that adds two serial ports to my 
  master.

  There are two issues:

  1) With MOSI to MOSI, P1.24 (master) to SSEL0 (slave), SCLK0 to SCLK0 
  and MISO floating i am seeing a mirror of what is being transmitted 
  by the master on the MISO pin of the slave????? And i mean a perfect 
  mirror with no time shift, with the 4 channel CRO i am using i can 
  overlay one waveform ontop of the other and they match perfectly. Yes 
  i have put a multimeter across the pins to check for conductivity and 
  no there is no solder across the MOSI and MISO.

  2) I can get the SPI interrupt the fire on both the master and the 
  slave but randomly the master will just lock up (something i have 
  never had happen before). Also the upon power reset the SPI wont 
  start but the serial port start perfectly everytime.
  My program has three basic sections
  a) In main i call an init interrupt routine which initialises the SPI 
  port on the master.
  b) In my ISR i read the S0SPSR (clear it), write 0xA0 to S0SPCR, 
  clear the interrupt by writing 0x01 to S0SPINT, clear the VicVectAddr.
  c) In main i write 0x5A to S0SPDR then wait 4ms and repeat (while(1) 
  loop)

  If anyone can help me it would be greatly appreciated.
	    SPONSORED LINKS 
          Microcontrollers   Microprocessor   Intel microprocessors     Pic
microcontrollers 
      
  ---------------------------------
    YAHOO! GROUPS LINKS
	  ---------------------------------
	  ---------------------------------
  Jiyo cricket on Yahoo! India cricket
  Yahoo! Messenger Mobile Stay in touch with your buddies all the time.

  
	  SPONSORED LINKS Microcontrollers  Microprocessor  Intel microprocessors  
        Pic microcontrollers
	------
  YAHOO! GROUPS LINKS 

    a..
	------
	
	
I've been using SPI0 in master mode to control a MAX3100 serial port 
with no problems at all. Never used it in slave mode, though.

Guille

--- In lpc2000@lpc2..., jk jlkj <njad2002@...> wrote:
>
> Hi John,
>    
>   Your mail has releived me. I thought i was the only one to face 
problems with the SPI of phillips. I was facing a similar problem 
like yours. I have been able to solve the problem partly.
>   i.e.
>   1. The miror image problem. can be solved by using the opposite 
modes in the master and slave side i.e if master is MSB the slave 
should be LSB.
>    
>   I am still facing a similar problem like yours, which i have not 
been able to solve as yet.
>   I am unable to get the SPI working on power up
reset, i.e all the 
other peripherals work perfect other than SPI. I have used SPI 
interrupts, & I have to short the reset pin momentarily to ground and 
reset the controller to make the SPI start working. I hope some one 
can help me with this problem. 
>    
>   SPI is really nagging me. Its been over a month now, and i have 
not been able to get the SPI work on power UP.
>    
>   Regards,
>   Jerome
>    
>   
> 
> johnleerberg <johnleerberg@...> wrote:
>   Hi All
>       I have been working with the LPC2138 for about 12 months on 
and 
> off and have had NO problems with getting any of
the peripherals 
> working until now. 
> 
> I have two LPC2138's connected via SPI0 and am intending to setup 
one 
> as a master and the other a slave that adds two
serial ports to my 
> master.
> 
> There are two issues:
> 
> 1) With MOSI to MOSI, P1.24 (master) to SSEL0 (slave), SCLK0 to 
SCLK0 
> and MISO floating i am seeing a mirror of what is
being transmitted 
> by the master on the MISO pin of the slave????? And i mean a 
perfect 
> mirror with no time shift, with the 4 channel CRO
i am using i can 
> overlay one waveform ontop of the other and they match perfectly. 
Yes 
> i have put a multimeter across the pins to check
for conductivity 
and 
> no there is no solder across the MOSI and MISO.
> 
> 2) I can get the SPI interrupt the fire on both the master and the 
> slave but randomly the master will just lock up (something i have 
> never had happen before). Also the upon power reset the SPI wont 
> start but the serial port start perfectly everytime.
> My program has three basic sections
> a) In main i call an init interrupt routine which initialises the 
SPI 
> port on the master.
> b) In my ISR i read the S0SPSR (clear it), write 0xA0 to S0SPCR, 
> clear the interrupt by writing 0x01 to S0SPINT, clear the 
VicVectAddr.
> c) In main i write 0x5A to S0SPDR then wait 4ms
and repeat (while
(1) 
> loop)
> 
> If anyone can help me it would be greatly appreciated.
> 
>    
> 
> 
> 
> 
> 
>   SPONSORED LINKS 
>         Microcontrollers   Microprocessor   Intel 
microprocessors     Pic microcontrollers 
>     
> ---------------------------------
>   YAHOO! GROUPS LINKS 
> 
>     
>      
> 
>     
> ---------------------------------
>   
> 
> 
> 
> 				
> ---------------------------------
>  Jiyo cricket on Yahoo! India cricket
> Yahoo! Messenger Mobile Stay in touch with your buddies all the 
time.
> 
> 
>