1. Set no of slave selects to 4 in SPI component
2. Connect them to appropriate pins in the pins tabs of DWR.
3. All the 4 slaves will share the same MISO, MOSI and SCLK. Each slave will have separate SS line from master.
4. Use the API SPI_SpiSetActiveSlaveSelect(uint32 slaveSelect) to select which line is asserted for the transfer you are going to make. See component datasheet for details. For example
SCB_SpiSetActiveSlaveSelect(0); //Select SS0
Perform SPI transaction to Slave 0
SCB_SpiSetActiveSlaveSelect(0); //Select SS1
Perform SPI transaction to Slave 1
Let us know if this helps.
thank for your answer, but I need to connect more than 4 slaves. I need to connect 5, 6 or 8 slaves
Sorry, I did not read the question correctly. The SPI hardware supports only 4 SS lines. If you want to use more than 4 slaves, you can go for software controlled SS lines.
SPI_SS0_Write(0); //Select SS0
SPI_SS0_Write(1); //De-select SS0
SPI_SS1_Write(0); //Select SS1
SPI_SS1_Write(1); //De-select SS1
SPI_SS2_Write(0); //Select SS2
SPI_SS2_Write(1); //De-select SS2