SPI and in-series resistance? - Page 1
Forum section: electronics / beginners

author: ok_cool
author_rank: Contributor
timestamp: November 05, 2015, 11:59:47 am
content: I have multi-master SPI and I need to isolate some parts (between two masters) so can I do it simply with some in-series resistance between them? Or does SPI protocol say something about if there should or should not be resistance in series? Thanks

author: rs20
author_rank: Super Contributor
timestamp: November 05, 2015, 12:11:38 pm
content: Why do you need to isolate them/what do you mean by "isolate"?The "SPI protocol" doesn't have any comment about the resistance of the connections. However, and given SPI peripheral or host will have a datasheet that explains the voltages, rise and fall times, and delays required for the device to be guaranteed to operate correctly. As long as you design your circuits to stick to these contracts, it'll work fine. Stay aware of RC filters that may be created by the resistors you add and the parasitic capacitance of the SPI device pins & PCB.

author: 0xdeadbeef
author_rank: Super Contributor
timestamp: November 05, 2015, 12:24:38 pm
content: Are you trying to communicate with the same slave(s) from two masters? I don't think this is possible without major SW overhead. No SPI peripheral I know would support this.Or what exactly do you want to isolate"?

author: Ian.M
author_rank: Super Contributor
timestamp: November 05, 2015, 12:46:33 pm
content: The masters need to have a failsafe method of knowing which one is in charge of the bus - probably by direct handshake signals. Both masters have to be capable of tristating MOSI, SCLK and all /CS lines so the inactive master can free the bus. To transfer control, the inactive master must signal the active master to request the bus. The active master completes any current frame, and any subsequent frames required to reach a safe place to stop then grants control of the bus.During development, series resistors of Vdd/(2*Io_max) ohms in each master output line are helpful to limit the current to less than the master MCU's abs max output pin limit if there is a software bug that causes a bus conflict.If one of the masters has firmware that isn't under your control, its exponentially harder, is likely to require external tristate buffers, and you may be FUBARed if you cant stop the clock or otherwise pause or halt the master you dont have full control of.

author: ok_cool
author_rank: Contributor
timestamp: November 05, 2015, 12:47:25 pm
content: Quote from: rs20 on November 05, 2015, 12:11:38 pmThat's what I was afraid of, so I need to look into that.The topology is like this:SUPERMASTER, MASTER1, MASTER2 can all act as masters. But MASTER1 and MASTER2 can also act as slaves for the SUPERMASTER.So by isolation I meant those resistors which, if I have understood things correctly, would allow me to have some separation between these two parts of the circuit, and enable both to operate concurrently, because one could always override the other.If SUPERMASTER pulls the line low, it would connect it to GND and current leaking through resistor would be sunken? And line would go low, but not on the other side. Same for vice versa. MASTER2 could drive line as it wished, even if SUPERMASTER wanted otherwise.

author: Ian.M
author_rank: Super Contributor
timestamp: November 05, 2015, 12:56:17 pm
content: You cant swap between master and slave mode without rearranging the wiring. The data output pin on a master is connected to the input pins on all the slaves and visa versa. If you swap a device between being master and slave you also need to swap over its MOSI and MISO pins.

author: ok_cool
author_rank: Contributor
timestamp: November 05, 2015, 01:10:39 pm
content: Quote from: Ian.M on November 05, 2015, 12:56:17 pmBut doesn't this mean that slave here can become master, and not obviously talk back to the master, but without re-wiring, can talk to slave of its own?

author: Ian.M
author_rank: Super Contributor
timestamp: November 05, 2015, 02:21:13 pm
content: Quote from: ok_cool on November 05, 2015, 01:10:39 pmYes. I was totally wrong. Its even OK with some dumb slaves on the same bus. However you do need to reverse the direction of /CS lines between A and B when they swap over, and would need to AND the /CS lines from the two masters to any slave only device /CS pin.

author: Kalvin
author_rank: Super Contributor
timestamp: November 05, 2015, 02:28:28 pm
content: Open-drain drive with a pullup resistor for each signal may solve the issue. You need the arbitration anyway.