|
|
| Author |
Message |
victorf
Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York
|
|
Posted: 20 April 2007, 17:51 PM Post subject: SPI Question |
|
|
I am designing an app which will incorporate two devices, each with a SPI interface. Each device has a chip select.
Can I hang both of these devices on the SPI buss and not cause a problem when I want to read from one or the other of them. Just select (assert CS) on the device and read it? I have never used the SPI interface before.
Any enlightenment will be appreciated.
Vic |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 21 April 2007, 3:49 AM Post subject: Re: SPI Question |
|
|
| victorf wrote: | | Just select (assert CS) on the device and read it? I have never used the SPI interface before. |
The chip select is asserted automatically by SPICmd() using the CS pin specified in the OpenSPI() call. You can have several devices attached to the SPI bus - you just need to call OpenSPI() each time you want to communicate with a different SPI device prior to invoking SPICmd(). |
|
| Back to top |
|
 |
mwf
Joined: 06 Oct 2006
Posts: 27
Location: Boulder, CO
|
|
Posted: 21 April 2007, 16:19 PM Post subject: Caution |
|
|
Some devices that claim "SPI" compatibility do not tristate the MISO line and/or ignore data when CS is not asserted. If you have trouble, like a dead system when you hook up the devices or a device that doesn't work right, read the datasheet carefully to make sure that the device really conforms to SPI. If not, a section or two of a 74HC125 will fix the incompatibility.
Also, hook up the devices one at a time and get them to work before you hook them all up at once. This makes it much easier to diagnose a problem. |
|
| Back to top |
|
 |
spamiam
Joined: 13 Nov 2005
Posts: 689
|
|
Posted: 21 April 2007, 21:20 PM Post subject: |
|
|
Also, some devices can not lose CS in the middle of a lengthy transaction. SD cards are one example. Some extra logic (as discussed in the SD card threads) may be necessary so that the external device CS can be maintained to the end device, but the data lines are deactivated when ZX's CS signal is de-asserted.
-Tony |
|
| Back to top |
|
 |
|