4 years, 4 months ago.

Can two devices work on same SPI Pins?

Hi everyone, I want to use one of Mbed SPI communication bus to work two different SPI devices. My aim is to control two different devices (which use SPI interface to communicate) by using same SPI bus. For example, one device is Programmable Gain Amplifier and the other one is Analog to Digital Converter. If i connect them on same SPI bus (Mbed pin 11, pin 12, pin13), Can they work normally? You assume pin14 is for Chip Select of ADC, and pin 15 is for Chip Select of PGA. You can see the attachment what i want to do. However i am not sure that design is correct or incorrect. Can anyone verify or make a comment with that design?

Also i wonder that, if i use each SPI connection for each device, do they work by parallel without any effect of each other? I mean, while working ADC on its own SPI bus ( Mbed pin 11,12,13) without any interrupt, if i set PGA gain by sending command over second SPI (Mbed pin 5, 6, 7), does ADC miss any data? /media/uploads/cybercem/pga280_with_ads1259.png

Best Regards,

Cem

Comment on this question

1 Answer

4 years, 4 months ago.

You are correct in wiring the SPI bus in parallel with independent device select lines. You need to make sure in software that you only select one device at a time, and only the selected device will recognize and work with the SPI signals and SCLK.

In answer to missing data from the ADC, when changing gain or accessing the PGA, is that the ADC should have a buffer of at least one conversion, which should be valid at least till the next start cycle or the conversion completion. If you don't start the next conversion till you are done with the PGA adjustment you should be OK.