# IC to use for multiplexing SPI chip select

I have a number of SPI ICs but limited GPIOs on my microcontroller, so want to multiplex the CS pins to something that requires only a couple of GPIOs. I use the predetermined clock, MISO and MOSI on the microcontroller.

My initial thought was a ring counter, but all the ones I have found set a single pin to high and the rest low. I need a single low and the rest high. I could use a shift register, but seems like overkill. What is the best IC to use for this application?

• here's an app note showing 3/4 gpio (plus latch) to 8/16 chip-select lines, with 74hc logic // i2c devices also a nice option Jan 27 at 19:42
• So, how many slaves there are, and how many GPIO pins you have available? Jan 27 at 20:03

• @MarcusMüller oh, I know. Iirc F0s go as low as 0.5$, definitely below 1$. I once did something similar, using bitbanged SWD to use one STM32 to program another by writing directly to the flash controller registers. That's quite a bit of code and has a bit of overhead over regular SPI iirc Jan 28 at 8:39