[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-09-14 Thread Andrew Harres
Thank you! It's coming along well. I ran into a strange issue today. I 
connected a 4-20ma sensor to the board and something strange happened. Now, 
this is probably induced by some sort of over voltage to the adc pin or 
something nasty going on, but after this event happened, the adc 
measurements froze (subsequent reads from the adc return the exact same 
number). So I tried restarting my program and it would hang on 
pruio_config(). I tried restarting libpruio-lkm.service with no luck. I 
think a big clue as to what happened is the fact that the heartbeat led 
stopped flashing. Eventually I power cycled the board and everything 
returned to normal. It seems like the pru's locked up (probably in response 
to an over-volt situation on an analog input)

On Friday, September 11, 2020 at 3:30:14 AM UTC-5 TJF wrote:

> Sorry, I forgot the second part of the command:
>
> *ExecStartPre=/bin/dash -c 'until [ -e /dev/uio5 ] ; do sleep 1 ; done ; 
>> /bin/chown root:pruio /dev/uio5'*
>>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/96f3038b-fc98-4592-9229-ece42ebaea16n%40googlegroups.com.


Re: [beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-09-10 Thread Andrew Harres
That's very clever, but it looks like the file exists before it's usable by 
libpruio. I tried ConditionPathIsReadWrite, but the file is readwritable 
before it's usable by libpruio as well. I noticed that the file permissions 
and group changes which seems to correlate with libpruio being able to use 
the file. Unfortunately, I don't see anything in the systemd documentation 
about file owner or permission conditions in service files.

On Thursday, September 10, 2020 at 2:21:02 PM UTC-5 RobertCNelson wrote:

> On Thu, Sep 10, 2020 at 1:55 PM Andrew Harres  wrote:
> >
> > Hello again!
> >
> > I'm trying to solve a minor problem. I made a systemd service which 
> starts my program automatically. My problem is that my program is starting 
> too early which causes this error:
> >
> > AssertionError: pruio_new failed (b'cannot open /dev/uio5')
> >
> >
> > The program will exit and the systemd service will keep restarting the 
> program until eventually (less than a minute) the program will run 
> successfully.
> >
> > Here is my systemd service file:
> >
> > [Unit]
> > After=generic-board-startup.service libpruio-lkm.service
> > StartLimitIntervalSec=0
> >
> > [Service]
> > Type=simple
> > Restart=always
> > User=debian
> > WorkingDirectory=/opt/rad/virtual_sensor
> > ExecStart=/opt/rad/virtual_sensor/virtual_sensor
> >
> > [Install]
> > WantedBy=multi-user.target
> >
> > I realize that since the libpruio-lkm service doesn't exit, putting it 
> in the 'after' section doesn't really make sense. Surely someone has dealt 
> with this problem before, but I couldn't find it while searching.
>
> Add this option to your service:
>
> ConditionPathExists=/dev/uio5
>
> Wish systemd had a wait for module option..
>
> Regards,
>
>
> -- 
> Robert Nelson
> https://rcn-ee.com/
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/78f4859b-e23e-4f82-8172-622034ffb23bn%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-09-10 Thread Andrew Harres
Hello again!

I'm trying to solve a minor problem. I made a systemd service which starts 
my program automatically. My problem is that my program is starting too 
early which causes this error:

AssertionError: pruio_new failed (b'cannot open /dev/uio5')


The program will exit and the systemd service will keep restarting the 
program until eventually (less than a minute) the program will run 
successfully.

Here is my systemd service file:

[Unit]
After=generic-board-startup.service libpruio-lkm.service
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
User=debian
WorkingDirectory=/opt/rad/virtual_sensor
ExecStart=/opt/rad/virtual_sensor/virtual_sensor

[Install]
WantedBy=multi-user.target

I realize that since the libpruio-lkm service doesn't exit, putting it in 
the 'after' section doesn't really make sense. Surely someone has dealt 
with this problem before, but I couldn't find it while searching.
On Friday, August 21, 2020 at 1:49:01 AM UTC-5 TJF wrote:

> Am Donnerstag, 20. August 2020 20:27:41 UTC+2 schrieb andrew...@gmail.com:
>>
>> Sorry about that.
>>
>
>> My adc measurements are good and stable. My only issue now is that I 
>> can't seem to enable the serial port under libpruio. I'll post my code here:
>>
>
> Apology accepted.
>
> Fine, that ADC is OK. I hope your code calls the destructor 
> pruio_destroy() at the end.
>  
>
>> I tried every mode from 0 to 7 and got the same result.
>>
>
> You configured the hardware, but I guess you didn't care about the 
> software. Did you load the UArt kernel driver?
>
> When you configure pins from a device tree blob the kernel also loads the 
> matching driver. In contrast, libpruio doesn't inform the kernel about 
> changes. It's under your control to make this happen.
>
> If you're sure that you want Uart-1 on P9_24/P9_26, and that wont change, 
> then it's best to install a custom device tree blob for that two pins. 
> Check out the docs for section Custom overlay 
> .
>  
> You can use the tool src/config/dts_custom.bas 
> 
>  
> to create that blob in folder /lib/firmware. Your configuration (edit in 
> source and compile) should look like
>
> M(P9_24) = CHR(0)
>>
> M(P9_26) = CHR(0)
>>
>
> Perhaps you also want to adapt the file name. When the .dtbo file is in 
> place, edit /boot/uEnv.txt to load it and reboot.
>
> Regards
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/6ef84d84-5d6b-4ed5-93ea-b9d8c588a95cn%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-20 Thread andrew . harres
My mistake. I had disabled the libpruio-lkm service while trying to 
troubleshoot the issue I'm having with the serial port. Sorry about that.

My adc measurements are good and stable. My only issue now is that I can't 
seem to enable the serial port under libpruio. I'll post my code here:

# serial_demo.py

from libpruio import *
import serial

io = pruio_new(PRUIO_ACT_FREMUX + PRUIO_ACT_ADC, 16, 0x98, 0)
IO = io.contents

if IO.Errr:
raise AssertionError("pruio_new failed (%s)" % IO.Errr)

if (IO.setPin(io, P9_24, 0)):
raise AssertionError("P9_24 configuration failed (%s)" % IO.Errr)

if (IO.setPin(io, P9_26, 0)):
raise AssertionError("P9_26 configuration failed (%s)" % IO.Errr)

if (pruio_config(io, 1, 0x1FE, 0, 4)):
raise AssertionError("config failed (%s)" % IO.Errr)

ser = serial.Serial('/dev/ttyS1', 9600)

When I try to run this code, I get an input/output error:
(env) debian@beaglebone:~/src/virtual_sensor$ python serial_demo.py
Traceback (most recent call last):
  File 
"/home/debian/src/virtual_sensor/env/lib/python3.5/site-packages/serial/serialposix.py"
, line 323, in _reconfigure_port
orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "serial_demo.py", line 19, in 
ser = serial.Serial('/dev/ttyS1', 9600)
  File 
"/home/debian/src/virtual_sensor/env/lib/python3.5/site-packages/serial/serialutil.py"
, line 240, in __init__
self.open()
  File 
"/home/debian/src/virtual_sensor/env/lib/python3.5/site-packages/serial/serialposix.py"
, line 272, in open
self._reconfigure_port(force_update=True)
  File 
"/home/debian/src/virtual_sensor/env/lib/python3.5/site-packages/serial/serialposix.py"
, line 326, in _reconfigure_port
raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output 
error')


I get a similar error if I try to open the serial port from picocom:
debian@beaglebone:~$ picocom /dev/ttyS1
picocom v1.7

...

FATAL: failed to add device /dev/ttyS1: Filedes is not a tty

debian@beaglebone:~$ ls -l /dev/ttyS*
crw--w 1 root tty 4, 64 Aug 20 18:03 /dev/ttyS0
crw-rw 1 root dialout 4, 65 Aug 20 18:03 /dev/ttyS1
crw-rw 1 root dialout 4, 66 Aug 20 18:03 /dev/ttyS2
crw-rw 1 root dialout 4, 67 Aug 20 18:03 /dev/ttyS3
crw-rw 1 root dialout 4, 68 Aug 20 18:03 /dev/ttyS4
crw-rw 1 root dialout 4, 69 Aug 20 18:03 /dev/ttyS5

debian@beaglebone:~$ groups
debian adm kmem dialout cdrom floppy audio dip video plugdev users 
systemd-journal 
input bluetooth netdev pruio cloud9ide xenomai weston-launch tisdk docker 
i2c iio spi admin remoteproc eqep pwm gpio

I tried every mode from 0 to 7 and got the same result.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/9849648f-358f-487e-bf8e-af0724271cc9o%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-19 Thread andrew . harres
I get this error when running your code. I can read the adc just fine.

AssertionError: P9_24 configuration failed (b'pinmux missing')

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/2f86c928-b2e9-4158-9888-e4a6677d69aao%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-19 Thread andrew . harres
I can't find a reference to the setPin function in the python library

I assume I should be able to do this:
from libpruio import *

io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0)

pruio_setPin(io, P9_24, 0)

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/2fb7bef9-c66a-4141-96fa-2a550d47501ao%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-18 Thread andrew . harres
I'm having trouble using the uarts alongside libpruio. I assume this is due 
to the changes done to install libpruio.

I'm unable to use the config-pin:
Cannot read pinmux file: /sys/devices/platform/ocp/ocp*P9_24_pinmux/state

I know there is a way to configure gpios with the libpruio c library, but I 
cannot find anything in the documentation about the uarts.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/c84790ba-4613-48d9-bbc5-1849f0d493a3o%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-14 Thread Andrew Harres
That's it! These udev rules are the key. I was able to get this working on 
the original bone-debian-9.12-console image I was using.

This is what I did after installing a fresh image, updating, and adding the 
sources for libpruio

$ sudo apt install libpruio libpruio-dev python-pruio libpruio-lkm
$ sudo usermod -a -G pruio debian

edit /boot/uEnv.txt with the following changes (as for the first change, 
just comment out whichever uboot_overlay_pru parameter exists originally):
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
#enable_uboot_cape_universal=1

Finally, just make sure you have both udev rules pointed out in the last 
post. On my system, 84-gpio-nonroot.rules was missing.

On Thursday, August 13, 2020 at 1:55:23 PM UTC-5 TJF wrote:

> On my system I found the files
>
> # /etc/udev/rules.d/84-gpio-noroot.rules
>> #
>> # Corrects sys GPIO permissions on the BB so non-root users in the gpio 
>> group can manipulate bits
>> #
>> # Change group to gpio
>> KERNEL=="44e10800.pinmux", PROGRAM="/bin/sh -c '/bin/chown -R root:gpio 
>> /sys/kernel/debug/pinctrl/44e10800.pinmux'"
>> # Change user permissions to ensure user and group have read/write 
>> permissions
>> KERNEL=="44e10800.pinmux", PROGRAM="/bin/sh -c '/bin/chmod ugo+x 
>> /sys/kernel/debug; /bin/chmod -R ug+rw 
>> /sys/kernel/debug/pinctrl/44e10800.pinmux'"
>>
>
> and
>
> # /etc/udev/rules.d/85-gpio-noroot.rules
>> #
>> # Corrects sys GPIO permissions on the BB so non-root users in the gpio 
>> group can manipulate bits
>> #
>>
>> SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
>>
>
> adapting the permissions. I wonder why they're not present in all systems. 
> (Are they from the -bone flavour?)
>
> Regards
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/75f0f41f-d527-4be4-8b83-1fb253cc72e5n%40googlegroups.com.


Re: [beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-13 Thread Andrew Harres
debian@beaglebone:~$ uname -r
4.14.108-ti-r136

debian@beaglebone:~$ groups
debian adm kmem dialout cdrom floppy audio dip video plugdev users 
systemd-journal input bluetooth netdev cloud9ide xenomai weston-launch 
tisdk docker i2c iio spi admin remoteproc eqep pwm gpio

debian@beaglebone:~$ sudo chown root:gpio 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins

debian@beaglebone:~$ sudo chmod 664 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins

debian@beaglebone:~$ sudo 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

debian@beaglebone:~$ cat 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
cat: /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins: Permission 
denied

debian@beaglebone:~$ python3 src/pruio_examples/1.py
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 (b'parsing kernel claims')


I'm back on the 4.14 kernel to get closer to what you have. I modified the 
pinmux-pins permissions to be just like yours. I'm already in the gpio 
group. What do your permissions look like for the whole directory structure 
leading up to pinmux-pins?

The 2to3 procedure worked perfectly for me as well: 

debian@beaglebone:~$ python3 src/pruio_examples/1.py
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 (b'parsing kernel claims')

debian@beaglebone:~$ sudo python3 src/pruio_examples/1.py
F940 EBD0 F4A0 88C0 58A0 9EB0 B6C0 F1E0
F960 EE70 F510 C170 9600 91A0 9990 F200
F950 EE10 F530 C630 A400 A0A0 A1D0 F1E0
F970 EE30 F510 C680 A640 A470 A680 F1F0
F990 EE10 F4E0 C680 A6B0 A5C0 A910 F200
F990 EE30 F500 C660 A6B0 A630 AA10 F1E0
F980 EE00 F4F0 C680 A660 A5D0 A980 F1C0
F980 ED90 F4E0 C640 A590 A520 A8D0 F1D0
F950 ED90 F510 C5F0 A520 A470 A7B0 F1B0
F940 EDC0 F500 C5C0 A4F0 A420 A6B0 F1D0
F960 EDA0 F4D0 C5C0 A4B0 A3B0 A630 F210
F940 EDC0 F500 C5B0 A450 A370 A5C0 F1C0
F940 EDF0 F4F0 C5D0 A4E0 A3C0 A5F0 F1B0

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/e80e6e61-263e-4a8d-904d-439b0263c510n%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
debian@beaglebone:~$ uname -r
5.4.52-ti-r16
debian@beaglebone:~$ sudo ls -l 
/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins
-r--r--r-- 1 root root 0 Jan  1  1970 
/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins

On Wednesday, August 12, 2020 at 4:17:34 PM UTC-5 Andrew Harres wrote:

> debian@beaglebone:~$ uname -r
> 4.19.94-ti-r45
> debian@beaglebone:~$ sudo ls -l 
> /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins
> -r--r--r-- 1 root root 0 Jan  1  1970 
> /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins
>
> On Wednesday, August 12, 2020 at 3:25:38 PM UTC-5 Andrew Harres wrote:
>
>> I set enable_uboot_cape_universal=0 and I have the same result. My 
>> permissions for pinmux-pins looks much different than yours.
>>
>> debian@beaglebone:~$ ls -l 
>> /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
>> ls: cannot access 
>> '/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins': Permission denied
>> debian@beaglebone:~$ sudo ls -l 
>> /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
>> -r--r--r-- 1 root root 0 Jan  1  1970 
>> /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
>>
>> I'll try a different kernel.
>>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/9230b892-6ee8-4c83-9d7d-c8b5f89ecaf6n%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
debian@beaglebone:~$ uname -r
4.19.94-ti-r45
debian@beaglebone:~$ sudo ls -l 
/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins
-r--r--r-- 1 root root 0 Jan  1  1970 
/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins

On Wednesday, August 12, 2020 at 3:25:38 PM UTC-5 Andrew Harres wrote:

> I set enable_uboot_cape_universal=0 and I have the same result. My 
> permissions for pinmux-pins looks much different than yours.
>
> debian@beaglebone:~$ ls -l 
> /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
> ls: cannot access '/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins': 
> Permission denied
> debian@beaglebone:~$ sudo ls -l 
> /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
> -r--r--r-- 1 root root 0 Jan  1  1970 
> /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
>
> I'll try a different kernel.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/5bd09148-7786-4f3d-a7d3-e4159b2db744n%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
I set enable_uboot_cape_universal=0 and I have the same result. My 
permissions for pinmux-pins looks much different than yours.

debian@beaglebone:~$ ls -l 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
ls: cannot access '/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins': 
Permission denied
debian@beaglebone:~$ sudo ls -l 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
-r--r--r-- 1 root root 0 Jan  1  1970 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins

I'll try a different kernel.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/13e708a5-6f31-47ab-8cde-7261ec54e56cn%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
I do not.

debian@beaglebone:~$ cat 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
cat: /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins: Permission 
denied

On Wednesday, August 12, 2020 at 12:42:04 PM UTC-5 TJF wrote:

> 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?
>
> Regards
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/ee8d027d-ad2f-4fad-a39d-982b5aa8b6afn%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
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'

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/67822a3e-476f-45ac-896f-7c455eb3cdb4n%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
I'm not sure what counts as reasonable.

debian@beaglebone:~$ sudo cat 
/sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-p
ins
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
pin 4 (PIN4): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group 
pinmux_emmc_pins
pin 5 (PIN5): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group 
pinmux_emmc_pins
pin 6 (PIN6): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group 
pinmux_emmc_pins
pin 7 (PIN7): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group 
pinmux_emmc_pins
pin 8 (PIN8): ocp:P8_19_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_19_default_pin group pinmux_P8_19_default_pin
pin 9 (PIN9): ocp:P8_13_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_13_default_pin group pinmux_P8_13_default_pin
pin 10 (PIN10): ocp:P8_14_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_14_default_pin group pinmux_P8_14_default_pin
pin 11 (PIN11): ocp:P8_17_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_17_default_pin group pinmux_P8_17_default_pin
pin 12 (PIN12): ocp:P8_12_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_12_default_pin group pinmux_P8_12_default_pin
pin 13 (PIN13): ocp:P8_11_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_11_default_pin group pinmux_P8_11_default_pin
pin 14 (PIN14): ocp:P8_16_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_16_default_pin group pinmux_P8_16_default_pin
pin 15 (PIN15): ocp:P8_15_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_15_default_pin group pinmux_P8_15_default_pin
pin 16 (PIN16): ocp:P9_15_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_15_default_pin group pinmux_P9_15_default_pin
pin 17 (PIN17): ocp:P9_23_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_23_default_pin group pinmux_P9_23_default_pin
pin 18 (PIN18): ocp:P9_14_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_14_default_pin group pinmux_P9_14_default_pin
pin 19 (PIN19): ocp:P9_16_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_16_default_pin group pinmux_P9_16_default_pin
pin 20 (PIN20): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 21 (PIN21): leds (GPIO UNCLAIMED) function user_leds_s0 group 
user_leds_s0
pin 22 (PIN22): leds (GPIO UNCLAIMED) function user_leds_s0 group 
user_leds_s0
pin 23 (PIN23): leds (GPIO UNCLAIMED) function user_leds_s0 group 
user_leds_s0
pin 24 (PIN24): leds (GPIO UNCLAIMED) function user_leds_s0 group 
user_leds_s0
pin 25 (PIN25): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 26 (PIN26): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 27 (PIN27): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 28 (PIN28): ocp:P9_11_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_11_default_pin group pinmux_P9_11_default_pin
pin 29 (PIN29): ocp:P9_13_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_13_default_pin group pinmux_P9_13_default_pin
pin 30 (PIN30): ocp:P9_12_pinmux (GPIO UNCLAIMED) function 
pinmux_P9_12_default_pin group pinmux_P9_12_default_pin
pin 31 (PIN31): ocp:P8_26_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_26_default_pin group pinmux_P8_26_default_pin
pin 32 (PIN32): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins 
group pinmux_emmc_pins
pin 33 (PIN33): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins 
group pinmux_emmc_pins
pin 34 (PIN34): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 35 (PIN35): ocp:P8_18_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_18_default_pin group pinmux_P8_18_default_pin
pin 36 (PIN36): ocp:P8_07_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_07_default_pin group pinmux_P8_07_default_pin
pin 37 (PIN37): ocp:P8_08_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_08_default_pin group pinmux_P8_08_default_pin
pin 38 (PIN38): ocp:P8_10_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_10_default_pin group pinmux_P8_10_default_pin
pin 39 (PIN39): ocp:P8_09_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_09_default_pin group pinmux_P8_09_default_pin
pin 40 (PIN40): ocp:P8_45_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_45_default_pin group pinmux_P8_45_default_pin
pin 41 (PIN41): ocp:P8_46_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_46_default_pin group pinmux_P8_46_default_pin
pin 42 (PIN42): ocp:P8_43_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_43_default_pin group pinmux_P8_43_default_pin
pin 43 (PIN43): ocp:P8_44_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_44_default_pin group pinmux_P8_44_default_pin
pin 44 (PIN44): ocp:P8_41_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_41_default_pin group pinmux_P8_41_default_pin
pin 45 (PIN45): ocp:P8_42_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_42_default_pin group pinmux_P8_42_default_pin
pin 46 (PIN46): ocp:P8_39_pinmux (GPIO UNCLAIMED) function 
pinmux_P8_39_default_pin group pinmux_P8_39_default_pin
pin 47 (PIN47): ocp:P8_40_pinmux (GPIO 

[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread Andrew Harres
google groups has been strange. Looks like it has just updated and I don't 
see how to include code tags.

debian@beaglebone:~$ python --version
Python 2.7.13
debian@beaglebone:~$ python3 --version
Python 3.5.3

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/600265f2-41bd-4c05-82fc-ba9ef5792f94n%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-12 Thread andrew . harres
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.

debian@beaglebone:~$ cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.14.108-ti-r136
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: 
http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/.dtbo
#uboot_overlay_addr1=/lib/firmware/.dtbo
#uboot_overlay_addr2=/lib/firmware/.dtbo
#uboot_overlay_addr3=/lib/firmware/.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/.dtbo
#uboot_overlay_addr5=/lib/firmware/.dtbo
#uboot_overlay_addr6=/lib/firmware/.dtbo
#uboot_overlay_addr7=/lib/firmware/.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
#enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (6 = 384KB)
#uboot_fdt_buffer=0x6
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=
100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 
rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh


debian@beaglebone:~$ lsmod
Module  Size  Used by
pvrsrvkm  442368  0
spidev 20480  0
uio_pdrv_genirq16384  0
usb_f_acm  16384  2
u_serial   20480  3 usb_f_acm
usb_f_ncm  28672  2
usb_f_rndis32768  4
u_ether20480  2 usb_f_ncm,usb_f_rndis
libcomposite   65536  16 usb_f_acm,usb_f_ncm,usb_f_rndis
libpruio   16384  0
uio_pruss  16384  0
uio20480  2 uio_pruss,uio_pdrv_genirq

debian@beaglebone:~$ ls -l /dev/uio*
crw-rw 1 root users 244, 0 Aug 12 15:28 /dev/uio0
crw-rw 1 root users 244, 1 Aug 12 15:28 /dev/uio1
crw-rw 1 root users 244, 2 Aug 12 15:28 /dev/uio2
crw-rw 1 root users 244, 3 Aug 12 15:28 /dev/uio3
crw-rw 1 root users 244, 4 Aug 12 15:28 /dev/uio4
crw-rw 1 root users 244, 5 Aug 12 15:28 /dev/uio5
crw-rw 1 root users 244, 6 Aug 12 15:28 /dev/uio6
crw-rw 1 root users 244, 7 Aug 12 15:28 /dev/uio7

debian@beaglebone:~$ python src/pruio_examples/1.py
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)

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'



On Tuesday, August 11, 2020 at 4:15:25 PM UTC-5, TJF wrote:
>
> Am Dienstag, 11. August 2020 21:24:48 UTC+2 schrieb andrew...@gmail.com:
>>
>> Is python 3 not supported?
>>
>
> AFAIR I tested on python 2 and 3.
>
> The message
>
> (cannot open /dev/uio5)
>>
>
> 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.
>
> Regards
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/a7a30031-5651-4931-9662-c55546b44649o%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-11 Thread andrew . harres
I actually already had it installed. I tried running it again in python 2 
without the uboot_overlay_pru modification and get this:

debian@beaglebone:~$ python src/pruio_examples/1.py
destructor warning: constructor failed
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 (cannot open /dev/uio5)

Is python 3 not supported?

On Tuesday, August 11, 2020 at 12:59:24 PM UTC-5, TJF wrote:
>
> Am Dienstag, 11. August 2020 18:19:13 UTC+2 schrieb andrew...@gmail.com:
>>
>> I've installed libpruio, python-pruio, libpruio-lkm, and libpruio-doc. 
>>
> ...
>> Is there something I'm missing?
>>
>
> AFAIR the python interpreter (ctypes) also needs the dev-package to bind 
> the library: libpruio-dev
>
> Regards
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/7aa4a809-79e4-4fa0-9f36-cf2341ed6510o%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-11 Thread andrew . harres
I edited /boot/uEnv.txt:

###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###

I then tried running with python 2 after rebooting:

debian@beaglebone:~/src/pruio_examples$ python 1.py
Traceback (most recent call last):
  File "1.py", line 25, in 
if IO.Errr: raise AssertionError("pruio_new failed (%s)" % IO.Errr)
AssertionError: pruio_new failed (parsing kernel claims)


-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/0427a382-5fc0-41f0-a0eb-b9b6b1956629o%40googlegroups.com.


[beagleboard] Re: libpruio (fast and easy D/A - I/O)

2020-08-11 Thread andrew . harres
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 
from libpruio import *
  File "/home/debian/src/pruio_examples/libpruio/__init__.py", line 1, in 

from pruio import *
ImportError: No module named 'pruio'

Is there something I'm missing?

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/6eb11c14-843b-4740-805a-49573720fd4co%40googlegroups.com.