plng
Posts: 25
Joined: Sun Jun 02, 2013 12:52 pm

Can't get SPI devices

Fri Nov 08, 2013 9:11 am

Hi,

After a complete re-install I can't get spi to work.
I've made a fresh install with the last raspbian img (2013-09-25-wheezy-raspbian)
After install and configuration everything worked except spi

My pi is up to date

Code: Select all

sudo apt-get update
sudo apt-get dist-upgrade/upgrade
sudo rpi-update
sudo reboot
I've enabled spi in raspi-config and reboot => no devices in /dev
I've try directly in raspi-blacklist.conf => no devices in /dev
I've try sudo modprobe spi_bcm2708 spidev => still no devices in /dev
With gpio load spi => same thing (see command result downward)

Here is more infos :

Code: Select all

[email protected] ~ $ cat /etc/modprobe.d/raspi-blacklist.conf
# blacklist spi and i2c by default (many users don't need them)

#blacklist spi-bcm2708
blacklist i2c-bcm2708

Code: Select all

[email protected] ~ $ lsmod
Module                  Size  Used by
spidev                  5493  0
snd_bcm2835            16213  0
snd_pcm                78007  1 snd_bcm2835
snd_page_alloc          5184  1 snd_pcm
snd_seq                51559  0
snd_seq_device          6501  1 snd_seq
snd_timer              18709  2 snd_pcm,snd_seq
snd                    58083  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
leds_gpio               2083  0
led_class               3712  1 leds_gpio
spi_bcm2708             4475  0
spidev and spi_bcm2708 are listed :!: :?:

Code: Select all

[email protected] ~ $ sudo ls /dev
autofs           fb0    loop2         mmcblk0             ram0   ram4    sda1     tty10  tty2   tty29  tty38  tty47  tty56  tty8     vcs2   vcsa5
block            fd     loop3         mmcblk0p1           ram1   ram5    shm      tty11  tty20  tty3   tty39  tty48  tty57  tty9     vcs3   vcsa6
bsg              full   loop4         mmcblk0p2           ram10  ram6    snd      tty12  tty21  tty30  tty4   tty49  tty58  ttyAMA0  vcs4   xconsole
btrfs-control    fuse   loop5         net                 ram11  ram7    sndstat  tty13  tty22  tty31  tty40  tty5   tty59  uinput   vcs5   zero
bus              hwrng  loop6         network_latency     ram12  ram8    stderr   tty14  tty23  tty32  tty41  tty50  tty6   urandom  vcs6
cachefiles       input  loop7         network_throughput  ram13  ram9    stdin    tty15  tty24  tty33  tty42  tty51  tty60  vc-cma   vcsa
char             kmsg   loop-control  null                ram14  random  stdout   tty16  tty25  tty34  tty43  tty52  tty61  vchiq    vcsa1
console          log    MAKEDEV       ppp                 ram15  raw     tty      tty17  tty26  tty35  tty44  tty53  tty62  vc-mem   vcsa2
cpu_dma_latency  loop0  mapper        ptmx                ram2   root    tty0     tty18  tty27  tty36  tty45  tty54  tty63  vcs      vcsa3
disk             loop1  mem           pts                 ram3   sda     tty1     tty19  tty28  tty37  tty46  tty55  tty7   vcs1     vcsa4

Code: Select all

[email protected] ~ $ gpio load spi
gpio: Warning: File not present: /dev/spidev0.0
gpio: Warning: File not present: /dev/spidev0.1
I post here because I haven't find a solution with google...
Can someone help me ?

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Can't get SPI devices

Fri Nov 08, 2013 9:36 am

Is there an equivalent to this for spi? Certainly i2c needs the user to be granted permission.

Code: Select all

adduser pi i2c
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

plng
Posts: 25
Joined: Sun Jun 02, 2013 12:52 pm

Re: Can't get SPI devices

Fri Nov 08, 2013 9:41 am

Yes, I already did that :

Code: Select all

[email protected] ~ $ sudo adduser pi spi
L'utilisateur « pi » appartient déjà au groupe « spi ».
"The « pi » user is already in « spi » group"

User avatar
g7ruh
Posts: 67
Joined: Mon Apr 23, 2012 9:49 am
Location: Blackfield UK

Re: Can't get SPI devices

Fri Nov 08, 2013 10:56 am

Hi plng

I have this problem since the recent firmware updates, an SPI connection does not work any more Dom is helping, see here http://www.raspberrypi.org/phpBB3/viewt ... 29&t=55711 and my posts (g7ruh). A detour for you to try is to revert to an older firmware download by using this command:

Code: Select all

sudo rpi-update 8234d5148aded657760e9ecd622f324d140ae891
the large hex string tells rpi-update to load a previous version, in this case 18th Oct. I have been testing for Dom and when finished, I revert to this firmware to restore operation of my SPI ADC.

Just a suggestion which may help you.

Roger (G7RUH)

plng
Posts: 25
Joined: Sun Jun 02, 2013 12:52 pm

Re: Can't get SPI devices

Fri Nov 08, 2013 11:23 am

Thanks a lot g7ruh !
After a downgrade of my pi's firmware spidev0.0 and spidev0.1 are comeback in /dev ! :D
I'll try it after work, but it seems to be good.

Harischandra Prasad
Posts: 1
Joined: Sun Aug 18, 2013 8:50 am

Re: Can't get SPI devices

Fri Nov 08, 2013 1:05 pm

Even I faced same issue after upgrading to latest firmware(Nov-6). As suggested by you downgraded the firmware and SPI stared working.

Thanks a lot g7ruh !

User avatar
g7ruh
Posts: 67
Joined: Mon Apr 23, 2012 9:49 am
Location: Blackfield UK

Re: Can't get SPI devices

Fri Nov 08, 2013 1:11 pm

plng wrote:Thanks a lot g7ruh !
plng, my pleasure, glad to help, that's what 'pi is all about. Just follow the link in the previous post and you will see when it works with the latest firmware.

Roger

msperl
Posts: 344
Joined: Thu Sep 20, 2012 3:40 pm

Re: Can't get SPI devices

Sat Nov 09, 2013 12:57 pm

I believe it may be related to the fact that at least in some kernel branches there is a bug in the board-config of the kernel
and as such no device is configured for SPI.

You can easily check with the "original" kernel via:

Code: Select all

ls -la /sys/bus/spi/devices/
This directory is most likley empty.
If you boot instead with your "working" kernel then you would see 2 directories.
and then you can also run:

Code: Select all

cat /sys/bus/spi/devices/*/modalias
and you will get the devices that are registered.

There is also an external module called spi-config that allows you to configure the modules on the fly...
(look at the Can-Controller thread, where there is a kernel-package with a "working"
kernel that also includes spi-config)

What you then would typically do is:

Code: Select all

modprobe spi-config devices=bus=0:cs=1:modinfo=spidev:speed=500000,bus=0:cs=1:modinfo=spidev:speed=8000000
then one device would be running at 500khz while the other at 8MHz Bus speed...

You can also configure different devices like can-controllers, SPI-ethernet cards that way...
(details can be found at: http://github.com/msperl/spi-config/, but there is also a thread in this forum)

Maybe I should try to get this somehow into the raspbien-kernel...

Martin

User avatar
jwilker2
Posts: 44
Joined: Wed Nov 30, 2011 6:55 am
Location: Birmingham, Alabama

Re: Can't get SPI devices

Mon Nov 11, 2013 5:51 pm

g7ruh thanks for the help! I blindly upgraded this morning via rpi-update and immediately broke my piface install. I should and allegedly know better but every once in a while...

Thanks for do the leg work and posting you results.

AJB2K3
Posts: 215
Joined: Sun Aug 11, 2013 3:25 pm

Re: Can't get SPI devices

Wed Nov 13, 2013 6:42 am

[email protected] ~ $ cat /etc/modprobe.d/raspi-blacklist.conf
# blacklist spi and i2c by default (many users don't need them)

#blacklist spi-bcm2708 <------
blacklist i2c-bcm2708
Have you un-commented this line?
I.e remove the #
Back in the old days, we were smarter then the technology.
Nowadays technology makes us look like villages fools in front of the children!

plng
Posts: 25
Joined: Sun Jun 02, 2013 12:52 pm

Re: Can't get SPI devices

Wed Nov 13, 2013 8:43 am

AJB2K3

If you un-comment the line with spi-bcm2708, the spi module will be blacklisted at next reboot.
blacklist spi and i2c by default (many users don't need them)
You have comment the spi line to load the spi module at boot
(By commenting a line, you remove the module from the boot blacklist)

User avatar
g7ruh
Posts: 67
Joined: Mon Apr 23, 2012 9:49 am
Location: Blackfield UK

Re: Can't get SPI devices

Fri Nov 15, 2013 4:39 pm

jwilker2 wrote:g7ruh thanks for the help!
jwilker2 and others, a new firmware update just posted. I have tested it and SPI is back working again, Thanks to Dom and popcornmix

Roger :D

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: Can't get SPI devices

Thu Jun 22, 2017 8:23 pm

HI,

Seems this is an old issue - I am new, and I am having the same problems spidev is there, but does not work when running a test. if I look in the blacklist, I see nothing, as in it is completely empty - is this my problem? to me that would say nothing is blacklisted therefore ok!!?

I am running latest version of raspbian!

HELP!!

DirkS
Posts: 9842
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Can't get SPI devices

Thu Jun 22, 2017 8:32 pm

tig124 wrote:HI,

Seems this is an old issue - I am new, and I am having the same problems spidev is there, but does not work when running a test. if I look in the blacklist, I see nothing, as in it is completely empty - is this my problem? to me that would say nothing is blacklisted therefore ok!!?

I am running latest version of raspbian!

HELP!!
Nothing should be in the blacklist file.
There's also no need to make manual changess to /etc/modules.
For a long time the best way to enable SPI is to use raspi-config (or the GUI equivalent in menu Preferences)
https://www.raspberrypi.org/documentati ... -config.md

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: Can't get SPI devices

Thu Jun 22, 2017 9:18 pm

HI thanks - I have done this, now both from terminal as you suggested, but also via the GUI (I originally did this via the GUI), but its still not working
When i do

ls -l /dev/spidev*

I get a response saying no such device, so if I do a simple
ls -l /dev/

then scroll back through the files to see if spidev is there, basically it is not.
It appears that this is the issue!?

How do I get the SPI to work?

DirkS
Posts: 9842
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Can't get SPI devices

Thu Jun 22, 2017 9:33 pm

Please post your /boot/config.txt.

BTW: which OS + version is installed?
Output of 'uname -a' would also be useful

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: Can't get SPI devices

Thu Jun 22, 2017 10:23 pm

kernal is raspberry pi 4.4.50-v7+ #970 smp 20 Feb

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

DirkS
Posts: 9842
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Can't get SPI devices

Thu Jun 22, 2017 10:28 pm

You forgot the most important bit: /boot/config.txt

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: Can't get SPI devices

Thu Jun 22, 2017 10:52 pm

Hi Sorry

Here is the Config.txt contents

# For more options and information see
# http://rpf.io/configtxtreadme
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=4

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# --- added by elecrow-pitft-setup Fri 26 May 23:01:45 UTC 2017 ---
hdmi_force_hotplug=1
max_usb_current=1
hdmi_drive=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
display_rotate=0
# --- end elecrow-pitft-setup Fri 26 May 23:01:45 UTC 2017 ---

DirkS
Posts: 9842
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Can't get SPI devices

Fri Jun 23, 2017 10:46 am

You have an HDMI screen with SPI connected touch panel configured.
Does the touch work? That would mean that SPI is working already.
I would still expect to see /dev/spidev0.0 though.

tig124
Posts: 13
Joined: Mon Jun 19, 2017 8:52 pm

Re: Can't get SPI devices

Fri Jun 23, 2017 10:53 am

Hi Yes, I have a HDMI screen attached and the touch screen is working. Will look at which CS line the touchscreen is using and then make sure I am using the other CS line for the MAX chip - However Yes agree I should still see SPIDev.. Any reason for that not being there?

DirkS
Posts: 9842
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Can't get SPI devices

Fri Jun 23, 2017 10:58 am

tig124 wrote:Hi Yes, I have a HDMI screen attached and the touch screen is working. Will look at which CS line the touchscreen is using and then make sure I am using the other CS line for the MAX chip - However Yes agree I should still see SPIDev.. Any reason for that not being there?
The touch panel uses CS 1:

Code: Select all

dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
No idea why it's not showing spi0.0
If you can't get it to work with spi0 you could try to activate spi1. See the section for 'spi1-1cs' in /boot/overlays/README

Return to “Interfacing (DSI, CSI, I2C, etc.)”