bilbolodz
Posts: 2
Joined: Fri Mar 17, 2017 12:40 pm

RPI3 - usingo only SPI0 (not SPI1)

Fri Mar 17, 2017 12:51 pm

Hello,

I've question: is it possible to enable only SPI0 and leave SPI1 pins for "normal" GPIO use?

dtparam=spi=on

turn on BOTH SPI.
In my preject I've to use:
- I2C
- SPI (one device)
- serial (to connect to RS485)
- BT - if it's possible (I've read that there are problems with enabled: SPI, serial and BT same time.

Any comments?

Best regards

Piotr

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1260
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: RPI3 - usingo only SPI0 (not SPI1)

Fri Mar 17, 2017 1:13 pm

I think you mean spi0.0 and spi0.1 - spi1 and spi2 remain disabled without an overlay to enable them.

If you wanted to stop spi0 from using CS1 (CE1), i.e. spi0.1, you would have to use a device tree overlay to reduce the pin usage - something like this:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	fragment@0 {
		target = <&spi0_cs_pins>;
		frag0: __overlay__ {
			brcm,pins = <8>;
		};
	};

	fragment@1 {
		target = <&spi0>;
		frag1: __overlay__ {
			cs-gpios = <&gpio 8 1>;
			status = "okay";
		};
	};
};
Save this to a file - "spi0-no-cs1-overlay.dts" - then compile and install it with:

Code: Select all

dtc -@ -I dts -O dtb -o spi0-no-cs1.dtbo spi0-no-cs1-overlay.dts
sudo cp spi0-no-cs1.dtbo /boot/overlays
Use it by adding "dtoverlay=spi0-no-cs1" to config.txt.

The SPI + ttyS0 problems should only exist for spi1 and spi2 - spi0 has a dedicated interrupt line.

bilbolodz
Posts: 2
Joined: Fri Mar 17, 2017 12:40 pm

Re: RPI3 - usingo only SPI0 (not SPI1)

Sat Mar 18, 2017 9:22 am

PhilE wrote:I think you mean spi0.0 and spi0.1 - spi1 and spi2 remain disabled without an overlay to enable them.
Thank you for an answer. I've thought that

Code: Select all

dtparam=spi=on
enable ALL SPI interfaces. I will try with your solution to release unused CS pins.

Piotr

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 1 guest