Cole1717
Posts: 29
Joined: Mon Mar 16, 2015 10:44 pm

Re: Python GPIO does not work on Raspberry Pi 2

Thu Jun 04, 2015 12:40 pm

When i booted the pi for the first time, i went through all the settings just to see what was there. I think it was disabled, or maybe I read somewhere that you don't need it.

Rozalija
Posts: 6
Joined: Sun Nov 22, 2015 3:47 pm

Re: Python GPIO does not work on Raspberry Pi 2

Sun Nov 22, 2015 3:57 pm

joan wrote:
Cole1717 wrote:I'm fairly certain I left that disabled because I didn't know what it was. What is it exactly? I'll definitely try enabling it.
It's something you have to be using if you want to use RPi.GPIO.

I'm not competent to explain its purpose.

If your /boot/config.txt contains a line such as the following then remove it.

device_tree=
Hi,

I have the sameproblem and it is solved by this solution. However, I'm also going to use I2C which needs that line to be in config.txt as stated here. Could you please give me some hints how can I have both at the same time?

User avatar
joan
Posts: 14196
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Python GPIO does not work on Raspberry Pi 2

Sun Nov 22, 2015 5:27 pm

@yugi_oh

You should be using device tree now. It should now work.

Rozalija
Posts: 6
Joined: Sun Nov 22, 2015 3:47 pm

Re: Python GPIO does not work on Raspberry Pi 2

Sun Nov 22, 2015 5:41 pm

joan wrote:@yugi_oh

You should be using device tree now. It should now work.

Thank you for your post. But when I remove the "device_tree=", the i2c stops working and "i2cdetect -y 1" raise the error :
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

In case I uncomment the "device_tree=", it works correctly. any idea?

User avatar
joan
Posts: 14196
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Python GPIO does not work on Raspberry Pi 2

Sun Nov 22, 2015 5:49 pm

yugi_oh wrote:
joan wrote:@yugi_oh

You should be using device tree now. It should now work.
Thank you for your post. But when I remove the "device_tree=", the i2c stops working and "i2cdetect -y 1" raise the error :
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

In case I uncomment the "device_tree=", it works correctly. any idea?
You should not have a line in /boot/config.txt which says
device_tree=

You should have a line in /boot/config.txt which says
dtparam=i2c_arm=on

You should have a line in /etc/modules which says
i2c-dev

Rozalija
Posts: 6
Joined: Sun Nov 22, 2015 3:47 pm

Re: Python GPIO does not work on Raspberry Pi 2

Sun Nov 22, 2015 5:57 pm

joan wrote:
yugi_oh wrote:
joan wrote:@yugi_oh

You should be using device tree now. It should now work.
Thank you for your post. But when I remove the "device_tree=", the i2c stops working and "i2cdetect -y 1" raise the error :
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

In case I uncomment the "device_tree=", it works correctly. any idea?
You should not have a line in /boot/config.txt which says
device_tree=

You should have a line in /boot/config.txt which says
dtparam=i2c_arm=on

You should have a line in /etc/modules which says
i2c-dev
Thanks a lot ! worked like a charm

Return to “Troubleshooting”