4

I am trying to use SPI interface on Raspberry Pi 1 B (OS: Raspbian July 2017, kerenl 4.9.5). To do this, I am using wiringPi. I confirmed that wiringPi works via gpio readall

To load SPI:

gpio load spi

But this gives me an error:

gpio: Unable to load/unload modules as this Pi has the device tree enabled.
  You need to run the raspi-config program (as root) and select the
  modules (SPI or I2C) that you wish to load/unload there and reboot.
  There is more information here:
      https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97314

Strangely, spidev exists is under /dev (Does it mean SPI is loaded?)

ls /dev/spi*
/dev/spidev0.0  /dev/spidev0.1

Anyway, to fix the problem, the link in the error message tells me to:

  1. Run [sudo] raspi-config and enable SPI: I did it and reboot Rpi
    • Did it, but didn't solve the problem.
  2. If (1) did not work, edit /boot/config.txt and add dtparam=spi=on.
    • Did it, but didn't solve the problem.

And the official device tree document says one can disable device tree by editing /boot/config.txt to have

device_tree=

But when it is done and reboot, only Rainbow splash appears and boot process never go further.

Can anyone give me an advice what I am missing?

4

I doubt you can disable device tree anymore, that was intended to be a temporary directive to smooth the introduction of device tree.

Just add the device tree SPI entry. Do not use gpio load spi. That is deprecated.

As long as there /dev/spidev* entries you can use SPI.

To summarise

  1. remove device_tree= from /boot/config.txt
  2. add dtparam=spi=on to /boot/config.txt
  3. do not use gpio load spi
  • Ok, then seems I did something wrong elsewhere. Thank you. – Jeon Aug 5 '17 at 6:28

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.