natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

8 spi slaves

Tue Jul 10, 2018 9:07 am

Hello

Its possible to connect 8 spi slaves to a rpi3?

I want to connect 8 ENC28J60 Ethernet modules, i have read here https://github.com/raspberrypi/firmware ... ays/README and if i understand correctly its only possible to have 6 devices max... but im not sure if i understood correctly

User avatar
thagrol
Posts: 1980
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: 8 spi slaves

Tue Jul 10, 2018 7:22 pm

natxo wrote:
Tue Jul 10, 2018 9:07 am
Hello

Its possible to connect 8 spi slaves to a rpi3?

I want to connect 8 ENC28J60 Ethernet modules, i have read here https://github.com/raspberrypi/firmware ... ays/README and if i understand correctly its only possible to have 6 devices max... but im not sure if i understood correctly
I remember reading an article online somewhere (this forum?) that suggested a hacky way to achieve this. Basically, use N gpio pins (where N=number of spi devices), do not connect anything to the hardware SPI chip select lines then make all your SPI calls to CS0 but before doing so manually set the required GPIO pin.

The theory was that the hardware and SPI driver will try to address whatever device is on the CS0 line but the device you've manually selected will be the one that responds.

I guess in terms of devicetree overlays (not sure if the above predates device tree) you'd want to use the one with fewest CS lines in order to minimise lost pins.

Disclaimer: I don't use SPI and haven't tried this.
Attempts to contact me outside of thes forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

Return to “Interfacing (DSI, CSI, I2C, etc.)”