cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor II

Hi All,

I need to connect more than 4 slaves devices to my master SPI Psoc5LP. for that I am planning to use digital Demux/mux and control register something like the attached snapshot.

I have not much idea how to implement control reg and the Mux/Demux. Is there any example that is using Digital Multiplexer/Demultiplexer ?  please share any Example code. 

And other major issue I am facing is that  my one of the SPI component is SD card that is using EMFile Component library. so for EMfile component How I can play with EMfile Component SPI CS(chip select) pin to activate this SD card whenever is required ? because for EMfile all things are defined internally inside the Emfile component library.

Please suggest how I can Activate EMFILe SD card using Demux/mux whenever is required?Untitled.png

  Thanks

0 Likes
Reply
2 Replies
Contributor II

Hello.

When the SPI Master component is put into schematic, right-click on it and select Configure.  In bottom corner of newly opened window will have link to the SPI Master datasheet.  Look here to see how to control 4 SPI slave devices.  You can expand the examples to add more than 4 SPI slave devices.  Basically, it's only the Slave Select (SS) signal that needs to be controlled.  All other signals are tied together as shown in the examples.

So, only the SS signals need a demux (no mux).  The second example would work best for your application.  Your s/w sets the Control register to control the demux for the SS you want, then let SPI component control SS.

Good luck with your project.

Honored Contributor

AbPa,

How many SPI Masters do you need for your project?

If only one Master, then you don't need the the Demux or Mux for the SPI_CLK, SPI_MOSI or SPI_MISO signals.

As indicated, the SPI Master component can directly control up to 4 Slave SSs with the API.   However since the SS signals are just GPIO,  you can create your own SS control manually in the code.

If more than one, then is it necessary to have all SPI slaves on the same SPI bus? 

If you need multiple Masters, then it might be best for each Master to have their own SPI bus to the respective Slaves to which they communicate. (Significantly simpler from a coding standpoint.)

As to the emFile system use of SPI ...


And other major issue I am facing is that  my one of the SPI component is SD card that is using EMFile Component library. so for EMfile component How I can play with EMfile Component SPI CS(chip select) pin to activate this SD card whenever is required ? because for EMfile all things are defined internally inside the Emfile component library.

Please suggest how I can Activate EMFILe SD card using Demux/mux whenever is required?

 

No matter how you answered my two questions above, I recommend the SD Card be on a separate SPI Master and SPI bus.

As you noted, the SPI Master is automatically allocated and controlled by the emFile library SW.  Because of this and the emFile SW uses it's own caching techniques, it is almost impossible to predict when the SPI is needed for the SD Card.   Trying to share this SPI with other Slaves would be a significant challenge.

Len

Len
Engineering is an Art. The Art of Compromise."