cobey
Posts: 7
Joined: Sun Nov 10, 2013 3:26 pm

SPI devices not appearing in /dev

Sat Apr 12, 2014 6:28 am

Hello,
I am not seeing "spi0.0" and/or "spi0.1" in the "/dev" directory after loading the SPI modules. From lsmod, I see:

Code: Select all

# lsmod
Module                  Size  Used by    Tainted: G
spidev                  4936  0
spi_bcm2708             4589  0
However, "ls /dev" does not list any spi devices. I'm running linux version rpi-3.8.y (3.8.13) for use with xenomai patch. Any help would be most appreciated.

Thanks,
Cobey

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SPI devices not appearing in /dev

Sat Apr 12, 2014 7:51 am

There was an old firmware bug that caused this.

sudo apt-get install rpi-update
sudo rpi-update
sudo reboot

Should fix it.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

cobey
Posts: 7
Joined: Sun Nov 10, 2013 3:26 pm

Re: SPI devices not appearing in /dev

Sun Apr 13, 2014 2:30 am

DougieLawson,
Thanks for the reply. Good to know about the old firmware bug. I just did a rebuild using the latest rpi-firmware and userland, but SPI is still not showing up in /dev. :(

-Cobey

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: SPI devices not appearing in /dev

Sun Apr 13, 2014 3:31 am

Hi,
cobey wrote:SPI is still not showing up in /dev.
Have you enabled SPI ?

If not, then:

Code: Select all

sudo nano /etc/modprobe.d/raspi-blacklist.conf
Comment-out (add '#') in line:

Code: Select all

#blacklist spi-bcm2708
.. and reboot.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

cobey
Posts: 7
Joined: Sun Nov 10, 2013 3:26 pm

Re: SPI devices not appearing in /dev

Sun Apr 13, 2014 4:28 am

Hi Ivan,
Thanks for the advice.
FLYFISH TECHNOLOGIES wrote: Have you enabled SPI ?
Yes, I believe so. I don't see "raspi-blacklist.config" file and I am able to load "spi-bcm2708" and "spidev" modules.

Thanks,
Cobey

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: SPI devices not appearing in /dev

Sun Apr 13, 2014 5:31 am

if you do a lsmod you should have something like this:

Code: Select all

# lsmod
Module                  Size  Used by
ecb                     1856  0
md4                     3355  0
nls_utf8                1216  1
cifs                  270720  2
i2c_bcm2708             3759  0
i2c_dev                 5620  0
snd_bcm2835            15846  0
snd_pcm                77560  1 snd_bcm2835
snd_seq                53329  0
snd_timer              19998  2 snd_pcm,snd_seq
snd_seq_device          6438  1 snd_seq
snd                    58447  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
snd_page_alloc          5145  1 snd_pcm
spidev                  5224  0
leds_gpio               2235  0
led_class               3562  1 leds_gpio
spi_bcm2708             4510  0

do this

ls -l /etc/modprobe.d/raspi-blacklist.conf

the spi device should be commented out.

then
cat /etc/modules

/etc/modules should contain the line
spi-bcm2708
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

cobey
Posts: 7
Joined: Sun Nov 10, 2013 3:26 pm

Re: SPI devices not appearing in /dev

Sun Apr 13, 2014 9:31 pm

Hi Richard,
If I load "spi_bcm2708" and "spidev" with modprobe, they do show up in the lsmod output (see original post). The kernel modules are present, but located in /sys/module :

Code: Select all

# find / -name "spi*"
/sys/bus/spi
/sys/bus/spi/drivers/spidev
/sys/devices/platform/bcm2708_spi.0/spi_master
/sys/devices/platform/bcm2708_spi.0/spi_master/spi0
/sys/class/spi_master
/sys/class/spi_master/spi0
/sys/class/spidev
/sys/module/spi_bcm2708
/sys/module/spidev
/sys/module/spidev/drivers/spi:spidev
/lib/modules/3.8.13/kernel/drivers/spi
/lib/modules/3.8.13/kernel/drivers/spi/spidev.ko
/lib/modules/3.8.13/kernel/drivers/spi/spi-bcm2708.ko
/lib/modules/3.8.13-ipipe/kernel/drivers/spi
/lib/modules/3.8.13-ipipe/kernel/drivers/spi/spidev.ko
/lib/modules/3.8.13-ipipe/kernel/drivers/spi/spi-bcm2708.ko
I didn't see a folder named "modprobe.d" anywhere on the system. I also did a search for any files who's name contains "blacklist" and got nothing. Will SPI work if the blacklist file is not present?

Thanks,
Cobey

cobey
Posts: 7
Joined: Sun Nov 10, 2013 3:26 pm

Re: SPI devices not appearing in /dev [solved]

Wed Apr 16, 2014 8:40 pm

I discovered that for whatever reason, dynamic loading of spidev module (using modprobe) is broken in rpi-3.8.y kernel. SPI will only work if spidev is statically built into the kernel. This is not the case with other kernel versions I tried, but to get xenomai real-time patch installed I am restricted to kernel 3.8.13. Using "make linux-xconfig", I set CONFIG_SPI_SPIDEV = y and CONFIG_SPI_BCM2708 = y. spidev0.0 and spidev0.1 now show up in /dev after boot.

Return to “Troubleshooting”