Hello…
I am first time work on beaglebone.I want to generate Clock of 3Khz on timer7 (P8_8)pin og beaglebone.
here is my code.
import Adafruit_BBIO.GPIO as GPIO
import time
outpin=“P8_8”
GPIO.setup(outpin,GPIO.OUT)
GPIO.setclock(outpin,3000)
while True:
GPIO.output(outpin,GPIO.HIGH)
time.sleep(2)
GPIO.output(outpin,GPIO.LOW)
time.sleep(2)
On Mon, 28 Jan 2019 01:27:39 -0800 (PST),
sayalikutwal07@gmail.com declaimed the
following:
Hello..
I am first time work on beaglebone.I want to generate Clock of 3Khz on
timer7 (P8_8)pin og beaglebone.
here is my code.
import Adafruit_BBIO.GPIO as GPIO
import time
outpin="P8_8"
GPIO.setup(outpin,GPIO.OUT)
GPIO.setclock(outpin,3000)
while True:
GPIO.output(outpin,GPIO.HIGH)
time.sleep(2)
GPIO.output(outpin,GPIO.LOW)
time.sleep(2)
-------------------------------------------------------------------------------------
It gives error..
GPIO.setclock(outpin,3000)
AttributeError: 'module' object has no attribute 'setclock'
Furthermore, your while loop takes four seconds to execute -- that
equates to a frequency of 0.25Hz. Generating a 3kHz square wave would
require time.sleep(0.000166666666) -- presuming the OS clock allows for
sleeps that small (note: you will also be affected by any OS pre-emption of
your program). [Total loop time 0.000333333]
Hello.
I want the step by step process to generate clock on P8_8 pin of beaglebone .
and require python code to for the same .The step by step process to set prescaler.
The possible alternative (I've not dug up the Technical Reference
Manual) might require mmap'ing to the timer control registers, and writing
the needed values to it. That assumes mmap can be set to go to hardware
addresses and not virtual addresses.
On Tue, 29 Jan 2019 11:50:23 +0530, sayali kutwal
<sayalikutwal07@gmail.com> declaimed the
following:
Hello.
I want the step by step process to generate clock on P8_8 pin of
beaglebone .
and require python code to for the same .The step by step process to set
prescaler.
Dennis
I think he wants you to code his college assignment for him and he doesn’t wanna read the TRM.
They used to give code examples in TRM today’s future engineers I’m getting scared😊
On Tue, 29 Jan 2019 18:55:49 +0000 (UTC), "'Mark Lazarewicz' via
BeagleBoard" <beagleboard@googlegroups.com>
declaimed the following:
DennisI think he wants you to code his college assignment for him and he doesn't wanna read the TRM.They used to give code examples in TRM today's future engineers I'm getting scared?
No doubt -- but that I don't provide (I haven't read enough of the TRM
to even attempt this using C).
My normal response is "how would you do that in C?" and then maybe
assist in porting the C to Python.
Sorry Dennis I guess I’m not very tactful. I’ll try and rephrase.
Doesn’t programming any internal microprocessor registers start with the TRM programming in any language? I can’t comprehend not reading the TRM then using a bunch of library functions in some code I found without understanding what the code is doing. I guess if it works and you don’t care about how it works that’s fine. I’ve always been fascinated with the details of the registers.these newer chips are quite complex and reading the relavent chapter takes some time and can be daunting but I always figured that was how you really understood the low level
Hello.
It’s not my collage assignment. I just want to learn the beaglebone for curiosity. So i want to generate the clock on pin P8_8 (timer7) beaglebone.
For this i write python code…
import Adafruit_BBIO.GPIO as GPIO
import time
outpin=“P8_8”
GPIO.setup(outpin,GPIO.OUT)
GPIO.setclock(outpin,3000)
while True:
GPIO.output(outpin,GPIO.HIGH)
time.sleep(2)
GPIO.output(outpin,GPIO.LOW)
My one experience with Python was some HWIL I was modifying for NASA Satellite to test my bootloader written in C. I’m a C programmer I’m not familiar with this library where did you get this
time.sleep(2) statement?
Maybe you are not importing the correct objects. If SLEEP exists you need to find how to pull it in if it doesn’t exist write your own. I’m sure you can see this sleep is used to generate a square wave of a certain frequency you can see on the the o scope on the pin.Sleep is going to somehow convert the 2 into seconds or milliseconds etc and put into a processor register of a timer for that so you might need to study TRM.
If I was a professor teaching microprocessors Id leave that to the student to complete to see if he’s got the ambition to dig deep and understand the chip.
Getting some code to compile on a target sounds more like some programming exercise. If you want to learn embedded software engineer not be a programmer learning to write such code will be helpful and require read TRM.
On Wed, 30 Jan 2019 10:04:21 +0530, sayali kutwal
<sayalikutwal07@gmail.com> declaimed the
following:
Hello.
It's not my collage assignment. I just want to learn the beaglebone
for curiosity. So i want to generate the clock on pin P8_8 (timer7)
beaglebone.
For this i write python code...
import Adafruit_BBIO.GPIO as GPIO
import time
outpin="P8_8"
GPIO.setup(outpin,GPIO.OUT)
GPIO.setclock(outpin,3000)
while True:
GPIO.output(outpin,GPIO.HIGH)
time.sleep(2)
GPIO.output(outpin,GPIO.LOW)
time.sleep(2)
----------------------------------------------
But there is not any library for timer.so i am not getting anything.
after searching i find the term DMTimer to generate clock for beaglebone
but i dont know how to do it.
so please guide me step by step.
STEP ONE: READ the TRM section on timers
Step Two: determine how you would access the settings using a low-level
language (C, assembler)
Step Three: port that code to Python -- which might mean writing a
C-language extension library that you can import (read the Extending Python
manual) as direct hardware access may not be possible in pure Python.
Since no one has provided a quick solution, the odds are very good that
no one reading this thread has ever done what you are asking... And that
means ANY OF US would have to do the above three steps to answer you. And
since none of us (except you) has the interest, that leaves it on you to do
the needed research.