EmbeddedRelated.com
Forums

LPC to MSC SPI interface

Started by Jerome January 4, 2006
Hi Friends,

Im a newbie to LPC.
Currently i am working on a project which requires me to interface
the LPC2214 chip with MSC1210 using SPI, and is proving to be very
problematic.

In both the below cases i have tried debugging using JTAG. Case 1
I have tried with LPC as a Master and also connected the SS- pin to
High. Here, the transmission from LPC to MSC is perfectly fine, and
also the reception of bytes at MSC is perfect, but the MSC Tx i.e.
slave output doesnot respond at all. The MSC doesnot shift the data
out from its SPIData register on receiving the clock from the master.
STRANGE!!!!! na

Case 2
Having tried the above, i then tried with the MSC as master and LPC
as slave. Here the things are even interesting. I am able to transfer
data both ways. But the data received at the Slave i.e MSC, doesnot
match the data which was sent by the Master. However, the data is
received in correctly at the Master end. The data was verified using
UART's on both the controllers.

I hope some one has tried this and will be able to help me out. Its
been over 2 weeks now that i have been struggling with this problem.

Is there any compatibility issues between the LPC2214 and MSC1210.

Regards,
Jerome


An Engineer's Guide to the LPC2100 Series

Is it possible that you have the SPI modes mis-matched? I.e., clocking
on the wrong edges? That might explain the incorrect data.
_____

From: lpc2000@lpc2... [mailto:lpc2000@lpc2...] On Behalf
Of Jerome
Sent: Wednesday, January 04, 2006 7:18 AM
To: lpc2000@lpc2...
Subject: [lpc2000] LPC to MSC SPI interface
Hi Friends,

Im a newbie to LPC.
Currently i am working on a project which requires me to interface
the LPC2214 chip with MSC1210 using SPI, and is proving to be very
problematic.

In both the below cases i have tried debugging using JTAG. Case 1
I have tried with LPC as a Master and also connected the SS- pin to
High. Here, the transmission from LPC to MSC is perfectly fine, and
also the reception of bytes at MSC is perfect, but the MSC Tx i.e.
slave output doesnot respond at all. The MSC doesnot shift the data
out from its SPIData register on receiving the clock from the master.
STRANGE!!!!! na

Case 2
Having tried the above, i then tried with the MSC as master and LPC
as slave. Here the things are even interesting. I am able to transfer
data both ways. But the data received at the Slave i.e MSC, doesnot
match the data which was sent by the Master. However, the data is
received in correctly at the Master end. The data was verified using
UART's on both the controllers.

I hope some one has tried this and will be able to help me out. Its
been over 2 weeks now that i have been struggling with this problem.

Is there any compatibility issues between the LPC2214 and MSC1210.

Regards,
Jerome

_____

> .
_____


Hi Friends,

Thanks for the reply Dan

I have connected both the master and slave as CPHA =1,CPOL = 0 and LSB.
I have noticed one point in the LPC2214, and i do not know whether it could be a cause of concern.
With the above configuration, and with LPC as master. The data is driven 1/2 bit time prior to the first clock edge. This is not as per the User manual. I have given below my code snippet for the LPC as a slave.
Is there anything wrong with this loop for testing SPI in polling for LPC as slave.

unsigned char dat;

while(1)
{
while( !(S0SPSR & 0x80) ){}
dat = S0SPDR;
S0SPDR = S0SPDR;
}

Here i am facing a problem that if the master has transmitted 0x01 then i get some different value in dat. Where as the value that is received at the master is 0x01. Regards,
Jerome
Dan Beadle <dan.beadle@dan....> wrote:
Is it possible that you have the SPI modes mis-matched? I.e., clocking
on the wrong edges? That might explain the incorrect data.
_____

From: lpc2000@lpc2... [mailto:lpc2000@lpc2...] On Behalf
Of Jerome
Sent: Wednesday, January 04, 2006 7:18 AM
To: lpc2000@lpc2...
Subject: [lpc2000] LPC to MSC SPI interface
Hi Friends,

Im a newbie to LPC.
Currently i am working on a project which requires me to interface
the LPC2214 chip with MSC1210 using SPI, and is proving to be very
problematic.

In both the below cases i have tried debugging using JTAG. Case 1
I have tried with LPC as a Master and also connected the SS- pin to
High. Here, the transmission from LPC to MSC is perfectly fine, and
also the reception of bytes at MSC is perfect, but the MSC Tx i.e.
slave output doesnot respond at all. The MSC doesnot shift the data
out from its SPIData register on receiving the clock from the master.
STRANGE!!!!! na

Case 2
Having tried the above, i then tried with the MSC as master and LPC
as slave. Here the things are even interesting. I am able to transfer
data both ways. But the data received at the Slave i.e MSC, doesnot
match the data which was sent by the Master. However, the data is
received in correctly at the Master end. The data was verified using
UART's on both the controllers.

I hope some one has tried this and will be able to help me out. Its
been over 2 weeks now that i have been struggling with this problem.

Is there any compatibility issues between the LPC2214 and MSC1210.

Regards,
Jerome

_____

> .
_____

---------------------------------
YAHOO! GROUPS LINKS --------------------------------- Send instant messages to your online friends http://in.messenger.yahoo.com



Hi friends,

Thanks for the suggestions.
I have finally been able to interface MSC with LPC using SPI.

I think that i should make it a point to give to the group, something that i have learnt over the past 3 weeks that i have worked with SPI.

1. Dont even think of using a polling routine at the slave end for receiving data with LPC as slave and MSC as master. Because it will give u data that will not match the data sent by the master.

2. I was able to transmit and receive data successfully between the two, with LPC as slave and MSC as master with the following settings.

MSC - Master
a. LSB
b. CPHA - 1
c. CPOL - 0

LPC - SLAVE
a. MSB
b. CPHA - 1
c. CPOL - 0

I hope this input will be of some one who will try to interface LPC2214 with MSC1210.

I would like to know if this is a normal configuration for SPI communication. i.e the Master and slave order, LSB first and MSB first, should be opposite for the SLAVE and MASTER.

Anyways i must also inform that, i have not yet been able to interface LPC as a Master and with MSC as a slave.

I am facing a problem that, the tranfer from LPC to MSC work fine but, there is no transfer from the slave.

It would really be helpful, if someone could give me someleads as to how i can do this.

Regards,
Jerome Send instant messages to your online friends http://in.messenger.yahoo.com