On Sunday, 16 August 2020 12:46:53 BST Ralph Corderoy wrote: > I'd assume reset and data/command are gated as inputs to each SPI device > on the bus by the chip-select line so D/C doesn't need switching to each > device, just CS. But I'd examine the data-sheet of the SPI device in > question to seek confirmation.
Yes. I'm looking in to this. > https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md > says > > The Raspberry Pi is equipped with one SPI bus that has 2 chip > selects. > > so I'm assuming there's not another SPI bus which isn't normally enabled > or allocated pins. > > But that seems to contradict with https://pinout.xyz/pinout/spi which > shows > > SPI0: SCLK MOSI MISO CE0 CE1 > SPI1: SCLK MOSI MISO CE0 CE1 CE2 > > as if there's two buses with three chip-select lines on the second one. > Perhaps I'm misunderstanding the diagram. If you are, then it's the same misunderstanding that I had. > Could you demux outputs from the Pi to give more chip-selects lines, > e.g. four GPIOs could drive one of 2⁴=16 CS lines. > https://en.wikipedia.org/wiki/Demux#Digital_demultiplexers > It's the demux's outputs which fan off as CS to each SPI device. > Meanwhile, they all get SCLK, MOSI, RST and D/C straight from the Pi. > You could leave the software thinking there was only one SPI device and > drive the demuxer yourself just before each run of SPI-writing for a > device. If they were different speed devices then you'd have to change > the bus speed too. That's a very good idea (now why did I not think of that? :-) ). I'll look into it. We can easily do that on a piece of Veroboard and it has the advantage that the standard library will still work; I just have to assert the extra GPIO pin to toggelt the right CS pin. > No idea if it would work. This is a hardware problem. :-) I'm pretty sure it would. I'll pass it on to my co-volunteer who asked me to look into this. He was a hardware engineer before he became a company director. > It seems it is possible. > https://forum.pjrc.com/threads/34666-16-SPI-devices-Is-it-possible > An I²C port expander to drive 16 CS is an alternative to the 4-to-16 > demux. I'll see what the expert thinks :-) -- Terry Coles -- Next meeting: Online, Jitsi, Tuesday, 2020-09-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk