I see someone has recently asked a question on this old post.

Controlling pwm using linux is nicely documented in kernel docs:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-pwm

controlling simple servo takes period 20 ms and duty_cycle 1 - 2 ms, start 
with these values
echo 20000000 > /sys/class/pwm/pwmchip[num]/pwm[num]/period 
... rest is up to you

As for the 'howto' described by Tekuconcept in previous reply, I wouldn't 
bother about modifying dtb files anymore:
-Upgrade kernel to 4.1 (since this post is originally about the 3.14 kernel)
     --- add 'deb [arch=armhf] http://repos.rcn-ee.com/ubuntu trusty main' 
to apt sources (modify to own needs), install new linux-image.
     --- modify /boot/uEnv.txt or /boot/uboot/uEnv.txt so the new kernel is 
loaded, I mixed up my original uEnv and the suggestions from:
         
https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-DealingwitholdBootloaderineMMC
     --- dont screw up uEnv... (manual loading of kernel image in memory 
using uboot console is possible with serial debugger but painfull...)
-clone 'bb-overlays' github repo and install
-clone 'universal-io'  github repo and install
-reboot (took me an hour to figure this one out...)
Now you can 'config-pin overlay cape-universaln', 'config-pin P[num] pwm'. 
(all in user space)

That's about it, works flawless. (took me a couple of days to figure 
everything out though, as hobbyist it's fishing for the correct info on the 
web...)

kind regards,
Dieter

     






On Wednesday, July 15, 2015 at 1:46:00 PM UTC+2, rod0...@gmail.com wrote:
>
> after doing so how do you control duty cycle, period...?
>
> On Thursday, April 16, 2015 at 7:29:59 AM UTC-6, TekuConcept wrote:
>>
>>
>>    - config-pin [pin] [state] will mux the pins to the PWM Subsystems
>>    - Modifying am33xx.dtsi under the dtb-rebuilder project such that: 
>>    epwmss0, epwmss1, and epwmss2 status = "okay", and their children, 
>> ehrpwm0, 
>>    ehrpwm1, and erhpwm2 status = "okay", will enable the system clocks for 
>>    each subsystem. This equivalent to setting the following registers to the 
>>    given values in their respective order:
>>
>> reg[0x44E00000] = 0x0 *# CM_PER_L4L3_CLKSTCTRL.CLKTRCTRL = NO_SLEEP*
>> reg[0x44E000D4] = 0x2* # CM_PER_EPWMSS0_CLKCTRL.MODULEMODE = ENABLE*
>> reg[0x44E000CC] = 0x2 *# CM_PER_EPWMSS1_CLKCTRL.MODULEMODE = ENABLE*
>> reg[0x44E000D8] = 0x2* # CM_PER_EPWMSS2_CLKCTRL.MODULEMODE = ENABLE*
>>
>>    - However, after all this, the PWM subsystems will still not work 
>>    because the Time Based Clocks are not enabled. To enable them, one would 
>>    need kernel elevated privileges: such as modifying the register through a 
>>    simple kernel module.
>>
>> reg[0x44E10664] = 0x7 # CONTROL_MODULE.pwmss_ctrl = pwmss0_tbclken | 
>> (pwmss1_tbclken << 1) | (pwmss2_tbclken << 2)
>>
>> Using a simple kernel module I built for hardware debugging, I was able 
>> to confirmed this. (Look at ioremap & iounmap under kernel module 
>> development)
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to