1

I am working on a project where Arduino is communicating with two devices using SPI. Unfortunately, these two devices has no ss(slave select) pin to communicate with each one separately.

How Can I solve this issue?

Sensor example

Thanks

  • Then, they are really not SPI devices. Are you sure they are not I2C where different devices have different addresses? More information like part numbers would help here. – st2000 Dec 18 '16 at 14:55
  • No, They are using SPI serial interface – Mostafa Khattab Dec 18 '16 at 14:57
  • I just edited it to show example of SPI examples I mean – Mostafa Khattab Dec 18 '16 at 14:59
1

Ss or cs pin ISS not mandatory for SPI.

A few solutions.

  1. Power on or off the devices. A group pin can do that.

  2. Cut off mclk.

  3. Have a separate sclk pins for individual chips. You will need to share the serial data pins, ored with some diodes or pull up.

  4. Software SPI.

...

I'm sure others will come up with more solutions.

0

Looking at the MS5540C specifications and assuming there are no other significant parts on the PCB you identified, there does not appear to be a SPI port available.

Neither "SPI" not "I2C" appear in the document. Please check your self to verify.

Instead there is a section on serial communication with the MS5540C part its self. In this section there are a number of diagrams. Here is one:

enter image description here

In the text we find this:

Every communication starts with an instruction sequence at pin DIN. Fig. 6 shows the timing diagrams for the MS5540C.

Which is very nearly if not exactly how I2C works.

The text goes on to say:

he device does not need a ‘Chip select’ signal. Instead there is a START sequence (3-Bit high) before each SETUP sequence and STOP sequence (3-Bit low) after each SETUP sequence. The SETUP sequence consists in 4-Bit that select a reading of pressure, temperature or calibration data. In case of pressure- (D1) or temperature- (D2) reading the module acknowledges the start of a conversion by a low to high transition at pin DOUT during the last bit of the STOP sequence.

Unfortunately, this design appears to prohibit using more than one identical device on the same serial bus.

Workarounds to this design flaw (if it truly exists) include blocking the SCLK or the DIN signal to the un-selected MS5540C.

In many other cases where multiple identical I2C devices are used on the same bus, vendors provide a pin on the device which can be used to alter the address of an individual device.

  • They also use 15 bit words, which I'm not even sure the Arduinos SPI supports. I'd just bitbang the protocol, and use different pins for the two sensors. – Gerben Dec 18 '16 at 18:44
  • Sounds like a plan. But again, it does not look like a SPI bus device. I know the web page you linked to / bought the device from lists SPI. But I believe this to be in error. The Chip Select or Slave Select line on a SPI bus is necessary! It is the only way for the slave and master SPI devices to synchronize. With out this line, if either device looses sync, they will never be able to talk to one another with out being power cycled. – st2000 Dec 18 '16 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.