segmentation fault while running python code with Adafruit_BBIO

424 views
Skip to first unread message

malkowki

unread,
Nov 29, 2016, 4:56:36 AM11/29/16
to BeagleBoard
Dear,

I am using beaglebone black revision C running kernel  4.1.21-bone-rt-r20 ,re4lease Debian Jessie.
I have installed the Adafruit  BBIO and check that the installation was successfull by doing the follwing
>>> import Adafruit_BBIO.GPIO as GPIO; print GPIO
<module 'Adafruit_BBIO.GPIO' from '/root/.python-eggs/Adafruit_BBIO-1.0.0-py2.7-linux-armv7l.egg-tmp/Adafruit_BBIO/GPIO.so'>
>>>

whne I try to run a python program example like below:
#!/usr/bin/python

# Blinks one of the Beaglebone Black's on-board LEDs until CTRL-C is pressed. T$

# Import PyBBIO library
from bbio import *
#import the time module which allows us to set the timing for a loop event
import time

#Create variable called ledPin which refers to one of the designated onboard US$
ledPin
= "USR3"

# Create a setup function
def setup():
   
# Set one of the USR LEDs as output
    pinMode
(ledPin, OUTPUT)

# Set up a loop and the blink timing to two second intervals
while True:
   
# Start the pin state at LOW = off
    digitalWrite
(ledPin, LOW)
   
# Hold this state for 2 seconds
    time
.sleep(2)
   
# Change the pin state to HIGH = on
    digitalWrite
(ledPin, HIGH)
    time
.sleep(2) code ici...
I got a segmentaion fault.

Can you tell me what could be wrong here?

Dennis Lee Bieber

unread,
Nov 29, 2016, 8:00:42 AM11/29/16
to beagl...@googlegroups.com
On Tue, 29 Nov 2016 01:56:36 -0800 (PST), malkowki
<bmb.tec...@gmail.com> declaimed the
following:

>Dear,
>
>I am using beaglebone black revision C running kernel 4.1.21-bone-rt-r20
>,re4lease Debian Jessie.
>I have installed the Adafruit BBIO and check that the installation was
>successfull by doing the follwing
>>>> import Adafruit_BBIO.GPIO as GPIO; print GPIO
><module 'Adafruit_BBIO.GPIO' from
>'/root/.python-eggs/Adafruit_BBIO-1.0.0-py2.7-linux-armv7l.egg-tmp/Adafruit_BBIO/GPIO.so'
>>
>>>>
>
>whne I try to run a python program example like below:
>#!/usr/bin/python
>
># Blinks one of the Beaglebone Black's on-board LEDs until CTRL-C is
>pressed. T$
>
># Import PyBBIO library
>from bbio import *


WHICH library are you using?

PyBBIO and Adafruit_BBIO are two separate libraries, from different
sources. Oh, and above you imported Adafruit_BBIO while here you imported
just bbio -- so that's a third possible library (older name for
Adafruit_BBIO).

https://github.com/graycatlabs/PyBBIO/wiki/Installing-PyBBIO

For PyBBIO note that this page specifies 3.8 kernel -- which was the older
Debian Wheezy (very much -- the page says 3.14 won't work... And Jessie
ships with a 4.x kernel as I recall).

Short answer: you've referenced three different BBIO libraries just in
the above, so it is difficult to know exactly which is being used.


<SNIP>
>I got a segmentaion fault.
>
>Can you tell me what could be wrong here?

Were you running from a privileged account (root)? By default, the BBB
tends to configure the sysfs nodes (which most of the libraries use to
access I/O pins, channels, etc.) such that a user account has no permission
-- and they tend to hard-crash rather then bring up a Python exception.
--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/

malkowki

unread,
Nov 29, 2016, 9:50:07 AM11/29/16
to BeagleBoard, wlf...@ix.netcom.com
Thanks Dennis for your quick reply.



Le mardi 29 novembre 2016 14:00:42 UTC+1, Dennis Lee Bieber a écrit :
On Tue, 29 Nov 2016 01:56:36 -0800 (PST), malkowki
<bmb.tec...@gmail.com> declaimed the
following:

>Dear,
>
>I am using beaglebone black revision C running kernel  4.1.21-bone-rt-r20
>,re4lease Debian Jessie.
>I have installed the Adafruit  BBIO and check that the installation was
>successfull by doing the follwing
>>>> import Adafruit_BBIO.GPIO as GPIO; print GPIO
><module 'Adafruit_BBIO.GPIO' from
>'/root/.python-eggs/Adafruit_BBIO-1.0.0-py2.7-linux-armv7l.egg-tmp/Adafruit_BBIO/GPIO.so'
>>
>>>>
>
>whne I try to run a python program example like below:
>#!/usr/bin/python
>
># Blinks one of the Beaglebone Black's on-board LEDs until CTRL-C is
>pressed. T$
>
># Import PyBBIO library
>from bbio import *


        WHICH library are you using?

I have installed PyBBIO as well, and this one is failing when testing the package:
~# python -c "import bbio as GPIO; print GPIO"
Segmentation fault
I don't know if they have already updated this library for kernel 4.1.x on?


The Adafruit_BBIO installation works....

 

        PyBBIO and Adafruit_BBIO are two separate libraries, from different
sources. Oh, and above you imported Adafruit_BBIO while here you imported
just bbio -- so that's a third possible library (older name for
Adafruit_BBIO).

https://github.com/graycatlabs/PyBBIO/wiki/Installing-PyBBIO

For PyBBIO note that this page specifies 3.8 kernel -- which was the older
Debian Wheezy (very much -- the page says 3.14 won't work... And Jessie
ships with a 4.x kernel as I recall).

        Short answer: you've referenced three different BBIO libraries just in
the above, so it is difficult to know exactly which is being used.


        <SNIP>
>I got a segmentaion fault.
>
>Can you tell me what could be wrong here?

        Were you running from a privileged account (root)? By default, the BBB
tends to configure the sysfs nodes (which most of the libraries use to
access I/O pins, channels, etc.) such that a user account has no permission
-- and they tend to hard-crash rather then bring up a Python exception.

I was running from root account.


 

Dennis Lee Bieber

unread,
Nov 29, 2016, 9:00:30 PM11/29/16
to beagl...@googlegroups.com
On Tue, 29 Nov 2016 06:50:07 -0800 (PST), malkowki
<bmb.tec...@gmail.com> declaimed the
following:

>I have installed PyBBIO as well, and this one is failing when testing the
>package:
>~# python -c "import bbio as GPIO; print GPIO"
>Segmentation fault
>I don't know if they have already updated this library for kernel 4.1.x on?
>
As I pointed out -- it is Wheezy/3.8 only. No Jessie variation.

>
>The Adafruit_BBIO installation works....

Drew Fustini

unread,
Nov 30, 2016, 4:55:10 AM11/30/16
to BeagleBoard, wlf...@ix.netcom.com
On Tuesday, November 29, 2016 at 8:50:07 AM UTC-6, malkowki wrote:
> I have installed PyBBIO as well, and this one is failing when testing the package:
> ~# python -c "import bbio as GPIO; print GPIO"
> Segmentation fault
> I don't know if they have already updated this library for kernel 4.1.x on?

I think this GitHub issue for PyBBIO is similar to what you're experienceing:

importing bbio causes immediate segfault #93
https://github.com/graycatlabs/PyBBIO/issues/93

As Dennis points out, PyBBIO only works with the Linux 3.8 kernel as found on the Debian 7.x (Wheezy) images.

I believe Alex Hiam currently has limited time to work on PyBBIO, so I'm not sure how soon support for newer kernels will be added:
https://github.com/graycatlabs/PyBBIO/issues/107

> The Adafruit_BBIO installation works....

I'm the maintainer of Adafruit_BBIO.  It does support Linux kernel 4.1+ as found on the Debian 8.x (Jessie) images.  Please raise a GitHub issue if you run into any problems:


thanks,
drew

malkowki

unread,
Nov 30, 2016, 12:32:22 PM11/30/16
to BeagleBoard, wlf...@ix.netcom.com
Hi Drew,

thanks for this update.

Regards,

Beninio,
Reply all
Reply to author
Forward
0 new messages