- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to connect more than 4 slaves devices to my master SPI Psoc4.
I know that for UDB SPI there is some information on datasheet about digital demultiplexer and control register
but I want to know how do that with a SCB SPI component
My issue so far, I do not know how connect the control reg and the demultiplexer (in the top design, i can only connect into one select input of the demux)
Maybe somebody can have some code
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Thomas_Billiou
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
Perform transaction
SPI_SS0_Write(1); //De-select SS0
SPI_SS1_Write(0); //Select SS1
Perform transaction
SPI_SS1_Write(1); //De-select SS1
SPI_SS2_Write(0); //Select SS2
Perform transaction
SPI_SS2_Write(1); //De-select SS2
etc..
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ThBi_3905606,
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
etc..
Let us know if this helps.
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bragadeesh,
thank for your answer, but I need to connect more than 4 slaves. I need to connect 5, 6 or 8 slaves
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Thomas_Billiou
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
Perform transaction
SPI_SS0_Write(1); //De-select SS0
SPI_SS1_Write(0); //Select SS1
Perform transaction
SPI_SS1_Write(1); //De-select SS1
SPI_SS2_Write(0); //Select SS2
Perform transaction
SPI_SS2_Write(1); //De-select SS2
etc..
Regards,
Bragadeesh
Bragadeesh