Multi-slave SPI

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Hildy
Posts: 8
Joined: Wed May 01, 2013 12:55 pm

Multi-slave SPI

Post by Hildy »

In SPIConfig, there is a field for CS port and line, which is saved for later use with spiSelect(). This works well with a single slave, but if I want to use SPI as a bus (with one CS line per slave and the other lines shared) I'm not sure how to stop spiSelect() from asserting the same one each time.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Multi-slave SPI

Post by Giovanni »

Hi,

Just define multiple configuration structures, each one defining its own CS and communication parameters, then use spiStart() to switch among configurations, you don't need to perform a spiStop(), just spiStart().

Giovanni
Hildy
Posts: 8
Joined: Wed May 01, 2013 12:55 pm

Re: Multi-slave SPI

Post by Hildy »

Thanks for getting back to me so quick!

Is there any way to use SPI0 on the LPC2148? The lld code seems to be written for the SSP (ie SPI1).
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Multi-slave SPI

Post by Giovanni »

Hi,

It is written for the SSP only, use the SPI should be possible but would require a rework in the driver.

Giovanni
Post Reply