4
\$\begingroup\$

If you have a SPI bus with only one device can you connect chip select to ground?

I'm new to electronics, tinkering with a custom split keyboard design. I have a micro controller in the one half and a MCP23S17 IO expanded in the other. I have a five strand cable to connect the two. I think I need MOSI, MISO, SCK, Ground and 5v+. Do I need a dedicated chip select, or can I connect chip select to ground (pulled low?) if the only spi device on the spi bus in the IO expander?

\$\endgroup\$
  • 1
    \$\begingroup\$ is CS used for multiple functions? \$\endgroup\$ – jsotola Jun 16 at 3:34
  • \$\begingroup\$ Not sure exactly what you mean. @pericynthion says the MCP23S17 uses the CS as a framing signal. \$\endgroup\$ – everett1992 Jun 16 at 5:38
5
\$\begingroup\$

Most SPI devices use the CS as a framing signal as well as for bus sharing, so you can't get away with just tying it to GND. From a quick look at the datasheet this appears to be the case for the MCP23S17.

If you need to save pins, consider using the IC's I2C sibling MCP23017. If you need to save pins and absolutely must use the MCP23S17, you could probably contrive some circuit to set CS high (i.e. deasserted) when SCLK has been idle for a few microseconds at the end of a transaction. That would be a pretty ugly hack though, and it would be difficult not to violate timing requirements on the other end when it needs to assert CS at the start of the next transaction.

\$\endgroup\$
  • \$\begingroup\$ What would happen if I connected Ground and CS on the MCP to my controllers CS output? \$\endgroup\$ – everett1992 Jun 16 at 5:51
  • 1
    \$\begingroup\$ If you did that, you'd violate the MCP's abs max spec any time MOSI or SCK were low and CS/"GND" were high. Even if you could contrive for that never to happen, the MCP's internal state would be invalid when CS/"GND" went high - I doubt you could do anything useful with it wired like that. \$\endgroup\$ – pericynthion Jun 16 at 5:56
  • \$\begingroup\$ Sounds like I'll have to switch to a 6 line cable to connect the two halves. Thanks for your time \$\endgroup\$ – everett1992 Jun 16 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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