Beagle Bone Black program running continuously

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Beagle Bone Black program running continuously

Post by mtangy »

After running a basic GPIO program using the Adafruit python GPIO library(program found below) I think the program is continuously running (if possible) even though I restarted the board severely times. Whenever I plug LED's into either pins (P8_07 and P8_09) the LED very dimly turns on which I believe is what the program should do. As soon as I realized the program didn't include a GPIO.cleanup() I wrote a program that just sets both pins low and and call cleanup() and still no luck.

the board is running Debian 7.8 w/ Python 2.7.3

any input would be much appreciated

Code: Select all

import Adafruit_BBIO.GPIO as GPIO
import time, os, sys

#if not os.geteuid() == 0:
#    sys.exit('Script must be run as root')

pinOut = "P8_09"
tDelay = 0.1

GPIO.setup(pinOut, GPIO.OUT)

while True:
    GPIO.output(pinOut, GPIO.HIGH)
    time.sleep(tDelay)
    GPIO.output(pinOut, GPIO.LOW)
    time.sleep(tDelay)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Beagle Bone Black program running continuously

Post by adafruit_support_rick »

Do you have a current limiting resistor on that LED? If not, you may have burned out the GPIO pin.

User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Re: Beagle Bone Black program running continuously

Post by mtangy »

I have been using current limiting resistors. It seems like both pins are producing a lil bit of voltage continuously. Is that a symptom of burnt out pins?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Beagle Bone Black program running continuously

Post by adafruit_support_rick »

No, if you've been using resistors, your pins are probably not burnt out. Instead, they probably default to a high state after a restart. That's why it looks like your program is running.
Change your code so that it alternates the pins between high and low, with delays in-between. This will make the LEDs blink. The blinking should stop on a restart.

User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Re: Beagle Bone Black program running continuously

Post by mtangy »

I wrote a program to toggle those pins that uses GPIO cleanup and still no luck. I don't think the pins are being set to logic high on restart because the LED I have hooked to the pins are barley glowing so i imagine they are outputting significantly less than the 3.3V logical level. When I run the same program on pin P8_11 the LED turns fully on and off

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

Re: Beagle Bone Black program running continuously

Post by drewfustini »

Hi, looks like this is a tricky issue. I'm going to try to reproduce on my BBB so I can understand better what is happening.

thanks,
drew

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

Re: Beagle Bone Black program running continuously

Post by drewfustini »

I found that your test program runs ok on P8_9 after the pin has been exported. That pin is GPIO 69.

Code: Select all

root@beaglebone:~# echo 69 > /sys/class/gpio/export
root@beaglebone:~# echo out > /sys/class/gpio/gpio69/direction 
root@beaglebone:~# echo 1 > /sys/class/gpio/gpio69/value 
does that work for you?
Black_eMMC_and_HDMI_pins.PNG
Black_eMMC_and_HDMI_pins.PNG (248.33 KiB) Viewed 1159 times

User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Re: Beagle Bone Black program running continuously

Post by mtangy »

Yes! those commands got the pins to stop outputting a small voltage and toggled them on and off. Unfortunately they still don't work using the Adafruit GPIO python library. Here's the updated code i'm using:

thanks

Code: Select all

import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
import Adafruit_BBIO.ADC as ADC
from time import sleep

pin = "P8_09"
GPIO.setup(pin, GPIO.OUT)
delay = 1

def gpio():
        print "ON"
        GPIO.output(pin, GPIO.HIGH)
        sleep(delay)
        print "OFF"
        GPIO.output(pin, GPIO.LOW)
        sleep(delay)

def pwm():
        PWM.start("P9_14",50,2,1)

def adc():
        value = ADC.read("P9_40")
        voltage = value * 1.8
        print voltage
        sleep(30)
try:
    print "\nBLINKING!!!"
    while True:
         gpio()

except KeyboardInterrupt:
    print "\nExiting\n"
    GPIO.cleanup()
#   PWM.cleanup()
#   ADC.cleanup()
    pass


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

Re: Beagle Bone Black program running continuously

Post by drewfustini »

Ah, ok. I'll try reproducing it on my beaglebone.

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

Re: Beagle Bone Black program running continuously

Post by drewfustini »

mtangy wrote:Yes! those commands got the pins to stop outputting a small voltage and toggled them on and off. Unfortunately they still don't work using the Adafruit GPIO python library. Here's the updated code i'm using:
Hi, could you paste the output of the following commands?

Code: Select all

# check what capes are loaded
cat sys/devices/bone_capemgr.*/slots

# check the version of Adafruit_BBIO installed
sudo cat /usr/lib*/python*/site-packages/Adafruit_BBIO*.egg-info/PKG-INFO |head

# check what Debian image is running
cat /etc/dogtag

# check which kernel is running
uname -a

# check which version of Debian
lsb_release -a

User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Re: Beagle Bone Black program running continuously

Post by mtangy »

# check what capes are loaded
cat sys/devices/bone_capemgr.*/slots

cat: sys/devices/bone_capemgr.*/slots: No such file or directory

# check the version of Adafruit_BBIO installed
sudo cat /usr/lib*/python*/site-packages/Adafruit_BBIO*.egg-info/PKG-INFO |head

cat: /usr/lib*/python*/site-packages/Adafruit_BBIO*.egg-info/PKG-INFO: No such file or directory

# check what Debian image is running
cat /etc/dogtag

BeagleBoard.org Debian Image 2015-03-01

# check which kernel is running
uname -a

Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l GNU/Linux

# check which version of Debian
lsb_release -a

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy


For some reason when I rebooted my BBB the pins went back to their previous state of outputting a small voltage until I exported the pins and set them as outputs.

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

Re: Beagle Bone Black program running continuously

Post by drewfustini »

Oops, I had a an error in the command to print out the cape config (e.g. slots). It should a "/" at the beginning. Please run this:
sudo cat /sys/devices/bone_capemgr.*/slots

Also this command:
sudo cat /sys/kernel/debug/pinctrl/*pinmux/pins

User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Re: Beagle Bone Black program running continuously

Post by mtangy »

Code: Select all

boss@beaglebone:/root$ sudo cat /sys/devices/bone_capemgr.*/slots
[sudo] password for boss:
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMI                                                            N
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-SPIDEV1
boss@beaglebone:/root$ sudo cat /sys/kernel/debug/pinctrl/*pinmux/                                                            pins
cat: /sys/kernel/debug/pinctrl/*pinmux/pins: No such file or direc                                                            tory
Thanks for helping me out. Also thanks for your video tutorial on setting up eQEP on the BBB. I used it to get my optical encoder working and it worked great. But do you know if i have to reinstall the cape plugin every time i restart the board? I don't think it saved last time
Last edited by mtangy on Fri Feb 05, 2016 9:41 pm, edited 1 time in total.

User avatar
mtangy
 
Posts: 21
Joined: Wed Dec 23, 2015 2:09 am

Re: Beagle Bone Black program running continuously

Post by mtangy »

I think i messed up the second command. Here's the correct output

Code: Select all

root@beaglebone:~# sudo cat /sys/kernel/debug/pinctrl/*pinmux/pins
registered pins: 142
pin 0 (44e10800) 00000031 pinctrl-single
pin 1 (44e10804) 00000031 pinctrl-single
pin 2 (44e10808) 00000031 pinctrl-single
pin 3 (44e1080c) 00000031 pinctrl-single
pin 4 (44e10810) 00000031 pinctrl-single
pin 5 (44e10814) 00000031 pinctrl-single
pin 6 (44e10818) 00000031 pinctrl-single
pin 7 (44e1081c) 00000031 pinctrl-single
pin 8 (44e10820) 00000027 pinctrl-single
pin 9 (44e10824) 00000027 pinctrl-single
pin 10 (44e10828) 00000027 pinctrl-single
pin 11 (44e1082c) 00000027 pinctrl-single
pin 12 (44e10830) 00000027 pinctrl-single
pin 13 (44e10834) 00000027 pinctrl-single
pin 14 (44e10838) 00000027 pinctrl-single
pin 15 (44e1083c) 00000027 pinctrl-single
pin 16 (44e10840) 00000027 pinctrl-single
pin 17 (44e10844) 00000027 pinctrl-single
pin 18 (44e10848) 00000027 pinctrl-single
pin 19 (44e1084c) 00000027 pinctrl-single
pin 20 (44e10850) 00000017 pinctrl-single
pin 21 (44e10854) 00000007 pinctrl-single
pin 22 (44e10858) 00000017 pinctrl-single
pin 23 (44e1085c) 00000007 pinctrl-single
pin 24 (44e10860) 00000017 pinctrl-single
pin 25 (44e10864) 00000027 pinctrl-single
pin 26 (44e10868) 00000027 pinctrl-single
pin 27 (44e1086c) 00000027 pinctrl-single
pin 28 (44e10870) 00000037 pinctrl-single
pin 29 (44e10874) 00000037 pinctrl-single
pin 30 (44e10878) 00000037 pinctrl-single
pin 31 (44e1087c) 00000037 pinctrl-single
pin 32 (44e10880) 00000032 pinctrl-single
pin 33 (44e10884) 00000032 pinctrl-single
pin 34 (44e10888) 00000037 pinctrl-single
pin 35 (44e1088c) 00000027 pinctrl-single
pin 36 (44e10890) 00000037 pinctrl-single
pin 37 (44e10894) 00000037 pinctrl-single
pin 38 (44e10898) 00000037 pinctrl-single
pin 39 (44e1089c) 00000037 pinctrl-single
pin 40 (44e108a0) 0000002f pinctrl-single
pin 41 (44e108a4) 0000002f pinctrl-single
pin 42 (44e108a8) 0000002f pinctrl-single
pin 43 (44e108ac) 0000002f pinctrl-single
pin 44 (44e108b0) 0000002f pinctrl-single
pin 45 (44e108b4) 0000002f pinctrl-single
pin 46 (44e108b8) 0000002f pinctrl-single
pin 47 (44e108bc) 0000002f pinctrl-single
pin 48 (44e108c0) 0000002f pinctrl-single
pin 49 (44e108c4) 0000002f pinctrl-single
pin 50 (44e108c8) 0000002f pinctrl-single
pin 51 (44e108cc) 0000002f pinctrl-single
pin 52 (44e108d0) 0000002f pinctrl-single
pin 53 (44e108d4) 0000002f pinctrl-single
pin 54 (44e108d8) 0000002f pinctrl-single
pin 55 (44e108dc) 0000002f pinctrl-single
pin 56 (44e108e0) 00000027 pinctrl-single
pin 57 (44e108e4) 00000027 pinctrl-single
pin 58 (44e108e8) 00000027 pinctrl-single
pin 59 (44e108ec) 00000027 pinctrl-single
pin 60 (44e108f0) 00000030 pinctrl-single
pin 61 (44e108f4) 00000030 pinctrl-single
pin 62 (44e108f8) 00000030 pinctrl-single
pin 63 (44e108fc) 00000030 pinctrl-single
pin 64 (44e10900) 00000030 pinctrl-single
pin 65 (44e10904) 00000030 pinctrl-single
pin 66 (44e10908) 00000027 pinctrl-single
pin 67 (44e1090c) 00000027 pinctrl-single
pin 68 (44e10910) 00000020 pinctrl-single
pin 69 (44e10914) 00000000 pinctrl-single
pin 70 (44e10918) 00000020 pinctrl-single
pin 71 (44e1091c) 00000000 pinctrl-single
pin 72 (44e10920) 00000000 pinctrl-single
pin 73 (44e10924) 00000000 pinctrl-single
pin 74 (44e10928) 00000000 pinctrl-single
pin 75 (44e1092c) 00000020 pinctrl-single
pin 76 (44e10930) 00000020 pinctrl-single
pin 77 (44e10934) 00000020 pinctrl-single
pin 78 (44e10938) 00000020 pinctrl-single
pin 79 (44e1093c) 00000020 pinctrl-single
pin 80 (44e10940) 00000020 pinctrl-single
pin 81 (44e10944) 00000027 pinctrl-single
pin 82 (44e10948) 00000030 pinctrl-single
pin 83 (44e1094c) 00000010 pinctrl-single
pin 84 (44e10950) 00000037 pinctrl-single
pin 85 (44e10954) 00000037 pinctrl-single
pin 86 (44e10958) 00000062 pinctrl-single
pin 87 (44e1095c) 00000062 pinctrl-single
pin 88 (44e10960) 0000002f pinctrl-single
pin 89 (44e10964) 00000027 pinctrl-single
pin 90 (44e10968) 00000037 pinctrl-single
pin 91 (44e1096c) 00000037 pinctrl-single
pin 92 (44e10970) 00000030 pinctrl-single
pin 93 (44e10974) 00000000 pinctrl-single
pin 94 (44e10978) 00000073 pinctrl-single
pin 95 (44e1097c) 00000073 pinctrl-single
pin 96 (44e10980) 00000037 pinctrl-single
pin 97 (44e10984) 00000037 pinctrl-single
pin 98 (44e10988) 00000070 pinctrl-single
pin 99 (44e1098c) 00000070 pinctrl-single
pin 100 (44e10990) 00000033 pinctrl-single
pin 101 (44e10994) 00000033 pinctrl-single
pin 102 (44e10998) 00000013 pinctrl-single
pin 103 (44e1099c) 00000013 pinctrl-single
pin 104 (44e109a0) 00000024 pinctrl-single
pin 105 (44e109a4) 00000027 pinctrl-single
pin 106 (44e109a8) 00000027 pinctrl-single
pin 107 (44e109ac) 00000027 pinctrl-single
pin 108 (44e109b0) 00000023 pinctrl-single
pin 109 (44e109b4) 00000027 pinctrl-single
pin 110 (44e109b8) 00000030 pinctrl-single
pin 111 (44e109bc) 00000028 pinctrl-single
pin 112 (44e109c0) 00000030 pinctrl-single
pin 113 (44e109c4) 00000028 pinctrl-single
pin 114 (44e109c8) 00000028 pinctrl-single
pin 115 (44e109cc) 00000028 pinctrl-single
pin 116 (44e109d0) 00000030 pinctrl-single
pin 117 (44e109d4) 00000030 pinctrl-single
pin 118 (44e109d8) 00000030 pinctrl-single
pin 119 (44e109dc) 00000030 pinctrl-single
pin 120 (44e109e0) 00000020 pinctrl-single
pin 121 (44e109e4) 00000030 pinctrl-single
pin 122 (44e109e8) 00000030 pinctrl-single
pin 123 (44e109ec) 00000028 pinctrl-single
pin 124 (44e109f0) 00000028 pinctrl-single
pin 125 (44e109f4) 00000028 pinctrl-single
pin 126 (44e109f8) 00000030 pinctrl-single
pin 127 (44e109fc) 00000028 pinctrl-single
pin 128 (44e10a00) 00000028 pinctrl-single
pin 129 (44e10a04) 00000020 pinctrl-single
pin 130 (44e10a08) 00000028 pinctrl-single
pin 131 (44e10a0c) 00000028 pinctrl-single
pin 132 (44e10a10) 00000028 pinctrl-single
pin 133 (44e10a14) 00000028 pinctrl-single
pin 134 (44e10a18) 00000028 pinctrl-single
pin 135 (44e10a1c) 00000020 pinctrl-single
pin 136 (44e10a20) 00000028 pinctrl-single
pin 137 (44e10a24) 00000028 pinctrl-single
pin 138 (44e10a28) 00000028 pinctrl-single
pin 139 (44e10a2c) 00000028 pinctrl-single
pin 140 (44e10a30) 00000028 pinctrl-single
pin 141 (44e10a34) 00000020 pinctrl-single

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

Re: Beagle Bone Black program running continuously

Post by drewfustini »

Could you try updating to the 4.1.x kernel?

I'm curious to see if the behavior changes using these instructions from eLinux.org:

Code: Select all

cd /opt/scripts/tools/
git pull
sudo ./update_kernel.sh --ti-channel --stable
If 4.1 kernel does not help, then you can revert back to the most recent 3.8 kernel:

sudo apt-get update
sudo apt-get install linux-image-3.8.13-bone79


Now change which kernel will boot:

sudo vi /boot/uEnv.txt


Comment out the 4.1 line and add 3.8 line:

#uname_r=4.1.15-ti-r40
uname_r=3.8.13-bone79


Then reboot

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

Return to “Beagle Bone & Adafruit Beagle Bone products”