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?
Multiple devices on a single SPI bus
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Multiple devices on a single SPI bus
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
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