Hi sayalik!

Your task gets very simple when you drop Adafruit library and use libpruio 
<http://github.com/dtjf/libpruio> instead. The code

#!/usr/bin/python
## \file
# \brief Example: set 3 kHz timer on P8_08.
#
# This file contains an example on how to use libpruio to set a 3kHz
# timer on pin 10 on header P8.
#
# Licence: GPLv3, Copyright 2019 by Thomas{dot)Freiherr( at ]gmx[dot}net

from __future__ import print_function
from libpruio import *

## The header pin to set
PIN = P8_08

## Create a ctypes pointer to the pruio structure
io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0)
try:
  ## The pointer dereferencing, using contents member
  IO = io.contents
  if IO.Errr: raise AssertionError("pruio_new failed (%s)" % IO.Errr)
  if pruio_tim_setValue(PIN, 1/3, 0, 0): #         settimer output 3 kHz
    raise AssertionError("setting timer failed (%s)" % IO.Errr)
  if pruio_config(io, 1, 0x1FE, 0, 4): #  upload settings, start IO mode
    raise AssertionError("config failed (%s)" % IO.Errr)
  ##      IO mode is running, you should see 3 kHz timer output on P8_08
  print("Press <Crtl>-C to stop")
  try:
    while True:
  except KeyboardInterrupt:
    print("") #                                           clear terminal
finally:
  pruio_destroy(io)

It sets timer7 at 3 kHz until you stop by pressing <Crtl>-C. Then it 
restores the system to its original state.

In order to run that code you'll have to install libpruio. Here's the 
command sequence for kernel 4.14 (it may differ for other kernels)

echo deb http://beagle.tuks.nl/debian jessie/ > 
/etc/apt/sources.list.d/tuks.list
echo deb-src http://beagle.tuks.nl/debian jessie/ >> 
/etc/apt/sources.list.d/tuks.list
wget -qO - http://beagle.tuks.nl/debian/pubring.gpg | sudo apt-key add -
apt-get update
apt-get install python-pruio libpruio-klm libpruio-doc
adduser <YourUserID> pruio
rm /boot/dtbs/`uname -r`/am335x-boneblack-uboot-univ.dtb

Execute all commands with root privilegues. (The last one kills the trigger 
file for cape-universal, instead rename it if you want to use ist later.)

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/88e552b3-734d-4759-af9b-a87f948b6a06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to