hello.
I am trying to control a WS2813 LED STRIP.
On the Raspberry Pi, it works well with the help of several modules.
I was wondering if there is a python module to control the PWM on the AI64.
/dev/bone/pwm/2/b
capture duty_cycle enable period polarity power uevent
With the above files, I tried to control the PWM with sysfs.
enabled pwm0(overlay edit) and checked the waveform on osiloscope.
But I can’t seem to get it to produce an 8-bit waveform, let alone a 24-bit one.
No matter how many times you enter duty_cycle and change enable 0 and 1 for a short period of time, you’ll get a lot of waveforms on the oscilloscope.
So I can’t run 0code and 1code over and over again.
In /dev/bone/, there should be another form of usage for timers and/or counters.
I will go and research these ideas now, i.e. as I have not used them or used them recently.
For instance:
The primary difference between the PWM module and the timer module is that the timer module has only one compare register and can only be configured to trigger a hardware output event on one comparison value at any time.
The above quote is from nxp.com. I am sure there are many ideas floating around w/ nxp and ti and other research that can be derived. I can test this soon. My programming skills, as I say, are weak and my Oscilloscope work is not good (I have an o-scope that likes 5v).
Anyway, I am researching how in fact one can come to the short wave nonfluctuating PWM signal… This will be good for me. I need to learn more of the intricacies instead of all the “fun.”
Oh!
Nordic Semiconductor Infocenter and instead of just pushing random logic ideas at you, I will get out the O-Scope if you will walk me through it.
It seems no matter how much or how little I learn at some intervals, I retain little.
So…I hope this is helpful. If not, please try those counters and timers in /dev/bone/.
That is why hard working people like those people are around… To make my life easier! I will get the o-scope out and try it… Give me time and please reply to me by my screen name so I can see the ideas, updates, and gestures.
Seth
Update
So, what is the main goal? Should I try to use a motor in this theory? I will look up how to get an 8-bit waveform going or a 24-bit one too…
I will try some source that has given insight from guidance. Until I get this set up done, I can send over some ideas when you want (my testing of ideas)…
@silver2row
Thanks for the reply.
First of all my goal is to get the LED STRIP working.
create a 0 code, 1 code from a PWM running at 800khz and export a 24 bit waveform.
I saw your answer and looked up the TDA4VM manual. Enhanced High Resolution Pulse-Width Modulator Module (eHRPWM) and was wondering if you know anything about this.
Oh…I don’t care.
I’m not an embedded developer, I’m just trying to understand PWM behavior and the goal is to get the LED STRIP working on AI64.
I don’t mind if I’m late in replying, I’m in a non-English speaking country so I can’t understand your intentions 100%, but I’ll try to find some resources and give it a go.
In yellow, we have AI64 repeatedly send a 0 code and a 1 code from Python, but only a 0 code is output multiple times. (My intention is to have 0 code output once, and then 1 code).
Blue is the waveform from the Raspberry Pi sending PWM to the LED STRIP.
(yellow)
I coded to create a waveform with period and duty_cycle, but it didn’t work.
(Blue)
If you look closely at the waveforms, you can see the waveforms with 0 code and 1 code. (The part with the long HIGH is the 0 code part)
I want to export a waveform like the blue one to AI64’s PWM.
Not tonight but soon. I need to find the correct image that beagleboard.org provided to handle sysfs and their builds. Until then, I am a bit out. C/C++ is something I was going to mention earlier but…
I can tell from programming that C is faster to use on the end user compared to Python3.
Also…I will get on the image process first, then build from that point forward, and then report back.
I thought it was going to be as easy as 1-2-3 but the images I have found so far are not allowing me to use the peripherals of the TDA4VM and so on…
Seth
P.S. Your Tektronix is far superior to my Rigol. I have two channels, a smaller screen, and the software for it is a bit dated. 2006. Anyway, updates on the way (not now though). Sleep time!
@ALEX_PARK , I found the correct image w/ the ehrpwm modules located on it…
If you go and get an image w/ /opt/dtbs/ located in that file, use make && sudo make install_arm64.
That should make it accessible for you to use those modules. Now, for the timers and eQEP modules, I have not found out how to utilize them yet, i.e. as I am not in charge of porting the hardware to DTS format nor could I do it anyway.
Seth
P.S. I think BONE-PWM{0-2}.dtbo is not the same thing. Is BONE-PWM1 the same as ehrpwm?
Okay. So, w/out further evidence here, I am posting a photo of period and duty_cycle on the ehrpwm channel at P9.25.
I will read more in time and report back. For now, that is what I am getting on my set up. I have been reading on my oscilloscope details. The guide book is okay, I guess. Anyway, I will produce a better reference waveform later in the week, i.e. Sat. or Sun.
The weekend was okay. Finally…rest. Anyway, in the new image (Bookworm), there are two pins that are listed as ehrpwm on the /boot/firmware/overlays/ files that one can add in w/ the /boot/firmware/extlinux/extlinux.conf file.
From my knowledge, this does not specifically mean that the other PWMSS pins are not ehrpwm enabled but maybe they are not.
I will test again and see if I cannot get better results like we discussed earlier last week.
Update
Here is the Bookworm page on this forums w/ the ehrpwm peripheral access overlays:
Another Update and Ideas…
I have all my PWM overlays enabled which includes the ehrpwm overlays at P9.25/P8.37.
Do you think testing PWM1 and then ehrpwm at P9.25 will encounter different results on the oscilloscope?
If I encounter different results, I will reply w/ that info. and add photos in the mix.
I had some issues w/ the software on my oscilloscope. Bugs. I should report them to Rigol. I had to erase every form of source from Rigol to get rid of the pop-up installs. Blah.
Anyway, I can test right now even though I need to learn the divisible part of my connections w/ the Rigol in mind. Updates on the way. Also, the link I posted can get you about 200MHz loops from the PRU…
Just a heads up here. These photos so far mean nothing to me. I need to research exactly what they mean.
The first photo is the ehrpwm overlay being used w/:
echo 500000 > period
echo 10000 > duty_cycle
echo 1 > enable
The second photo is the pwm at file /dev/bone/pwm/1/a/.
echo 500000 > period
echo 10000 > duty_cycle
echo 1 > enable
So far, and as I update firmware to the scope (phew), I have noticed that at the same time and at the same voltage, I have different ideas presented.
Oh and I know what you said earlier about my angle on this discussion which is listed further up the post. No issue but my intentions are to learn more and use this discussion to handle that learning.
#!/bin/bash
pwm_path="/dev/bone/pwm/bbai64_P9_25_ehrpwm4_b/"
while true; do
echo 400 > "${pwm_path}duty_cycle"
echo 800 > "${pwm_path}duty_cycle"
done
I created a bash script to alternate the duty cycle between 400 and 800.
Instead of generating and changing one waveform, we generate and change 43 waveforms.
As I said above, I want to make 24 bits of 0 code, 1 code with 1.25us period (800khz), and when I make one set of 24, I want to send it to PWM. (If I make 24 bits, I will have 24 waveforms).
I was wondering if there is any other way to do this besides changing the duty_cycle to echo.
For example, DMA?