When using libpruio you neither need device tree compilers nor overlays for analog or digital pin configurations. All setup gets done in single source inside your program, controlling the driver that is running on a co-processor (PRUSS). All you have to ensure to load the kernel driver for the PRU subsystem and start it once at system startup.
Once the library is installed, selected users can use it without the need of admin privilegues.
libpruio is based on libprussdrv from the package am335x_pru_package. You've to download and install the FB prussdrv Kit (de) first. Find English installation instructions in this link at the bottom of the German page.
To compile changes in the examples or in the library source code, you need an ARM version of the FreeBASIC compiler. The binaries in this package were compiled by BBB-FBC (de), an english discussion on this project should be available at this site (contact admins if the link is still down).
To execute software based on libpruio driver you have to ensure that
/dev/uio5
system interruptThe first and second preconditions can be reached at once. Either activate one of the prepared operating systems device tree overlays. Ie. execute
Or you use the minimal overlay provided in the above mentioned FB prussdrv Kit package, which needs to get installed in the right folder (/lib/firmware), first. Then execute
Both device tree overlays start the PRUSS and also load the kernel driver. The kernel driver allocates external memory for the PRUSS, which is a default of 256 kB. (See section External Ram on how to customize this.)
Item 3 can either be reached by running the software as user root
. But the prefered method should be installing privilegues for the related users:
addgroup pruio
)chgrp pruio /dev/uio5
)chmod g+rw /dev/uio5
)This package contains a pre-compiled version of the libpruio binaries in the folder src/c_wrapper. It's the universal (all-in) version, including the C wrapper functions. This section is about the installation instructions.
To install libpruio on your system and use it in your FreeBASIC code, you have to copy the binaries to a folder where the linker can find them. Futhermore copy the headers to a propper place where the compiler can find them. Starting from the basis folder of the unpacked libpruio package and execute:
The author isn't a C expert and doesn't know if if this is a propper insatallation. To compile the C examples the following was done (starting from the basis folder of the unpacked libpruio package):