Git Product home page Git Product logo

pybbio's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pybbio's Issues

PyBBIO example program error

I went through issue #13

I am unable to run example program, when i execute example program

solution I got was:

Traceback (most recent call last):
File "blink.py", line 7, in
from bbio import *
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/init.py", line 4, in
from bbio import *
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/bbio.py", line 28, in
from platform import *
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/init.py", line 5, in
from api import *
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/api.py", line 9, in
from bbio.platform.beaglebone import *
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/init.py", line 3, in
import config
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/config.py", line 410, in
for i in PWM_PINS.keys())
File "/usr/lib/python2.7/site-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/config.py", line 410, in
for i in PWM_PINS.keys())
IOError: [Errno 2] No such file or directory: '/sys/class/pwm/ehrpwm.1:1/request'

"AFTER GOING THROUGH ISSUE #13

When i execute these commands I got the following results.

root@beaglebone:~# uname -a
Linux beaglebone 3.8.13 #1 SMP Tue Jun 18 02:11:09 EDT 2013 armv7l GNU/Linux

root@beaglebone:~# ls /sys/class/pwm
export unexport

It would be helpful if you could guide me through this.

Thank you

Note: I had updated the latest Angstrom image.with BBB-eMMC-flasher-2013.06.17.img.xz

Interrupts

The BeagleBone reference manual mentions the possibility of using a hardware interrupt to detect pin changes immediately when they happen. The documentation is sparse, and all I could find was this statement:

Any GPIO can be used as an interrupt and is limited to two interrupts per GPIO Bank for a maximum of eight pins as interrupts.

Bonescript uses an attachInterrupt method, similar to the Arduino to pull it off, although in my experience with it, it seemed spotty.

Have you considered moving away from the EventIO model and using interrupts? I'm not sure how to pull it off in Python (signals, maybe?), but it would be extremely helpful for pin changes that last only a few milliseconds.

I'm still not 100% sure I understand how the interrupts work, so maybe they're only doing something similar to your EventIO model anyway, but here's the method I'm talking about in Bonescript:

https://github.com/jadonk/bonescript/blob/master/node_modules/bonescript/index.js#L272

Fail to write to a file with BBIOserver

I tried to open a file and wish to write, program as following

from bbio import *

from BBIOServer import *

fo = open("foo.txt", "r+")
print "Name of the file: ", fo.name
print "Closed or not : ", fo.closed
print "Opening mode : ", fo.mode
print "Softspace flag : ", fo.softspace

fo.write( "Python is a great language.\nYeah its great!!\n");

fo.close()
print "Closed or not : ", fo.closed
print 'end'

it does create file foo.txt and write in, but if I import BBIOServer import
rom BBIOServer import *
the python program runs, but did not write anything into the file.
Any thing conflict with BBIOserver?

problem during installation pybbio

Hi, a few days ago i formatted my beaglebone black and i tried to install pybbio again. but during installation i have had the error shown below:

root@beaglebone:/PyBBIO# python setup.py install
Installing PyBBIO...
Install failed with exception:
No module named email
root@beaglebone:
/PyBBIO#

Could you tell me somethings about this error?

Crash when using serial API

I introduced a bug in a recent change to PyBBIO, which caused programs to crash when they used PyBBIO's serial port API. I've solved the problem, but it requires a full reinstall of PyBBIO to fix, so I've created the issue to explain how to do it. To see if the version you have is affected run one of the serial programs in the PyBBIO/examples/ directory. If it crashes with the exception:

AttributeError: 'module' object has no attribute 'Serial'

then follow these steps to fix it.

First to uninstall the current version you need to know where it's installed:

# python
>>> import bbio
>>> bbio.__file__
'/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/__init__.pyc'

The path it prints out may be different on different images. We need to delete the .egg/ directory, e.g.:

# rm -r /usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/

Next remove the build/ and dist/ directories in the PyBBIO directory if they exist:

# cd ~/PyBBIO
# rm -r build/ dist/

Then pull the latest changes and install:

# git pull
# python setup.py install

Confirm it's now working by running one of the serial examples:

# cd examples
# python serial_server.py

If you run into any trouble please comment on this issue below.

Move I2C driver to C extension, reevaluate backend and API

The I2C driver should be moved to a new C extension for performance reasons, and should potentially ditch the smbus backend for a custom C driver, in which case it should be written in a general enough way so as to be used in other applications (similar to the SPI driver https://github.com/graycatlabs/PyBBIO/blob/master/bbio/platform/util/spidriver.h).

I'd also like to make sure the API covers a wider range of use cases, which may require the custom C driver for directly applying ioctls.

ImportError: No Module named FileInput

I have a beaglebone black and I have been trying to install the PyBBIO setup file but the terminal is coming back with the error as said in the title. I didn't make any changes to the file but this needs to be addressed.

add_entry function using multiple text boxes

Thanks for getting this excellent library out there.

I'm currently using it to run a server to connect to a BBB, after which I'm interfacing with the IO using Adafruit's library. I'm pretty new at server client interaction and javascript, and I've been trying to accomplish the following:

  1. Create a form consisting of multiple text entry boxes, just as the ones used in the add_entry function.
  2. Click a submit button that takes the input from these multiple text boxes and allows me to pass them as an array into the function I'm specifying in my lambda expression.

I've been trying to tweak the library to accomplish this, but I don't think I can sift through all the interactions to get it fully working. Is this something that's supported or could be somewhat easily implemented using the pyBBIO framework? If so, any help would be much appreciated.

Most recent PyBBIO fails during installation

Brand new Beagle Bone A5, updated to 3.2.14. Fresh update and upgrade, PyBBIO fails with the following error message after all dependencies are available per the setup instructions:

root@beaglebone:~/PyBBIO# python setup.py install
running install
running build
running build_py
copying bbio/config.py -> build/lib/bbio
running install_lib
copying build/lib/bbio/config.py -> /usr/lib/python2.7/site-packages/bbio
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
File "/usr/lib/python2.7/hashlib.py", line 139, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
File "/usr/lib/python2.7/hashlib.py", line 139, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
File "/usr/lib/python2.7/hashlib.py", line 139, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
File "/usr/lib/python2.7/hashlib.py", line 139, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
File "/usr/lib/python2.7/hashlib.py", line 139, in
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha512
writing byte-compilation script '/tmp/tmpJXdVvy.py'
/usr/bin/python /tmp/tmpJXdVvy.py
Traceback (most recent call last):
File "/tmp/tmpJXdVvy.py", line 10, in
direct=1)
File "/usr/lib/python2.7/distutils/util.py", line 527, in byte_compile
from py_compile import compile
ImportError: No module named py_compile
error: command '/usr/bin/python' failed with exit status 1

AnalogRead broken on Beaglebone Black

Hello, although I'm very impressed by your library and think its really great I'm having an issue with analogRead on my BBB. Althoug AIN5 pulled to GND this is what I read with your library

AIN0 [P9.39] - 3138
AIN1 [P9.40] - 124
AIN2 [P9.37] - 2987
AIN3 [P9.38] - 188
AIN4 [P9.35] - 3132
AIN5 [P9.36] - 169
AIN6 [P9.33] - 3254
AIN7 [P9.39] - 233

If I do this read multiple time the value switch between the AINs so it seems there is an issue with waiting or syncing the ADC clock with the read.

If I read AIN5 with the adafruitBBIO library which instead of yours just uses on the filesystem AIN read (like with cat /sys/devices/ocp....) which is in my opinion a much worse way of doing this i get:

root@beaglebone:~/AdafruitBBIO# python aread.py
ADC AIN5 voltage: 0.001000v

which is exactly what I expected.

I really would appreciate it if there was a fix for this. If you need some more information or testing just let me know!

PWM Bindings changed on Beaglebone Black.

Not necessarily a PyBBIO issue, but the bindings seemed to have changed quite a bit on BBB's Angstrom Distribution. I am not too familiar with the distribution, but /sys/class/pwm does not exist.

There are some clues to what has to happen in the new bonescript: https://github.com/jadonk/bonescript/blob/master/node_modules/bonescript/index.js

This discussion board post has some information too: https://groups.google.com/d/msg/beagleboard/wjbOVE6ItNg/Dym4H4HuI8gJ

IOError [Errno 17] when trying first time after installation

Having problems with Adafruit ADC on my Beaglebone Black giving very inconsistent readings on the analog inputs, I decided to check if it was a software problem by installing alexanderhiam/PyBBIO instead (well, on top - Adafruit still installed; don't know if it matters).
I installed using:

opkg update && opkg install python-distutils python-setuptools python-mmap python-pyserial python-smbus python-pip

pip install PyBBIO

No errors during installation (see install log at the end).

Then I run a very simple script (based on https://gist.github.com/omundy/2698550):

from bbio import *
def setup(): pass
print "-----"
print "AIN0 [P9.39] - " + str(analogRead(A0))

and executing:

python 2test.py


Traceback (most recent call last):
File "2test.py", line 47, in
print "AIN0 [P9.39] - " + str(analogRead(A0))
File "/usr/lib/python2.7/site-packages/bbio/platform/beaglebone/bone_3_8/adc.py", line 30, in analogRead
cape_manager.load(ADC_ENABLE_DTS_OVERLAY, auto_unload=False)
File "/usr/lib/python2.7/site-packages/bbio/platform/beaglebone/bone_3_8/cape_manager.py", line 22, in load
f.write(overlay)
IOError: [Errno 17] File exists

Thanks in advance. I really have a fight with analog reading of this BBB.
Nikolaj

Install Log:
root@beaglebone:~# pip install PyBBIO
Downloading/unpacking PyBBIO
Downloading PyBBIO-0.9.1.tar.gz (95kB): 95kB downloaded
Running setup.py egg_info for package PyBBIO

Requirement already satisfied (use --upgrade to upgrade): pyserial in /usr/lib/python2.7/site-packages (from PyBBIO)
Installing collected packages: PyBBIO
Running setup.py install for PyBBIO
PyBBIO device tree overlay directory not found, creating...
Generating and compiling GPIO overlays... Done!
Generating and compiling ADC overlays... Done!
Installing PyBBIO...
building 'bbio.platform.util.sysfs' extension
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -D__SOFTFP
_ -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c bbio/platform/util/sysfs.c -o build/temp.linux-armv7l-2.7/bbio/platform/util/sysfs.o
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -D__SOFTFP
-shared -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed build/temp.linux-armv7l-2.7/bbio/platform/util/sysfs.o -L/usr/lib -lpython2.7 -o build/lib.linux-armv7l-2.7/bbio/platform/util/sysfs.so
building 'bbio.platform.util.spi' extension
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -D__SOFTFP
-fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c bbio/platform/util/spimodule.c -o build/temp.linux-armv7l-2.7/bbio/platform/util/spimodule.o
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -D__SOFTFP
_ -shared -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed build/temp.linux-armv7l-2.7/bbio/platform/util/spimodule.o -L/usr/lib -lpython2.7 -o build/lib.linux-armv7l-2.7/bbio/platform/util/_spi.so
/usr/bin/python /tmp/tmp0PnE0W.py
removing /tmp/tmp0PnE0W.py

install finished with 0 warnings
PyBBIO is now installed on your BeagleBone >=3.8, enjoy!

Successfully installed PyBBIO
Cleaning up...

No module named distutils.core

I'm struggling with this whole unix python beaglebone thing so please forgive what must be a stupid question...

When I attempt to install your code I get the above error.
I see a note regarding distutils.core but do not understand how to correct the problem. Has the fix not been incorporated into the release? How do I fix it?

Can PyBBIO 0.8 runs on beaglebone white A6A version under ubuntu 1210 ?

I have installed PyBBIO under 1210 on A6A beaglebone white. I shows installation finished with 0 warning.
when trying the blink.py, it told me that python-smbus is not installed, quick fix with apt-get install python-smbus
I try blink.py again, it come out following
[ 2402.863765] bone-capemgr bone_capemgr.8: failed to load firmware 'PyBBIO-ADC-00A0.dtbo'
Traceback (most recent call last):
File "blink.py", line 27, in
run(setup, loop)
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/bbio.py", line 77, in run
bbio_init()
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/bbio.py", line 37, in bbio_init
platform_init()
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/platform/api.py", line 12, in platform_init
analog_init()
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/adc.py", line 16, in analog_init
cape_manager.load(ADC_ENABLE_DTS_OVERLAY, auto_unload=False)
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/cape_manager.py", line 22, in load
f.write(overlay)
IOError: [Errno 2] No such file or directory
root@arm:~/PyBBIO/examples#

It seems I have init error, my question is can V0.8 runs on beaglebone white?
If i wish to run pyBBIO on beaglebone white under ubuntu, which version should work?

Need info on PyBBIO internals - PWM analogWrite

Hi, I've found that the the analogWrite function is using the sysfs interface for generating PWM instead of /dev/mem as mentioned on the wiki. Is this is a work in progress or am i looking at the wrong file?
File i found was -> bbio/platform/beaglebone/bone_3_8/pwm.py

Cannot Import bbio

Disclaimer: I'm new to Python

I'm simply trying to run the blink.py example and am getting the error:

ImportError: No module name api

I've tried searching for some answers on forums and through Google, to no avail. I'm on a bit of a time crunch (need a working prototype in a little more than a day). Help would be very much appreciated.

Compile Error

I was getting this error whenever I tried to run or debug my program from Cloud9, and even when I tried an example, I got this error:

/var/lib/cloud9/PyBBIO/examples/blink.py:1
# blink.py - Ale
^
module.js:434
  var compiledWrapper = runInThisContext(wrapper, filename, true);
                        ^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:434:25)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Array.0 (module.js:484:10)
    at EventEmitter._tickCallback (node.js:190:38)

Device Tree overlay fails to load

This is the error I got while running blink.py after PyBBIO installation [ubuntu 13.04 - kernel 3.8.13]. I went through the source (config.py and cape_manager.py). I figured that the error pointed to the fact I did not have a "/sys/devices/bone_capemgr.9/slots" file (config.py - line 15). But this is weird as I do have that file, also while cape_manager.py was reading the same file (slots), there was no problem (cape_manager.py - line 17).

test

This is the output for cat of my slots file is :
test1

I wonder if this had anything to do with my linux settings (permissions) or whether I used this library in the wrong way.
[P.S - The samething worked perfectly on my Angstrom linux. The library also works on Arch linux (I had to tweak the source code a bit) ]
Thanks.

TypeError: must be string, not int

In a freshly installed Debian (2015-03-01) on Beaglebone Black Rev A6A, the encoder_test.py example shows this error:

Traceback (most recent call last):
  File "encoder_test.py", line 24, in <module>
    run(setup, loop)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 60, in run
    loop()
  File "encoder_test.py", line 22, in loop
    delay(1000)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/common.py", line 36, in delay
    time.sleep(ms/1000.0)
TypeError: must be string, not int
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 21, in bbio_cleanup
    for cleanup in ADDITIONAL_CLEANUP:
TypeError: must be string, not int
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 21, in bbio_cleanup
    for cleanup in ADDITIONAL_CLEANUP:
TypeError: must be string, not int

ImportError: No module named gst

I am new to BeagleBone and I am testing out the webcam_bbioserver_test.py example provided here with PYBBIO. I get the "Importerror: no module named gst" error. I checked for gst-inspect on the OS(Angstrom) and it shows the GST module installed. Please help me understand if the webcam requires any specific gst plugin to run? or does it have something to do with the configuration.

problem with setup.py

when trying to install to a custom directory with
$ python2 setup.py install --root=pkg
setup.py puts some files in the wrong directory:

$ find pkg/
[...]
pkg/usr/bbio/platform/beaglebone/i2c_setup.py
pkg/usr/bbio/platform/beaglebone/uart.py
pkg/usr/bbio/platform/beaglebone/adc.py
pkg/usr/bbio/platform/beaglebone/config.py
pkg/usr/bbio/platform/beaglebone/pinmux.py
pkg/usr/bbio/platform/beaglebone/pwm.py
pkg/usr/bbio/platform/api.py
[...]

while most files go to the right directory:
pkg/usr/lib/python2.7/site-packages/bbio/...

setup.py also seems to assume i'm running a 3.2 kernel

$ uname -a
Linux alarm 3.14.4-1-ARCH #1 SMP Sun May 18 18:32:31 MDT 2014 armv7l GNU/Linux

Distro:
ArchLinux Arm

Move ADC driver to C extension

adc.py should be replaced by a C extension (bbio/platform/beaglebone/adc.c) with the same API.

It could be done in the same way as the GPIO C extension, where the AIN files are left open, in which case it should also provide a C API to use in other extensions. This could be done in phases, i.e. start with a simple extension, then add the C API later on, in a future release perhaps.

adc.py: https://github.com/graycatlabs/PyBBIO/blob/master/bbio/platform/beaglebone/adc.py

NameError: global name 'UART' is not defined

I am using a Beaglebone White (Rev A6) and am running the 3.8 kernel. I cloned into the 3.8 branch after uninstalling my initial install and ran python setup.py install, which installed fine without any warnings.

Now, whenever I try to run the example for blinking (or anything else), I am getting the error

NameError: global name 'UART' is not defined

Full error output:
root@arm:~/PyBBIO# python examples/blink.py
Traceback (most recent call last): File "examples/blink.py", line 7, in <module> from bbio import * File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/__init__.py", line 4, in <module> from bbio import * File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/bbio.py", line 28, in <module> from platform import * File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/__init__.py", line 5, in <module> from api import * File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/api.py", line 9, in <module> from bbio.platform.beaglebone import * File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/__init__.py", line 9, in <module> from uart import * File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/uart.py", line 154, in <module> Serial1 = _UART_PORT('UART1') File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.6-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/uart.py", line 24, in __init__ assert uart in UART, "*Invalid UART: %s" % uart NameError: global name 'UART' is not defined

I have tried a clean install twice, and also did a git reset --hard and re-pull. The device tree stuff is also installed per the instructions. I did do an install of the stable branch originally, but uninstalled and reinstalled.

P.S. - I am already running code I need to with adafruit's 3.8 library but I like to test both and would be glad to help by submitting a pull request if I can narrow down what's going on :)

PWM out and RES_16BIT problem

Hello and thanks for the hard work.

I'm testing the PWM output (PWM1A) to regulate an LED brightness:

  • Issuing a pwmWrite(PWM1A, 255) works as expected and the LED lights up to full brightness (allowed by the voltage divider);
  • Issuing a pwmWrite(PWM1A, 65536, RES_16BIT) doesn't work, it doesn't log any error and the LED stays turned off. Changing values doesn't make any difference.

Tested with both PWM1* and PWM2*.
Any clues?

GPIO var design -- help me make sense of this?

Not a bug but I'm trying to understand the structure of the GPIO pin vars and just getting frustrated, there doesn't seem to be any logic to which pin is assigned what name though there is enough structure within this app that there is certainly some driving ideas...

No bbio module

Hi I went though the install process for ubuntu. It looked to install ok but when tested I get the following;
File "blink.py", line 7, in from bbio import no module named bbio. Iam using the Beaglebone Black 3.8.13
something must be a miss in the install ?

bbb crash/hangs on user led 2

hello, i am a new user of beaglebone black and have been using PyBBIO's client server codes to access my hardware. I've modified a code relating to the PyBBIOServer_test.py to run motors instead of LEDs but making a new modified python file brings a crash with it to the beaglebone every time i edit the code or test the code so please help me out ,as i am very desperate of it since i have a very less time relating to my project

GPIO pins order

Hi,i am a new user,the PyBBIO is perfect!But i still have some questions?
Why the GPIO pins are orderd by this way?It's irregularly in my thought.So,i need to open the image each time when i to use PyBBIO.
P8.12 - GPIO1_12
P8.14 - GPIO0_26
P8.15 - GPIO1_15
P8.16 - GPIO1_14
P8.17 - GPIO0_27
What's the advantage of it comparing to the official or bonescript's pins definitiion which looks like "P8_13" this way?

AIN read performance issue

I have wrote a small program to read as many requests as possible from AIN0:

from bbio import *
import time

bbio.bbio_init()

i = 0
j = 0
end = time.time() + 1
while time.time() < end:
x = analogRead(AIN0)
if x > 0:
i=i+1
else:
j=j+1
print "have read " ,i , " times in a second with ",j," failed."
bbio.bbio_cleanup()

I get the following output:

root@beaglebone:/python# python readAIN1_PyBBIO.py
have read 307 times in a second with 0 failed.
root@beaglebone:
/python# python readAIN1_PyBBIO.py
have read 320 times in a second with 0 failed.
root@beaglebone:/python# python readAIN1_PyBBIO.py
have read 313 times in a second with 0 failed.
root@beaglebone:
/python# python readAIN1_PyBBIO.py
have read 318 times in a second with 0 failed.
root@beaglebone:/python# python readAIN1_PyBBIO.py
have read 320 times in a second with 0 failed.
root@beaglebone:
/python# python readAIN1_PyBBIO.py
have read 317 times in a second with 0 failed.
root@beaglebone:/python# python readAIN1_PyBBIO.py
have read 318 times in a second with 0 failed.
root@beaglebone:
/python# python readAIN1_PyBBIO.py
have read 317 times in a second with 0 failed.
root@beaglebone:~/python# python readAIN1_console.py

when I do the same on Adafruit library, I get

import Adafruit_BBIO.ADC as ADC
import time

ADC.setup()
i = 0
j = 0
end = time.time() + 1
while time.time() < end:
x = ADC.read("AIN1")
if x > 0:
i=i+1
else:
j=j+1
print "have read " ,i , " times in a second with ",j," failed."

root@beaglebone:/python# ./readAIN1_console.py
have read 818 times in a second with 0 failed.
root@beaglebone:
/python# ./readAIN1_console.py
have read 822 times in a second with 0 failed.
root@beaglebone:/python# ./readAIN1_console.py
have read 820 times in a second with 0 failed.
root@beaglebone:
/python# ./readAIN1_console.py
have read 825 times in a second with 0 failed.
root@beaglebone:~/python# ./readAIN1_console.py
have read 820 times in a second with 0 failed.

So, I figured that you read from sysfs, are you still having plans for reading AIN0 from memory? Is there any way to get more reads per second?

Pullup resistors for input GPIO pins

I'm having some difficulty getting the pullup resistor functionality to work on a security system I'm building for my home.

Here's the code:

from bbio import *
from EventIO import *

# Define delay times
TRIGGER_TIME = 30 # seconds
DEPART_TIME = 30 # seconds

# Define pin locations
BEEP_PIN = PWM1A
ARM_PIN = GPIO1_28
DISARM_PIN = GPIO0_7
FRONT_DOOR_PIN = GPIO2_12
SIDE_DOOR_PIN = GPIO2_13
BACK_DOOR_PIN = GPIO2_8
MOTION_SENSOR_PIN = GPIO2_9

class SecuritySystem(object):
    """The security system core."""
    def __init__(self):
        # Setup the event loop
        self.event_loop = EventLoop()

    def arm_button(self):
        # The arm button was pressed
        print "arm button"

    def disarm_button(self):
        # The disarm button was pressed
        print "disarm button"

    def setup(self):
        # Initialize IO pins
        pinMode(ARM_PIN, INPUT, 1)
        pinMode(DISARM_PIN, INPUT, 1)
        pinMode(FRONT_DOOR_PIN, INPUT, 1)
        pinMode(SIDE_DOOR_PIN, INPUT, 1)
        pinMode(BACK_DOOR_PIN, INPUT, 1)
        pinMode(MOTION_SENSOR_PIN, INPUT, 1)

        # Attach events
        self.event_loop.add_event(DigitalTrigger(ARM_PIN, LOW, self.arm_button, 300))
        self.event_loop.add_event(DigitalTrigger(DISARM_PIN, LOW, self.disarm_button, 300))

        # Start the event loop
        self.event_loop.start()

    def loop(self):
        # Print out ARM_PIN state
        print digitalRead(ARM_PIN)

ss = SecuritySystem()
run(ss.setup, ss.loop)

Even thought I have pull=1 for the pinMode, I still always get LOW values for the state of the pins. I can substitute any of the other pins for ARM_PIN in the loop with the same result.

I'm using an Ubuntu image (http://elinux.org/BeagleBoardUbuntu#Precise_12.04_armhf) and have successfully used the pullup resistors on this bone before with bonescript on Angstrom.

Any idea what could be preventing the pullup resistors from activating?

Segmentation fault error

From <ahref="https://github.com/alexanderhiam/PyBBIO/issues/1">Issue 1:
"If I try the following with a photoresistor plugged-in I get a real value.
cat /sys/bus/platform/devices/tsc/ain1

But if I run an PyBBIO code that accesses any of the analog-inputs and then try to run the above cat I get a Segmentation fault error."

The problem seems to be that the _analog_cleanup() routine is at the moment restoring the ADC module to its default reset state, and the kernel's file system interface expects it to be in whatever state it is put into when the Beaglebone boots up. Once I figure out the state it wants to be in I'll set it in _analog_cleanup(), but for now to use the filesystem to access the ADC requires a reboot after using PyBBIO.

PWM and pin mux problems with 3.8 kernel

I've been trying to get PyBBIO up and running on a BeagleBone with the latest Angstrom image. I think that somethings have moved around with the 3.8 kernel. There's no /sys/class/pwm directory and from bbio import * fails. I've gone in and commented out everything to do with pwm but now PyBBIO complains about omap_mux file not found for pin muxing.

Is there an Angstrom image that is known to work 100% with PyBBIO? Even if it's old, do you know where I could find it?

PDF manual

It seems like many users don't find there way to the PyBBIO wiki (https://github.com/graycatlabs/PyBBIO/wiki), so there should be a generated PDF manual for each release.

I have plans to migrate the docs and tutorials to http://graycat.io, but that might not happen for a while, so the first PDF manual might have to be made from the wiki source.

using beaglebone black pwm

I've beaglebone black. when ı try to set pwm frequency, there is no pwm output and there is an warning at terminal like ' *PWM pin 'PWM1A' reserved by another process! ' (effective for all pwm output). but if ı don't use frequency comment, pwm works without any warning. here is comment

from bbio import*
pwmWrite(PWM1A,100,resolution=RES_8BIT)
pwmFrequency(PWM1A,2000)

import error on ubuntu14.02

Hi i installed pybbio for ubuntu trusty end i checked blink.py but got an error like

ubuntu@arm:/usr/local/lib/PyBBIO/examples$ sudo python blink.py
Traceback (most recent call last):
File "blink.py", line 7, in
from bbio import *
File "/usr/local/lib/python2.7/dist-packages/bbio/init.py", line 5, in
from .bbio import run, stop
File "/usr/local/lib/python2.7/dist-packages/bbio/bbio.py", line 10, in
from .platform import platform_init, platform_cleanup
File "/usr/local/lib/python2.7/dist-packages/bbio/platform/init.py", line 5, in
from beaglebone import *
File "/usr/local/lib/python2.7/dist-packages/bbio/platform/beaglebone/init.py", line 7, in
from bone_3_8 import config
File "/usr/local/lib/python2.7/dist-packages/bbio/platform/beaglebone/bone_3_8/config.py", line 20, in
SLOTS_FILE = glob.glob('/sys/devices/bone_capemgr.*/slots')[0]
IndexError: list index out of range

how can i solve it
regards
Fahri

Inconsistent/incorrect AIN values

From Issue 1:
"With a sensor plugged-into any analog-in port, all of the values I read with PyBBIO will practically match each other. But if I use another Python library or os module to access the values they are different according to what I expect."

BBIOServer slow

Hi, Alex,

I have tried BBIO server(set at port 8000) with several wifi router, it response very slow,takes about a min. but when I try to access cloud9 at port 3000, it response pretty quick.
what can I do with this?

Inconsistent/incorrect AIN values and Segmentation fault error

I encountered two separate issues with PyBBIO, summarized below and documented in detail here: http://stackoverflow.com/questions/10611294/reading-analog-in-on-beaglebone-avoiding-segmentation-fault-error.

PROBLEM 1: Inconsistent/incorrect AIN values

With a sensor plugged-into any analog-in port, all of the values I read with PyBBIO will practically match each other. But if I use another Python library or os module to access the values they are different according to what I expect.

PROBLEM 2: Segmentation fault error

If I try the following with a photoresistor plugged-in I get a real value.
cat /sys/bus/platform/devices/tsc/ain1

But if I run an PyBBIO code that accesses any of the analog-inputs and then try to run the above cat I get a Segmentation fault error.

serial can't transmit

Running the serial_echo or serial server on beaglebone A6A,both are able to receive but not able to transmit.

I did some more test as following:

after running serial_echo.py, I check the pin mux on serial2, I got:
root@beaglebone:~/PyBBIO/examples# cat /sys/kernel/debug/omap_mux/spi0_d0
name: spi0_d0.uart2_txd (0x44e10954/0x954 = 0x0011), b NA, t NA
mode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE1
signals: spi0_d0 | uart2_txd | i2c2_scl | NA | NA | NA | NA | gpio0_3

which has different value from what I saw on
http://www.gigamegablog.com/2012/01/22/beaglebone-coding-101-using-the-serial-and-analog-pins/

in this setting, my ttyO2 can only receive, but not able to send under minicom.

base on this gigamega, it should be 0x0001
so, I do : echo 1 > /sys/kernel/debug/omap_mux/spi0_d0

then open a minicom, the uart2 worked on receiving and sending...

I tried to write file spi0_d0=1 in python,after called serial2.begin():
fw = file("/sys/kernel/debug/omap_mux/spi0_d0", "w")
fw.write("%X" % (1))
fw.close()

the spi0_d0 is correctly 0x0001. but still get no out put from the serial tx.

I will go deeper into the serial.write and serial.prints....

Problem with PWM Beaglebone black

Hi,

I want to inform about a probelm that I found. When I try to use two PWM of the same module (PWM1A and PWM1B) this error ocurrs:

from
/pwm.py
in
pwmEnable(pwm_pin)
in
if (sysfs.kernelFilenameIO('%s/%s' % (helper_path, PWM_RUN)) == '1\n'):
in
/sysfs.py
in
fn = glob.glob(fn)[0]

Index error: List index out of range

but the error doesn't happen when I use two PWM of different modules (PWM1A and PWM2B).

Thanks!

Problem when installing PyBBIO-missing header files

Hi,
While trying to install PyBBIO today on Beaglebone Image 09-12-12 with kernel version 3.2.28, I run into the following error:

In file included from /usr/lib/gcc/arm-angstrom-linux-gnueabi/4.5.4/include-fixed/syslimits.h:7:0,
from /usr/lib/gcc/arm-angstrom-linux-gnueabi/4.5.4/include-fixed/limits.h:34,
from /usr/include/python2.7/Python.h:19,
from bbio/platform/beaglebone/src/beaglebone.c:9:
/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.5.4/include-fixed/limits.h:169:61: error: no include path in which to search for limits.h
In file included from bbio/platform/beaglebone/src/beaglebone.c:9:0:
/usr/include/python2.7/Python.h:33:19: fatal error: stdio.h: No such file or directory
compilation terminated.
error: command 'arm-angstrom-linux-gnueabi-gcc' failed with exit status 1

Could you please help with this?

Beaglebone Black installation problem

First of all, thanks a lot for such a nice effort. The ADC reading through sysfs from Adafruit library is increadibly slow. I hope that PyBBIO approach will be faster. I am really glad you are providing such a nice library. However I am having a configuration problem. When I install PyBBIO I see the following error:

Installing PyBBIO...
FATAL ERROR: Couldn't open "/lib/firmware/PyBBIO-src/PyBBIO-ADC-00A0.dts": Not a directory
Copying and compiling static overlays... Done!
Old PyBBIO device tree overlay directory found, overwriting...
Generating and compiling GPIO overlays...
Traceback (most recent call last):
File "tools/install-bb-overlays.py", line 110, in
generateOverlays()
File "tools/install-bb-overlays.py", line 79, in generateOverlays
with open('%s/%s-%s.dts' % (firmware_source_path, overlay_name, version), 'wb') as f:
IOError: [Errno 20] Not a directory: '/lib/firmware/PyBBIO-src/PyBBIO-gpio0_9-00A0.dts'
running install
...
Finished processing dependencies for PyBBIO==0.8
install finished with 0 warnings
PyBBIO is now installed on your BeagleBone Black, enjoy!

When I try to execute an example, I get the following:

python blink.py
Traceback (most recent call last):
File "blink.py", line 27, in
run(setup, loop)
File "/usr/lib/python2.7/site-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/bbio.py", line 89, in run
bbio_init()
File "/usr/lib/python2.7/site-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/bbio.py", line 38, in bbio_init
platform_init()
File "/usr/lib/python2.7/site-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/platform/api.py", line 12, in platform_init
analog_init()
File "/usr/lib/python2.7/site-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/adc.py", line 16, in analog_init
cape_manager.load(ADC_ENABLE_DTS_OVERLAY, auto_unload=False)
File "/usr/lib/python2.7/site-packages/PyBBIO-0.8-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/cape_manager.py", line 22, in load
f.write(overlay)
IOError: [Errno 2] No such file or directory

Is there still a problem with DTS for Beaglebone Black?

Rebooting after toggling IO causes file system to go to read only

debian@arm:~$ sudo python
Python 2.7.3 (default, Mar 14 2014, 17:55:54)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from bbio import *

pyserial module not found; to install:

opkg update && opkg install python-pyserial

PyBBIO initialized

pinMode(GPIO1_7, OUTPUT)
toggle(GPIO1_7)
toggle(GPIO1_7)
toggle(GPIO1_7)
toggle(GPIO1_7)
quit()
Finished PyBBIO cleanup
debian@arm:~$ sudo shutdown -r 0; exit
sudo: unable to open /var/lib/sudo/debian/0: Read-only file system

This is the 3rd time this has happened today (forces me to re-flash the BBB). The other two times happened with pySerial installed as well...

PyBBIO example program error

Hi,

I am fairly new to python, and very new to using the beaglebone.

I followed through your instructions and installed the module fine with no errors. I got to the point where you tested blink.py. However when i try to run it i get the following code in the terminal.

root@beaglebone:~/PyBBIO/examples# python blink.py
Traceback (most recent call last):
File "blink.py", line 7, in
from bbio import *
File "/usr/lib/python2.7/site-packages/bbio/init.py", line 4, in
from bbio import *
File "/usr/lib/python2.7/site-packages/bbio/bbio.py", line 45, in
from config import *
File "/usr/lib/python2.7/site-packages/bbio/config.py", line 340, in
for i in PWM_PINS.keys())
File "/usr/lib/python2.7/site-packages/bbio/config.py", line 340, in

for i in PWM_PINS.keys())

IOError: [Errno 2] No such file or directory: '/sys/class/pwm/ehrpwm.2:1/request
'

It may be something very simple that im missing, but im lost to what it could be. Any help would be much appreciated.

Thanks, Sam

Beaglebone with Ubuntu

Hallo,

Traceback (most recent call last):
File "", line 1, in
File "bbio.py", line 58, in
with open("/dev/mem", "r+b") as f:
IOError: [Errno 13] Permission denied: '/dev/mem'

thanks Bernd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.