libpruio (BB D/A - I/O fast and easy)

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
c136
Posts: 7
Joined: Apr 05, 2016 13:46
Location: Bavaria

Re: libpruio (BB D/A - I/O fast and easy)

Post by c136 »

Hi TJF,

has anyone been able to get the library going using Arch Linux? I am using Arch with kernel 4.5.0-1 (which has capemgr again) on a BeagleBone Green and currently can't get the libpruio device tree overlay blob provided with the download into my /sys/devices/platform/bone_capemgr/slots...
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

H1 c136!

I didn't test on Arch Linux yet and I don't know about users running that. In any case pinmuxing will be a problem since the path names for ocp changed in the newer kernels, so libpruio cannot change pin modes, but will run with pre-set pins.

AFAIK the device tree compiler changed between kernels 3.8 and 4.x and there're differences in the dtbo format. I had to re-compile the libpruio-00A0.dts file with the matching dtc of the kernel version to run on 4.1 kernel. Also try this, first.

If this doesn't help, please send the output from dmesg:

dmesg | grep bone_cape

BR

PS:
Notifications are working again here. I just switched them off and on again.
c136
Posts: 7
Joined: Apr 05, 2016 13:46
Location: Bavaria

Re: libpruio (BB D/A - I/O fast and easy)

Post by c136 »

Hi TFJ,

Thank you! That helped.

Now... If I only want to use C/C++ code with your library, I won't have to install and setup the FreeBasic compiler?

I followed the install procedure in the online documentation. However, running e.g. the /src/c_examples/1 application for testing results in:

Code: Select all

./1: error while loading shared libraries: libpruio.so: cannot open shared object file: No such file or directory
When I try to recompile it (the 1.c) on the BeagleBone Green with Arch I get

Code: Select all

In file included from 1.c:20:0:
../c_wrapper/pruio.h:197:7: error: 'PRUIO_AZ_GPIO' undeclared here (not in a function)
 *Init[PRUIO_AZ_GPIO + 1], //!< initial device configuration, used in the destructor  PruIo:~
       ^
../c_wrapper/pruio.h:337:7: error: 'PRUIO_AZ_PWMSS' undeclared here (not in a function)
 *Init[PRUIO_AZ_PWMSS + 1], //!< initial device configuration, used in the destructor  PruIo:
       ^
In file included from 1.c:20:0:
../c_wrapper/pruio.h:396:15: error: 'PRUIO_AZ_BALL' undeclared here (not in a function)
   uint8 Value[PRUIO_AZ_BALL + 1];//!< The values of the pad control registers.
c136
Posts: 7
Joined: Apr 05, 2016 13:46
Location: Bavaria

Re: libpruio (BB D/A - I/O fast and easy)

Post by c136 »

Sorry, I can't edit my post above...

In Arch Linux you obviously have to cp libpruio.so /usr/lib and not to /usr/local/lib (http://users.freebasic-portal.de/tjf/Pr ... ation.html). I also did cp src/c_wrapper/pruio*.h* /usr/include.

That now gives me

Code: Select all

[alarm@BBG libpruio-0.2]$ sudo src/c_examples/1
src/c_examples/1: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
Where do I get that from?
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

c136 wrote:Now... If I only want to use C/C++ code with your library, I won't have to install and setup the FreeBasic compiler?
As long as you use the library AS-IS, you wont need FreeBASIC. If you want to change the library, ie. to fix the maximum sample rate bug, you'll have to install FreeBASIC.
c136 wrote:I followed the install procedure in the online documentation. However, running e.g. the /src/c_examples/1 application for testing results in:

Code: Select all

./1: error while loading shared libraries: libpruio.so: cannot open shared object file: No such file or directory
Your run-time linker cannot find the binary -> installation problem.

Did you install the binary in a system path? Did you update the linker cache?

Code: Select all

sudo ldconfig
Otherwise, did you try to set the linker path

Code: Select all

LD_LIBRARY_PATH=...
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

c136 wrote:When I try to recompile it (the 1.c) on the BeagleBone Green with Arch I get

Code: Select all

In file included from 1.c:20:0:
../c_wrapper/pruio.h:197:7: error: 'PRUIO_AZ_GPIO' undeclared here (not in a function)
 *Init[PRUIO_AZ_GPIO + 1], //!< initial device configuration, used in the destructor  PruIo:~
       ^
../c_wrapper/pruio.h:337:7: error: 'PRUIO_AZ_PWMSS' undeclared here (not in a function)
 *Init[PRUIO_AZ_PWMSS + 1], //!< initial device configuration, used in the destructor  PruIo:
       ^
In file included from 1.c:20:0:
../c_wrapper/pruio.h:396:15: error: 'PRUIO_AZ_BALL' undeclared here (not in a function)
   uint8 Value[PRUIO_AZ_BALL + 1];//!< The values of the pad control registers.
You should have seen another error message first, complaining on a missing header file named pruio.hp. This macro is defined in that file. Did you install it? How, and where?
c136
Posts: 7
Joined: Apr 05, 2016 13:46
Location: Bavaria

Re: libpruio (BB D/A - I/O fast and easy)

Post by c136 »

Thanks for your reply.
TJF wrote:Your run-time linker cannot find the binary -> installation problem.
Yes, indeed.

As I have tried to post before, apparently it is found when in /usr/lib instead of /user/local/lib. However, I still haven't figured out libtinfo.so.5.
Did you update the linker cache?
Yes, I did.
You should have seen another error message first, complaining on a missing header file named pruio.hp
No other error message. I have it in /usr/include and actually also in a folder /usr/local/include as copied from src/c_wrapper/.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

c136 wrote: As I have tried to post before, apparently it is found when in /usr/lib instead of /user/local/lib. However, I still haven't figured out libtinfo.so.5.
An Arch issue. Sorry, I can't help (anywhere you can add /usr/local/lib to the run-time linker path, which may help to avoid trouble with the package manager).

Maybe it's better to do small steps. First try with an default Debian (3.8 kernel) image and then switch to Arch?
c136 wrote: No other error message. I have it in /usr/include and actually also in a folder /usr/local/include as copied from src/c_wrapper/.
The file is in src/pruio. In src/wrapper, it's a link. Maybe the link didn't get handled by the unpacking tool? Check the files context. In case of doubts, install from src/pruio/pruio.hp.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

c136 wrote: However, I still haven't figured out libtinfo.so.5.
I just g**gl*d "libtinfo arch". It seems to be in the libncurses-dev package.
engkan2kit
Posts: 1
Joined: Apr 17, 2016 17:47

Re: libpruio (BB D/A - I/O fast and easy)

Post by engkan2kit »

Hi

I was able to make the SOS work with user LED3 and the button example. I am using the pre-compiled libpruio dtbo file. However, when I changed the Pins of the sos example, it does not work. Stepper also does not work. I attached 4 LEDs to P8_11,P8_12,P8_13, and _P8_14 with the anode on the pins and Cathode on gnd. I can confirm the LEDs are fine because if I connect them to P9_11,12 and 13, they're on. I also test stepper and sos on P9_11-14. The LEDs are initially on but when the sos or stepper programs are run, the are turned off. They are turned on again after I exit the programs. I ran a command like this echo x0F > /sys/devices/ocp.*/pruio-12.*/state for the involve pins before I ran the examples.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hello engkan2kit,

welcome at the forum and thanks for your report. Unfortunatelly it's a bit confusing and I need more information to understand what's going on:
engkan2kit wrote:I was able to make the SOS work with user LED3 and the button example. I am using the pre-compiled libpruio dtbo file.
Fine. Which version of libpruio do you use? Which kernel version do you use? Please post the output of command
  • uname -a
engkan2kit wrote:However, when I changed the Pins of the sos example, it does not work.
Where did you change the pin? (There's just one in the sos example!) Which pin did you choose? How did you compile and run the example? What did you expect that didn't happen?
engkan2kit wrote:Stepper also does not work. I attached 4 LEDs to P8_11,P8_12,P8_13, and _P8_14 with the anode on the pins and Cathode on gnd. I can confirm the LEDs are fine because if I connect them to P9_11,12 and 13, they're on.
What kind of LEDs did you use? (BBB GPIO is designed for a maximum current of 6 mA, usual LEDs consume about 20 mA.) The example is designed to work on pins P8_08, P8_10, P8_12 and P8_14 (not P8_11, P8_13). Which command did you execute in order to run the pre-compiled examples binary?
engkan2kit wrote:I also test stepper and sos on P9_11-14. The LEDs are initially on but when the sos or stepper programs are run, the are turned off. They are turned on again after I exit the programs. I ran a command like this echo x0F > /sys/devices/ocp.*/pruio-12.*/state for the involve pins before I ran the examples.
Which feedback do you get when loading the device tree overlay? Post the output of
  • dmesg | grep bone
BR
c136
Posts: 7
Joined: Apr 05, 2016 13:46
Location: Bavaria

Re: libpruio (BB D/A - I/O fast and easy)

Post by c136 »

TJF wrote:The file is in src/pruio.
Ah yes of course, my bad.
t seems to be in the libncurses-dev package.
Thank you very much for your time and help!

A libncurses-dev package does not exist in/for Arch Linux. Unfortunately the ncurses5-compat-libs from the AUR is not ARMv7 compatible (at least that's what makepkg -sri tells me).
ncurses-6.0-4 is installed on my system, as shown by pacman.

So I tried to create a link manually by sudo ln -s /usr/lib/libtinfo.so /usr/lib/libtinfo.so.5 - that led to a Segmentation fault when trying to sudo ./1 in the .../src/c_examples
c136
Posts: 7
Joined: Apr 05, 2016 13:46
Location: Bavaria

Re: libpruio (BB D/A - I/O fast and easy)

Post by c136 »

Actually I am obviously not quite awake and forgot to echo libpruio > slots.
However, sudo ./1 now leads to a

Code: Select all

Bus error
.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

c136 wrote:sudo ./1 now leads to a

Code: Select all

Bus error
.
You'll never need sudo, since libpruio-0.2 doesn't support run-time pinmuxing on kernels > 3.8.
c136 wrote:ncurses-6.0-4 is installed on my system, as shown by pacman.
Install the -dev version.
c136 wrote:So I tried to create a link manually by sudo ln -s /usr/lib/libtinfo.so /usr/lib/libtinfo.so.5 - that led to a Segmentation fault when trying to sudo ./1 in the .../src/c_examples
Remove the link. Instead, compile against the newer ncurses6-dev binaries.
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by marcov »

(afaik ncurses can build with everything in one (ncurses) library, and one that splits out terminfo into a separate libtinfo for oses that didn't have an libterminfo of their own. I haven't followed this up recently, but in the past rule of thumb was RPM distributions typically have tinfo separately, deb ones have them integrated)
Post Reply