I do not know device tree well and good. I have enabled spi through sudo raspi-config and then checked /boot/config.txt which includes dtparam=spi=on.

Then I checked lsmod | grep spi. It shows

spi_bcm2835            7596   0
spidev                 7373   0

Also checked sudo nano /etc/modprobe.d/raspi-blacklist.conf which is blank.

I have read a blog which suggested that spi-dev must include in /etc/modules to load spi. I got i2c-dev rather than that. I read How to make raspbian load the i2c-dev module on boot up also. I noticed some where that suggested not to load both of spi and i2c at the same time. That's why I have commented i2c-dev at /etc/modules and added spi-dev. Then there is an error like that says unable to load module spi-dev.


From spi-dev and spidev which one should I added to /etc/modules?

Somebody please help me if you got any useful tutorial about spi for beginners.


For more about the problem please a look at How to check whether SPI working or not?


spi mode: 0
bits per word: 8
max speed: 80000 Hz (80 KHz)

00 00 00 00 00 00 
00 00 00 00 00 0C 
00 0C 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00

The above output is generated for ./spidev_test -D /dev/spidev0.0 -s 80000. Is this working (look there are two 0C & sometimes all are 00)?

  • I don't know of any problem with loading SPI and I2C at the same time and all that needs to be done is enabling them through sudo raspi-config. You may want to mention that you are doing some kind of custom system, as this would explain why you are having these issues. The regular system works - your modifications don''t your problems with this are all of your own making. – Steve Robillard Jul 17 '17 at 17:32

To enable SPI just add the line dtparam=spi=on to /boot/config.txt. Nothing else is required.

You should see the SPI devices in /dev after boot (try ls /dev/spi*).

I2C needs a similar device tree entry in /boot/config.txt AND the line i2c-dev in /etc/modules.

There is no problem in loading and using I2C and SPI at the same time. They use different GPIO.

  • I got spidev0.0 & spidev0.1 as before. But the output of spi is 00. According to brianhensley.net/2012/07/… device is not working. What do you think? @joan – testuser Jul 17 '17 at 22:50
  • @Johir I think you are not reading/writing the device properly. Start a new question and give a code listing and a photo of your connections. – joan Jul 18 '17 at 7:54

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.