PWM on digital out

Applications, development tools, FPGA, C, WEB
Post Reply
Egeus
Posts: 3
Joined: Mon Aug 03, 2015 10:27 am

PWM on digital out

Post by Egeus » Fri Oct 16, 2015 10:51 am

Hi,
is it possibly to control one of the digital out pins with (software) pwm? I need to adjust the brightness on a LED. It should have a frequency greater then 100Hz (about 1000Hz would be really nice). I control the RP with the serial interface.
Thanks,
Chris

jmontse
Posts: 10
Joined: Tue Sep 08, 2015 7:00 pm

Re: PWM on digital out

Post by jmontse » Sat Oct 17, 2015 2:34 pm

I have found that with the new version of Scope+generator, the generator allows additional output signal modes, and one of them is PWM.
Another matter is if there is a new console command that brings PWM out easily....
The latest 0.94 OS documentation seems that still is being written.

Egeus
Posts: 3
Joined: Mon Aug 03, 2015 10:27 am

Re: PWM on digital out

Post by Egeus » Mon Oct 19, 2015 10:15 am

The generator console command only allow to control the FPGA-outputs. I want to use a boring digital pin (of the extension connector E1). The use of the fpga outputs is a little bit oversized, becaus I just want to control the brightness of a led.
Thank you,
Chris

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: PWM on digital out

Post by Nils Roos » Mon Oct 19, 2015 11:58 pm

The monitor command line tool does probably not execute fast enough to use it for bash-pwm. Either you dedicate one of the auxiliary analog outputs to your led and configure it via monitor or you write a program that toggles a gpio pin yourself.

Egeus
Posts: 3
Joined: Mon Aug 03, 2015 10:27 am

Re: PWM on digital out

Post by Egeus » Thu Oct 22, 2015 1:33 pm

I think you are right, the monitor tool is not fast enough. The timing is terrible...

I tried a Bash-Script like this:

while true
do
monitor 0x40000010 0x02 #Turn led on
usleep $timeOn #Wait
monitor 0x40000010 0x00 #Turn another led on and first off
usleep $timeOff #Wait
done

The timing was set so that it was 990µs off and 10µs on but it makes no difference when I set it so 10µs off and 990µs on...
Or had I done a misstake? Any other ideas? A control with the analog outputs is not possible (Voltage is not high enough).

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 83 guests