SPI interface -- newbie --plz help

hi, i am trying to use SPI in my application.i want to have communication between two sdk's LPC2138 & LPC935. i have configured LPC2138 as master & other as slave.but i am not getting output on slave . i am sending a character string from master and want the slave to display it through hyperterminal.

one thing i want to verify before others ,is that ,can i experiment this with simple copper wires or i would need some other bus because copper wires can add delays & disturb the clock synchronization.

what should i do?

Reply to
abhay
Loading thread data ...

SPI means the clock (SCK) is sent from the master to the slave. And yes, Copper wire has a delay of 4.5ns per meter, about 50% more than free space. See your physics teacher for less delay.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

Wire length is very important especially at high SPI speeds. I suggest starting with a very low clock speed and fairly short connections (under a foot). Still you may need to use twisted pairs to keep noise and crosstalk down. Extraneous pulses on the clock line are death to data on SPI.

At the risk of being too basic, make sure you are connected correctly. The Master Out - Slave In (MOSI) line of the master goes to the same line on the slave. If you want return communication the Master In - Slave Out (MISO) signals need to be connected together.

If you need an analyzer I highly recommend the Techtools Digiview. It is a great general purpose USB based logic analyzer, sells for $500 US and has SPI analysis software included.

Scott

Reply to
Not Really Me

thanks for your replies, i am trying my experimentation with a very small distance in between. wires with about 20cm length. will that also pose any problem?does there come any bus specific to spi.

Reply to
abhay

No

1 out of 1,000,000 times it may be a wire.

The other 999,999 times it _WILL_ be your software.

donald

Reply to
Donald

Exactly.

Scott

Reply to
Not Really Me

hi, i need to use spi in my application but before that i want to do some experimentation on that through my sdk kits ? now i am doing my spi communication with short leads(nearly 10 cm). i m sending character string from master and trying to print that on hyperterminal on slave side.but its not showing me the string on slave side. Do i need to configure clk on slave side also ? however i suppose that it should take its clock from master itself.

what will clock setting on slave side do? then what does clock synchronisation mean in spi interface ? also i have provided both sdk's with common ground.the interrupt on slave side is generated when i switch off master (but it happens sometime only).

please suggest something ?

Reply to
manoj

First thing is to make absolutely sure that you understand how SPI works - get a specification. SPI consits of a master and a slave, where the master is responsible for driving the clock signal on BOTH the transmit AND receive cycles. If a SPI master wants to receive information, it must clock the data back from the slave and in the process it will transmit data. It may be real or dummy data.

Data is transfered from MOSI (master out slave in) and SOMI (slave out master in). Sometimes there is also a slave transmit enable, which is often times used as a chip select for when there are multiple slave devices. Depending on your platform it may be possible to adjust the clock phasing which would influence whether data is transmitted or recieved on the rising or falling edges and any delays. Typically data will be transmitted on one edge and received on the subsequent edge of the same clock pulse.

should work, at least for a prototype / debugging application. I wouldn't necessarilly rely on your arrangement for a production environment. You should be able to look at the signals with a scope or a logic analyzer. It will robably be easier to interpet what is happening with a logic analyzer, though a scope may give you a better idea of the signal quality. If you find you hook a scope up to your system and it changes its behavior, it is a pretty good indication that you have an electrical or signalling issue. You will also need to be sure that the signal voltages are compatible with both devices and be carefull wheb connecting the system grounds together.

Reply to
Noway2

_Is_ there "a" specification for SPI? It seems to be considerably fuzzier than, say, I2C. I could not find "a" SPI spec when I was writing my last book. I could find only general information from Motorola^H^H^H^H^H^H^H^H^HFreescale.

Reply to
larwe

_Is_ there "a" specification for SPI? It seems to be considerably fuzzier than, say, I2C. I could not find "a" SPI spec when I was writing my last book. I could find only general information from Motorola^H^H^H^H^H^H^H^H^HFreescale.

Reply to
larwe

_Is_ there "a" specification for SPI? It seems to be considerably fuzzier than, say, I2C. I could not find "a" SPI spec when I was writing my last book. I could find only general information from Motorola^H^H^H^H^H^H^H^H^HFreescale.

Reply to
larwe

Who is Freescale? My old Motorola M68HC11 Reference Manual (M68HC11RM/AD REV 3 from 1991) has a whole chapter describing the SPI, and the QSMRM/AM (Queued Serial Module, 1991) too. Both are different (QSM has some more features), and both are totally different from TI's SPI solution which has to different shift registers for reading and writing. They (TI) shouldn't have called their silly MSP430 endpoint interface a SPI... :-(

No, there is no common SPI spec at all.

Bodo

Reply to
Bodo Rzany

There may not be an "official" spec but there is lots of good info on the net Try google for SPI +serial

formatting link
formatting link

Scott

Reply to
Not Really Me

Freescale is the semiconductor division of Motorola that was spun off as a separate entity ~3 years ago.

There may be differences in IMPLEMENTATION of SPI by a particular vendor; the SPECIFICATION covers how the signals on the wire should behave, and what they mean.

Many of us here have made SPI work using just bit-banged I/O ports; the advent of micros with SPI hardware just makes it easier (sometimes!).

--Gene

Reply to
Gene S. Berkowitz

hi, i am stuck with a new but strange problem related to SPI. i have configured my philips micro LPC935 as master and i am trying to view its clock output on CRO (actually DPO).but i am getting noise signals only with some garbage frequency values that are not constant.i have tried this also with ARM based microcontroller LPC2138 but i am getting same response on that also. so its a major problem because i cannot proceed with my SPI experimentation untill i am sure with clock output.

please suggest what steps i can take to overcome this or what possible errors u suspect ?

thank you

Reply to
abhay

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.