Problems to define a GPIO pin as input in Begalebone black

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Problems to define a GPIO pin as input in Begalebone black

Post by NICOCASAL »

Dear sirs

I am a beginner and I have a new beaglebone black board . I begun to write my first code to read a pushbutton . I defined the pin P9_15 as input , using the following code( I show only the partial code):


import Adafruit_BBIO.GPIO as GPIO.
DOOR= "P9_15"
GPIO.setup(DOOR, GPIO.IN)
.
.
.
However , when I run the code, I get the following error message:

Traceback (most recent call last):
File "/var/lib/cloud9/examples/alarm.py", line 4, in <module>
GPIO.setup(DOOR, GPIO.IN)
ValueError: Set gpio mode failed, missing file or invalid permissions.

Would someone please help me to find what is the problem?

Additionally, How can I do to update the time and date in BBB?

I would like to use the BBB to develop a Telemetry system.

Thank you

Hugo

User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by silver2row »

Hello,

Seth here. Try to use this command if you have the correct image: sudo config-pin P9.15 gpio.

Seth

P.S. The time and date can be updated w/ sudo dpkg-reconfigure tzdata. You will get an easy interface to interact w/.

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Hi

Thank you for your help

I am using the cloud9 terminal to write the commands ( I hope that it is the correct).

I used the commands , but the system response to me with the following error message:

debian@beaglebone:/var/lib/cloud9$ sudo config-pin P9.15 gpio
P9_15 pinmux file not found!
Pin has no cape: P9_15[/b]

And when I use the command to update the time and date, the system change the information, but it isn't the correct.

debian@beaglebone:/var/lib/cloud9$ sudo dpkg-reconfigure tzdata
Current default time zone: 'America/Guayaquil'
Local time is now: Sat Sep 29 01:13:44 -05 2018.
Universal Time is now: Sat Sep 29 06:13:44 UTC 2018.

regards

Hugo

User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by silver2row »

Hello,

Please give me this info. so I can help more:

Code: Select all

uname -a
...

Code: Select all

cat /etc/dogtag
If you are using an outdated kernel and image, this may be your issue and I will not be able to help you past this idea w/ those older images/kernels.

Seth

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Hello

This is the information :

Operating System: Debian GNU /Linux 9 (stretch)
Kernel : Linux 4.14.67-ti-r73

Regards

Hugo

User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by silver2row »

Hello Hugo,

Seth here. Um...try this: https://debian.beagleboard.org/images/b ... 4gb.img.xz. This should give you the config-pin utility for your use.

If this does not work, please let me know. I have this image on my current BBBW and it has the config-pin utility on it.

Seth

P.S. That image is from beagleboard.org/latest-images and it is the console image (w/out the GUI).

User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by drewfustini »

NICOCASAL wrote:Hello

This is the information :

Operating System: Debian GNU /Linux 9 (stretch)
Kernel : Linux 4.14.67-ti-r73

Regards

Hugo
Hi Hugo,

It is import to run this command and paste the output in the reply:
sudo /opt/scripts/tools/version.sh

This script will output the versions of software running on your BeagleBone including the version of the u-boot bootloader. Older versions of u-boot booloader on the eMMC can cause issues.

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Thanks to both .

As I mentioned before , I am beginner and I don´t know so much how to write the different commands.

In this case , Can you please indicate me where I should to write the command (sudo /opt/scripts/tools/version.sh)?

I am using Cloud9 and Putty.

regards

Hugo

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Hello

I updated the image version with the command "https://debian.beagleboard.org/images/b ... 4gb.img.xz." . Using "hostnamectl " command , seems that I get the same version that I downloaded the first time.

"Operating System: Debian GNU /Linux 9 (stretch)"

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Hello

I updated the image version with the command "https://debian.beagleboard.org/images/b ... 4gb.img.xz." . Using "hostnamectl " command , I believe that I got the same version that I downloaded the first time.

"Operating System: Debian GNU /Linux 9 (stretch)"

User avatar
silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by silver2row »

Hello,

Use the /home/debian/ dir. to use that command. Try that! That should work for posting all the info. the other fellow needs to determine your issue. So, go to your /home/debian/ dir. and put in the command he mentioned.

Seth

P.S. He is probably correct. You probably have an old bootloader version on your eMMC. Listen to him over me. I am sure he can help you the fastest.

User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by drewfustini »

NICOCASAL wrote:Hello

I updated the image version with the command "https://debian.beagleboard.org/images/b ... 4gb.img.xz." . Using "hostnamectl " command , I believe that I got the same version that I downloaded the first time.

"Operating System: Debian GNU /Linux 9 (stretch)"
instead of hostnamectl, please run this command:
sudo /opt/scripts/tools/version.sh

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Hello

I followed his recommendation and it seems that the use of the command was successful. Is there a way to verify that it was correct?

Just to verify if this command corrected the problems I have had. Try this code, but the system answers this error

"import Adafruit_BBIO.GPIO as GPIO

GPIO.setup("P9_15", GPIO.IN)

print( "test")"

Traceback (most recent call last):
File "/var/lib/cloud9/examples/prueba1.py", line 4, in <module>
GPIO.setup("P9_15", GPIO.IN)
ValueError: Set gpio mode failed, missing file or invalid permissions.
I will be making an error when writing the code?
Thanks
Hugo

User avatar
NICOCASAL
 
Posts: 14
Joined: Sun Sep 30, 2018 1:52 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by NICOCASAL »

Hello

Would you please suggest me something to advance and solve the issue that I have?

In my telemetry project will need approximately 25 BBB. I have reading the Adafruit libraries in Python and I believe that is possible for me to write the program to my application. I require to use the digital and analog inputs and outputs , send emails, and probably to use the LCD display, however I don´t know enough Linux to configurate the el BBB with the following neccesary services.
1. Permanent internet connection , even , when the BBB power on and power off.
2. I need that different codes programed in the BBB, run automatically when the board boot( running at startup)
3. Update the software( the libraries)

I have been using the followings commands :

( for internet permanent connection) :

# crontab -e
@reboot /sbin/ route add default gw 192.168.7.1

(Update the software) :
# apt -get update && apt-get upgrade
#pip install --upgrade PyBBIO Adafruit _BBIO

(multiproccesing)
#crontab -e
@reboot /usr/bin/python/to/my_program.py

Do you believe these commands are the corrects?

I believe that Beaglebone black is a great computer and I am sure that is it I need

Thank you in advance for your help

Hugo

User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Problems to define a GPIO pin as input in Begalebone bl

Post by drewfustini »

It is important to see the output of this script to determine your BeagleBone is configured correctly.

sudo /opt/scripts/tools/version.sh

You indicated that this generated an error when trying to run. Please take a screenshot of the error and attach it to the reply.

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”