Multiple devices on a single SPI bus

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

User avatar
part1zan_
Posts: 44
Joined: Sun Sep 08, 2013 9:04 pm
Location: Saint Petersburg, Russia

Multiple devices on a single SPI bus

Postby part1zan_ » Thu Feb 27, 2014 9:17 pm

What's the most common and convenient way of using two or more SPI devices on a single SPI bus? The point is that I can use the same MISO/MOSI/SCK pins, and the only thing that really differs is the CS (ChibSelect) pin.
I see only one: reconfigure SPI (spiStart) with the appropriate ChipSelect pin every time I use another device. That sounds kludgy, doesn't that? Are there other ways of doing that? Maybe, some statements in spiConfig?

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Multiple devices on a single SPI bus

Postby Giovanni » Thu Feb 27, 2014 9:23 pm

The mode is to do spiStart() each time you need to address a different device. The internal code path is quite simple.

If all devices have the same settings (CPOL, CPHA, speed etc) then you can simply use PAL functions to control CS lines without need to reconfigure.

Giovanni


Return to “General Support”

Who is online

Users browsing this forum: Google [Bot] and 3 guests