Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
SPI Question

 
Post new topic   Reply to topic    Forum Index -> General
Author Message
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

Posted: 20 April 2007, 17:51 PM    Post subject: SPI Question Reply with quote

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 Reply with quote

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 Reply with quote

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: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> General Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group