Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] daisy-chain multiple SPI devices

Status
Not open for further replies.

Kittu20

Member level 2
Joined
Oct 18, 2022
Messages
52
Helped
1
Reputation
2
Reaction score
0
Trophy points
6
Activity points
427
Hello Everyone,

I am trying to understand how individual devices work in a daisy-chaining setup. I have looked so many links but I don't get clear idea.

Let's say we have three SPI devices: a temperature sensor, an LCD display, and an EEPROM memory chip, and we want to connect them to a microcontroller using SPI.

We connect the microcontroller's SPI output pins (MOSI - Master Out Slave In, SCK - Serial Clock, and SS - Slave Select) to the first device (temperature sensor).
The output of the first device (MISO - Master In Slave Out) goes to the input of the second device (LCD display).
The output of the LCD display goes to the input of the third device (EEPROM memory chip).


If we want to read data from EEPROM Master would enable CS pin, How master would read data from
EEPROM memory ?

Note : I'm experiencing some difficulties when trying to create and edit threads on our forum, and I was wondering if anyone else has encountered a similar issue. I've noticed that the response time has been quite slow when I attempt to create a new thread or edit an existing one
 
Last edited:

This probably won't work. Daisy chain typically works for multiple devices of same type and has some requirements in the control register and data path design.

Specification of involved devices must be checked in detail.
 

Hi,

You probaly don´t want daisy chaining different devices.
To access different SPI devices use individual CS signals, maybe generated by a 74HC138 or similar.

Daisy chaining of SPI devices makes only sense (in my eyes) when:
* you access equal devices
* devices that belong together.

Example:
4x [8bit shift register] daisy chained to update all 32 channels with one access.

I wonder where you got the idea from to daisy chain different SPI devices at all.

Klaus
 

SPI doesn’t work that way. SPI is a point-to-point interface. And, it's not like JTAG where there's a very specific command structure. The data output of your temperature sensor would have to be matched to the data input expected by your LCD display.

For example, how would you send display data THROUGH a temperature sensor? The temperature sensor would have to know all about the LCD. There would have to be firmware in the temperature sensor that can see a message and know that it was intended for the LCD. The only way this would work would be if you wrote all the communications firmware in each device, and I know that's not the case.

And, yes, I'm having trouble with this site as well.
 

Hello!

As said above, not possible unless it's designed that way. That said, I know some sensors that are precisely
designed that way. The sensor chain is slave, and in this chain, slave n is master of slave n+1, while keeping
a 100% compatibility with regular SPI. And all this without any extra pins.
I can't figure out a way of doing this if it the mechanism doesn't exist in the chip.

Dora.
 

Thank you very much for the clarification. I realize now that I had misunderstood the concept. Your explanation has been incredibly helpful in clearing things up. I appreciate your patience

So, just to confirm my understanding, if we have four equal SPI devices daisy-chained, and we want to read data from the fourth device, here's how it should works:

We select the fourth device by pulling its SS (Slave Select) pin low, and the master generates the clock signal.

The master sends the first byte to the first device, which then passes it to the second device. The second device sends the byte to the third device, and the third device sends it to the fourth device.

At this point, the fourth device receives the data and responds. Afterward, the same reception process occurs in reverse order: the fourth device sends data to the third, the third to the second, the second to the first, and finally, the first device sends the data back to the microcontroller.

If I'm understanding correctly, this way, the microcontroller effectively sends and receives data from the fourth SPI device while passing through the intermediate devices in the daisy chain. Please let me know if my understanding is correct?
 

Hi,

Your daisy chain idea is completely wrong.
I always recommend to take paper and pencil to draw a sketch. If you did, you would have seen that it can't work this way.
Also others recommended to read about SPI operation ... which you apparently did not.
Also you did not read "your SPI device" datasheet.

On the other hand the AnalogDevices document gives some misleading statements / informations.
* in their example they use the LDAC signal, which is no SPI signal at all.
* in figure 1 they completely ignore MISO signals
They state
Devices that are individually addressable, as is usual in I2C systems, communicate easily with a single device on a bus.
* true SPI devices are individually accessable via the CS line.
Why do they refer to "single device"? It wouldn't be a "bus" if it was designed for single device only.
* you can always have multiple (not only a single) SPI device on the bus.
* you also can have multiple devices on a I2C bus
* the used MAX5233 has special features (that usual SPI devices not have) to enable daisy chaining. Usually SPI devices are not daisy chainable this way.
* and so on.

*******************

if we have four equal SPI devices daisy-chained, and we want to read data from the fourth device, here's how it should works:
Usually you don't have SPI devices daisy chained at all. (As said, only rarely devices can)
Usually you connect all MOSI, MISO, SCK in parallel, and all CS (SS) are individual.

In rare situations you may daisy chain devices, but then they need
* to be identical
* to have the MOSI to MISO feed trough (what only a few have)
* one common CS
* all devices are read / updated at the same time

*************
Conclusion:
* SPI is not generally designed for daisy chaining. Thus a general discussion about SPI daisy chaining is useless.
* So if you want to discuss about "special SPI devices" please give a link to the according datasheet.

Klaus
 
Thank you very much for the clarification. I realize now that I had misunderstood the concept. .... Please let me know if my understanding is correct?
As others have said, no it's not right.
If you have 4 different SPI devices, then you can exchange values with them one at a time using the same MCU interface.
What you CAN do is to have the MOSI and SCK signals go to all 4 of them simultaneously (i.e. have them in parallel, not series - and assuming the 'fan out' for the MOSI and SCK signals is sufficient), and connect all of the MISO signals together (assuming the SPI slave devices tri-state their MISO lines when not selected).
Then you can select which of the 4 SPI devices you activate by using its \SS\ (or whatever it is called) line - but only 1 SPI device at a time.
(I know that there are a number of Google 'hits' for daisy chained SPI, but if you read them carefully they are for specific SPI devices that are specifically designed for that purpose and are usually all the same device. It is not the general case for SPI devices.)
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top