Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self.__spi.open(0,0) IOError: [Errno 2] No such file or directory #1

Open
neozerosv opened this issue May 8, 2019 · 1 comment
Open

Comments

@neozerosv
Copy link

neozerosv commented May 8, 2019

After enabling SPI in a raspberry pi

python i32ctt_test.py 
Traceback (most recent call last):
  File "i32ctt_test.py", line 6, in <module>
    phy = driver_at86rf233(gpio)
  File "/home/pi/I32CTT/python/phy/at86rf233_rpi/driver.py", line 150, in __init__
    self.__spi.open(0,0)

It showed me that message. I had to find out wich ID of SPI i had with

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

And then replace the

`self.__spi.open(0,0)`

with
self.__spi.open(0,1)
It worked for me like this blog said https://www.raspberrypi.org/forums/viewtopic.php?t=154317

I guess it should need to read that file to set those vatiables. like this code

import glob
spi_file = glob.glob("/dev/spi*")[0]
spiadd = [spi_file[-3:][:1],spi_file[-1:]]

self.__spi.open(spiadd[0],spiadd[1])

My enviroment:

cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
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"

uname -a
Linux raspberrypim 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

cat /proc/cpuinfo |tail -n 3
Hardware	: BCM2835
Revision	: a020d3

Check: https://elinux.org/RPi_HardwareHistory for HW version

@neozerosv
Copy link
Author

The main issue is that i had both modules enabled,

/boot/config.txt
#dtoverlay=at86rf233

And also this module must be blacklisted so that no program or module take control of the SPI 0,0 and the python program be able to access it.

cat /etc/modprobe.d/raspi-blacklist.conf 
blacklist at86rf230

After that the SPI 0,0 is available.

ls -alh /dev/spi*
crw-rw---- 1 root spi 153, 0 May  9 22:32 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 May  9 22:32 /dev/spidev0.1

YAY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant