Page 1 of 1

Multi-slave SPI

Posted: Wed May 01, 2013 1:11 pm
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.

Re: Multi-slave SPI

Posted: Wed May 01, 2013 1:20 pm
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

Re: Multi-slave SPI

Posted: Wed May 01, 2013 1:46 pm
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).

Re: Multi-slave SPI

Posted: Wed May 01, 2013 2:11 pm
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