From 71ab3309adc963c3825bbbeef778d9376f1e7cad Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 24 Nov 2020 20:36:16 +0300 Subject: [PATCH] Adjusting SPI doc for older Raspberry Pi OS version (#1304) * Adjusting SPI doc for older Raspberry Pi OS version --- Documentation/raspi-spi.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/raspi-spi.md b/Documentation/raspi-spi.md index 5c042202ff..5aba4b955c 100644 --- a/Documentation/raspi-spi.md +++ b/Documentation/raspi-spi.md @@ -72,7 +72,7 @@ This will enable SPI0 where those are the pins which will be selected, only Soft ## Enabling any SPI with any Chip Select -In order to activate Chip Select, you'll need to add a specific dtoverlay on the `/boot/config.txt` file. If you've used the previous way of activating SPI0, you should not comment the line `dtparam=spi=on` and add what follows using the `dtoverlay`configurations. +In order to activate Chip Select, you'll need to add a specific dtoverlay on the `/boot/config.txt` file. If you've used the previous way of activating SPI0, you should comment the line `dtparam=spi=on` and add what follows using the `dtoverlay`configurations. Here is the table with the different options for SP0 and SP1 (please refer to the [Raspberry Pi documentation](https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/) to activate other SPI) @@ -99,6 +99,18 @@ dtoverlay=spi0-1cs,cs0_pin=27,no_miso There is only for SPI0 that you can use, in both cases with 1 or 2 Chip Select pin the `no_miso`option. +**Important note**: Those overlays are only supported in the very last Raspberry Pi OS. You will get the `System.IO.IOException: Error 2. Can not open SPI device file '/dev/spidev0.0'` error message if you are using them on an older version. You can use `spi0-cs` where in the previous examples you had `spi0-2cs` or `spi0-1cs`. + +As an alternative, you can as well use the following command line: `sudo raspi-config nonint do_spi 0 ` + +So the first example will now give: + +```text +dtoverlay=spi0-cs,cs0_pin=27,cs1_pin=22 +``` + +In older version, no_miso is not supported neither. And you will always get 2 chip select activated and you don't have a way to only select one. + # SPI1 to SPI6 The following dtoverlay definition can be [found here](https://github.com/raspberrypi/linux/blob/04c8e47067d4873c584395e5cb260b4f170a99ea/arch/arm/boot/dts/overlays/README#L1167).