SPI cs pin question

Hello

I am trying to use spi for 2 sensors.

I want to use mosi, miso, and sck in common and use only cs separately.
If one sensor is set to spi as shown below, it works normally.

However, if used as below to manage with cs, it does not work.

Are there other ways to use it?

Thank you

Parents
  • Hi,

    As you have two slaves connected to the same bus you need to control the two CS pins yourself. That means configuring them as outputs, and asserting before using a device, waiting some time (the datasheet of the slave should indicate how long), and then start communicating with it, and dessert when done. Also, make sure you never assert both CS pins at the same time.

    If you still don't make any progress, then it would be good to see what you are doing, and to know what actually happens on the SPI lines (including two two CS lines).

Reply
  • Hi,

    As you have two slaves connected to the same bus you need to control the two CS pins yourself. That means configuring them as outputs, and asserting before using a device, waiting some time (the datasheet of the slave should indicate how long), and then start communicating with it, and dessert when done. Also, make sure you never assert both CS pins at the same time.

    If you still don't make any progress, then it would be good to see what you are doing, and to know what actually happens on the SPI lines (including two two CS lines).

Children
Related