segmentation fault while running python code with Adafruit_BBIO

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?

On Tue, 29 Nov 2016 01:56:36 -0800 (PST), malkowki
<bmb.technology@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.

Thanks Dennis for your quick reply.

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.

>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.

On Tue, 29 Nov 2016 06:50:07 -0800 (PST), malkowki
<bmb.technology@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.

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/milestone/5
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:
https://github.com/adafruit/adafruit-beaglebone-io-python/

thanks,
drew

Hi Drew,

thanks for this update.

Regards,

Beninio,