0

In the majority of Pi SPI documentation, it makes reference to the fact that 2 SPI chip select channels exist.

However, from my previous experiencing with the Raspberry Pi and other microcontrollers, SPI comms can be implemented using GPIO as chip select lines.

My question: Why does Pi documentation state there are two chip select lines? What's special about these digital outputs? Are they coupled directly to the SPI controller?

3
  • Nothing, it's the driver which automatically handles the chip select lines as soon you access the configured devices. If you used a GPIO, you had to do that by hand. Or patch the kernel.
    – Janka
    Commented Mar 11, 2018 at 18:06
  • I'm just confused why they felt the need to specify only two channels then. Why not just say nothing and let any GPIO be configured?
    – Izzo
    Commented Mar 11, 2018 at 18:11
  • @Janka Why not make that an answer? The main SPI hardware has two preset chip selects. The auxiliary SPI hardware has three preset chip selects. You could always ignore the presets and use your own GPIO, but you would have to switch them yourself. The hardware automatically switches the presets. The current Linux driver makes no use of this anyhow. It switches the chip selects manually.
    – joan
    Commented Mar 11, 2018 at 19:32

1 Answer 1

4

The main SPI hardware has two preset chip selects.

The auxiliary SPI hardware has three preset chip selects.

You can ignore the presets and use your own GPIO, but you will have to switch them yourself. The hardware automatically switches the presets.

The current Linux driver makes no use of this anyhow. It switches the chip selects manually. You can tell by examining the mode of the chosen chip selects. At one time they would have been in mode ALT0 (SPI mode). Now they will be in mode OUTPUT.

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.