I hope I found the right place to post this question, google groups looks somewhat confusing to me
I just tried to install libpruio as described in the wiki downloading and installing the key and adding the repositories. Updating the repositories sadly causes an error:
After some searching I found a solution suggesting to put [trusted=yes] in front of the repo-urls which resolves some of the errors but something seems off still:
I finally got to continue my project and got libpruio running sampling some happy ADC-values. In my use-case it would be optimal to have some kind of continuous sampling with a given sampling rate (something slow, 1KHzâŚ10Hz) that should be timed precise, so in the best case PRU only. Looking at âPruIo::configâ I only see an option to sample a fixed amount of samples which means I would have to trigger another run manually from the host ARM-program. Is there a way to implement some kind of continuous sampling? If so, could someone point me in the right direction? Thanks
Iâm having an issue running the python examples.
Iâm running the bone-debian-9.12-console image.
Iâve installed libpruio, python-pruio, libpruio-lkm, and libpruio-doc.
I copied the python-pruio examples into my home directory and try to run an example:
debian@beaglebone:~/src/pruio_examples$ python3 1.py Traceback (most recent call last): File "1.py", line 18, in <module> from libpruio import * File "/home/debian/src/pruio_examples/libpruio/__init__.py", line 1, in <module> from pruio import * ImportError: No module named 'pruio'
is related to the uio_pruss driver. The interupt handler is either not present (command lsmod doesnât list uio_pruss, or command ls -l /dev/uio* has no output). Or you donât have write access to that file.
In any case you need to load the adapted uEnv.txt (uboot_overlay_pru modification). And itâs also recommended to remove cape_universal=enable from the cmdline in order to get free pinmux access to all pins from user space.
I didnât see cape_universal=enable in cmdline. I set uboot_overlay_pru to the UIO option. I also tried both commenting out enable_uboot_cape_universal=1 and just setting it to 0. I get the same error as before.
First, the boot process seems to be OK. The driver uio_pruss as well as the libpruio-lkm are loading.
`
Traceback (most recent call last):
File âsrc/pruio_examples/1.pyâ, line 25, in
if IO.Errr: raise AssertionError(âpruio_new failed (%s)â % IO.Errr)
AssertionError: pruio_new failed (parsing kernel claims)
`
This seems to be a kernel issue. Does the command cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins print anything reasonable?
`
debian@beaglebone:~$ python3 src/pruio_examples/1.py
Traceback (most recent call last):
File âsrc/pruio_examples/1.pyâ, line 18, in
from libpruio import *
File â/home/debian/src/pruio_examples/libpruio/init.pyâ, line 1, in
from pruio import *
ImportError: No module named âpruioâ
`
Here the python interpreter cannot find the file pruio.py in folder /home/debian/src/pruio_examples/libpruio/. But it should be present since python2 did find it. (Is there any difference between python2 and python3 regarding module import? Sorry, I'm not keen on python.)
Regards
PS: Google groups is really strange, it's a desaster!
Iâm not sure about the differences between importing in python 2 vs 3. Iâll look into it more. I did try running python3 interactively in the libpruio directory and tried an import directly.
debian@beaglebone:~/src/pruio_examples/libpruio$ ls init.py pycache ctypesloader.pyc pruio.pyc init.pyc ctypesloader.py pruio.py
debian@beaglebone:~/src/pruio_examples/libpruio$ python3
Python 3.5.3 (default, Jul 9 2020, 13:00:10)
[GCC 6.3.0 20170516] on linux
Type âhelpâ, âcopyrightâ, âcreditsâ or âlicenseâ for more information.
import pruio
Traceback (most recent call last):
File ââ, line 1, in
File â/home/debian/src/pruio_examples/libpruio/pruio.pyâ, line 3, in
from ctypesloader import *
File â/home/debian/src/pruio_examples/libpruio/ctypesloader.pyâ, line 375
except OSError,e:
^
SyntaxError: invalid syntax
I think that line should read âexcept OSError as e:â to be valid python 3. I changed that and got another error.
debian@beaglebone:~/src/pruio_examples/libpruio$ vim ctypesloader.py
debian@beaglebone:~/src/pruio_examples/libpruio$ python3
Python 3.5.3 (default, Jul 9 2020, 13:00:10)
[GCC 6.3.0 20170516] on linux
Type âhelpâ, âcopyrightâ, âcreditsâ or âlicenseâ for more information.
import pruio
Traceback (most recent call last):
File ââ, line 1, in
File â/home/debian/src/pruio_examples/libpruio/pruio.pyâ, line 3, in
from ctypesloader import *
File â/home/debian/src/pruio_examples/libpruio/ctypesloader.pyâ, line 48, in
class UserString:
File â/home/debian/src/pruio_examples/libpruio/ctypesloader.pyâ, line 100, in UserString
def count(self, sub, start=0, end=sys.maxint):
AttributeError: module âsysâ has no attribute âmaxintâ
The pinmux-pins output is reasonable. Do you have read access to the file from user space?
Regarding the errors in ctypesloader.py: this isnât my code. I just reduced code from the ctypes documentation to the bare minimum. Perhaps you can try the original file?
  Short answer: Python 3 unified the logic of native ints vs Python 2
"longints"; they automatically roll over to a longint if incremented far
enough. As a result, there isn't really a "maxint" anymore.
  I'd suggest running the entire library through the 2 to 3 conversion
process.
$ ls -l /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
-rw-rw-r-- 1 root gpio 0 Jan 1 1970 /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
$ cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (PIN0): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 1 (PIN1): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 2 (PIN2): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 3 (PIN3): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
âŚ
python2 works, python3 doesnât.
The file pinmux-pins is acessable for users of group gpio on my system. In your output the lines containing ocp:Px_xx_pinmux indicate that the cape-universal device-tree blob is loaded and claims the pins. Try enable_uboot_cape_universal=0 in uEnv.txt.