1

I would like to ask what GPIO pins are best suited for Chip select. The Raspberry Pi 3B+ and Raspberry Pi 4 has 2 chip select GPIO 7 and GPIO 8 but i have 6 slave devices (MCP3008 A/D converter). As far as im aware it possible to use ordinary GPIO as chip select.

My Pis have not arrived yet from order, and in the meantime i have started to design my pcb. Which led me to the delima of what are the best GPIOs for SPI chip select that will give me the least trouble coding later on

1 Answer 1

2

Unless special consideration - not yet mentioned in the question - apply, I'd say: worry not, pick any pin that is free (i.e. not to be used otherwise, such as I2C or 1-wire if you chose to use those interfaces too). Check for the special function of GPIO pins e.g. here. I would pick pins to simplify pcb routing if possible.

If using a library to control the GPIO that allows for a banked access of multiple pins, such as pigpio, that is "reading/writing all of the GPIO in a bank as one operation" it is advisable to pick pins in one bank. Luckily for all the Pi's so far (beside the Compute Module) all accesible pins are in bank 1.


An alternative to reduce the number of GPIO pins used (if that is a worry) is a 3-Line To 8-Line Decoder/Demultiplexer such as the 74HC138. It selects one of 8 outputs based on the value of three inputs. The HC series has a wide Operating Voltage Range (2 V to 6 V) that will play well with the Pi without further ado.

5
  • what may this special considerations might be sir? I am might be using a POE hat to reduce my wiring, im sure that i read somewhere that it uses SPI or I2C for the fan, but cant find it anywhere now
    – Jack
    Commented Oct 3, 2019 at 19:35
  • @Jack seems that you got me there ;-) The PoE hat uses (I2C)[raspberrypi.org/products/poe-hat/] so I'd pick pins that are not going to be used otherwise, you should be good.
    – Ghanima
    Commented Oct 3, 2019 at 19:41
  • 1
    @Ghanima Perhaps look at pinout.xyz and choose GPIO/pins which don't have a "special" function in brackets.
    – joan
    Commented Oct 3, 2019 at 19:43
  • @joan yeah, I did look (and do look there all the time)... but it is sure a good idea to include that in the answer :)
    – Ghanima
    Commented Oct 3, 2019 at 19:44
  • Oh this is a nice site , i find myself keep on googling Rpi pins. Bookmarked it.
    – Jack
    Commented Oct 3, 2019 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.